mailRe: r24212 - /branches/disp_spin_speed/lib/dispersion/ns_mmq_3site.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 23, 2014 - 12:07:
As before, all the dot products of M1, M2, M1* and M2* can also be
shifted out of the loops for large speed increases.

Regards,

Edward


On 20 June 2014 17:42,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Fri Jun 20 17:42:56 2014
New Revision: 24212

URL: http://svn.gna.org/viewcvs/relax?rev=24212&view=rev
Log:
Moved the calculation of the matrix exponential out of for loops for ns mmq 
3site mq.

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_mmq_3site.py

Modified: branches/disp_spin_speed/lib/dispersion/ns_mmq_3site.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/ns_mmq_3site.py?rev=24212&r1=24211&r2=24212&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/ns_mmq_3site.py     (original)
+++ branches/disp_spin_speed/lib/dispersion/ns_mmq_3site.py     Fri Jun 20 
17:42:56 2014
@@ -62,7 +62,7 @@
 # relax module imports.
 from lib.float import isNaN
 from lib.dispersion.ns_matrices import rmmq_3site, rmmq_3site_rankN
-from lib.linear_algebra.matrix_exponential import matrix_exponential
+from lib.linear_algebra.matrix_exponential import matrix_exponential, 
matrix_exponential_rankN
 from lib.linear_algebra.matrix_power import square_matrix_power


@@ -150,6 +150,16 @@
     # Z- matrix component.
     m2_mat = rmmq_3site_rankN(R20A=R20A, R20B=R20B, R20C=R20C, dw_AB=dw_AB 
- dwH_AB, dw_AC=dw_AC - dwH_AC, k_AB=k_AB, k_BA=k_BA, k_BC=k_BC, k_CB=k_CB, 
k_AC=k_AC, k_CA=k_CA, tcp=tcp)

+    # The M1 and M2 matrices.
+    # Equivalent to D+.
+    M1_mat = matrix_exponential_rankN(m1_mat)
+    # Equivalent to Z-.
+    M2_mat = matrix_exponential_rankN(m2_mat)
+
+    # The complex conjugates M1* and M2*
+    M1_star_mat = conj(M1_mat)
+    M2_star_mat = conj(M2_mat)
+
     # Loop over spins.
     for si in range(NS):
         # Loop over the spectrometer frequencies.
@@ -162,20 +172,24 @@
                 # Loop over the time points, back calculating the R2eff 
values.
                 for i in range(num_points_i):
                     # The M1 and M2 matrices.
-                    M1 = matrix_exponential(m1_mat[si, mi, oi, i])    # 
Equivalent to D+.
-                    M2 = matrix_exponential(m2_mat[si, mi, oi, i])    # 
Equivalent to Z-.
+                    # Equivalent to D+.
+                    M1_i = M1_mat[si, mi, oi, i]
+                    # Equivalent to Z-.
+                    M2_i = M2_mat[si, mi, oi, i]

                     # The complex conjugates M1* and M2*
-                    M1_star = conj(M1)    # Equivalent to D+*.
-                    M2_star = conj(M2)    # Equivalent to Z-*.
+                    # Equivalent to D+*.
+                    M1_star_i = M1_star_mat[si, mi, oi, i]
+                    # Equivalent to Z-*.
+                    M2_star_i = M2_star_mat[si, mi, oi, i]

                     # Repetitive dot products (minimised for speed).
-                    M1_M2 = dot(M1, M2)
-                    M2_M1 = dot(M2, M1)
+                    M1_M2 = dot(M1_i, M2_i)
+                    M2_M1 = dot(M2_i, M1_i)
                     M1_M2_M2_M1 = dot(M1_M2, M2_M1)
                     M2_M1_M1_M2 = dot(M2_M1, M1_M2)
-                    M1_M2_star = dot(M1_star, M2_star)
-                    M2_M1_star = dot(M2_star, M1_star)
+                    M1_M2_star = dot(M1_star_i, M2_star_i)
+                    M2_M1_star = dot(M2_star_i, M1_star_i)
                     M1_M2_M2_M1_star = dot(M1_M2_star, M2_M1_star)
                     M2_M1_M1_M2_star = dot(M2_M1_star, M1_M2_star)



_______________________________________________
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 Mon Jun 23 12:40:14 2014