mailRe: r23952 - /branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Troels Emtekær Linnet on June 15, 2014 - 15:02:
Hi Ed.

I tried the out argument, but it wont work?

I was more thinking of giving dot two matrices that are both C_CONTIGUOUS.

http://wiki.scipy.org/PerformanceTips



2014-06-15 10:33 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:

Hi Troels,

Is this actually faster?  I just wrote a script to test this at
https://gna.org/task/index.php?7807#comment199.  The log file with the
results is also attached.  This is also archived at
http://article.gmane.org/gmane.science.nmr.relax.devel/6240.  If you
look at that, I think I can show a way to make the numeric models up
to twice as fast.  And that is simply to use the out argument for the
dot product.  At least it will minimise the time required for the dot
products, and maybe remove this as the bottleneck.

Regards,

Edward



On 15 June 2014 08:53,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Sun Jun 15 08:53:38 2014
New Revision: 23952

URL: http://svn.gna.org/viewcvs/relax?rev=23952&view=rev
Log:
Changed linked matrix/vector inner products into chained dot expressions.

Task #7807 (https://gna.org/task/index.php?7807): Speed-up of
dispersion models for Clustered analysis.

Modified:
    branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py

Modified: branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py
URL:
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py?rev=23952&r1=23951&r2=23952&view=diff

==============================================================================
--- branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py
(original)
+++ branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py Sun Jun
15 08:53:38 2014
@@ -56,6 +56,7 @@
 # Python module imports.
 from numpy import dot, fabs, isfinite, log, min, ones, ndarray
 from numpy.ma import fix_invalid, masked_less_equal, masked_where
+import numpy as np

 # relax module imports.
 from lib.dispersion.ns_matrices import rcpmg_3d
@@ -138,9 +139,7 @@

         # Loop over the CPMG elements, propagating the magnetisation.
         for j in range(2*power[i]):
-            Mint = dot(Rexpo, Mint)
-            Mint = dot(r180x, Mint)
-            Mint = dot(Rexpo, Mint)
+            Mint = Rexpo.dot(r180x).dot(Rexpo).dot(Mint)

         # The next lines calculate the R2eff using a two-point
approximation, i.e. assuming that the decay is mono-exponential.
         Mx = Mint[1] / pA


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
relax-devel@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel



Related Messages


Powered by MHonArc, Updated Sun Jun 15 15:40:13 2014