mailRe: r24007 - /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 Edward d'Auvergne on June 17, 2014 - 10:44:
Hi,

I think this is one of those cases where we will see that a future
numpy version will implement this correctly and fast.  I've been
looking into the numpy 1.8.1 source code, and the inplace operation
and the speed of the out argument appear to be unrelated.  Anyway,
numpy 2 might implement the out argument correctly for speed, so that
"dot(a, b, c)" is an order of magnitude faster than "c = dot(a, b)",
as it really should be, just like in the BLAS library used by
numpy.dot() where it is much faster.

Regards,

Edward


On 16 June 2014 22:11,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Mon Jun 16 22:11:56 2014
New Revision: 24007

URL: http://svn.gna.org/viewcvs/relax?rev=24007&view=rev
Log:
Changed the calculation of inner product in model ns cpmg 2site 3d.

The out argument of numpy.dot is buggy, and should not be used.

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=24007&r1=24006&r2=24007&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 Mon Jun 16 
22:11:56 2014
@@ -141,9 +141,6 @@
             # The matrix R that contains all the contributions to the 
evolution, i.e. relaxation, exchange and chemical shift evolution.
             R = rcpmg_3d(R1A=r10a, R1B=r10b, R2A=R2A_si_mi, R2B=R2B_si_mi, 
pA=pA, pB=pB, dw=dw_si_mi, k_AB=k_AB, k_BA=k_BA)

-            # The essential evolution matrix. This initialises the 
structure.
-            evolution_matrix = asarray(R) * 0.0
-
             # Loop over the time points, back calculating the R2eff values.
             for di in range(num_points_si_mi):
                 # Extract the values from the higher dimensional arrays.
@@ -160,10 +157,10 @@

                 # The essential evolution matrix.
                 # This is the first round.
-                dot(Rexpo, r180x, evolution_matrix)
-                dot(evolution_matrix * 1.0, Rexpo, evolution_matrix)
+                evolution_matrix = dot(Rexpo, r180x)
+                evolution_matrix = dot(evolution_matrix, Rexpo)
                 # The second round.
-                dot(evolution_matrix * 1.0, evolution_matrix * 1.0, 
evolution_matrix)
+                evolution_matrix = dot(evolution_matrix, evolution_matrix )

                 # Loop over the CPMG elements, propagating the 
magnetisation.
                 for j in range(power_si_mi_di):


_______________________________________________
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



Related Messages


Powered by MHonArc, Updated Tue Jun 17 11:20:21 2014