Author: bugman Date: Fri May 23 20:08:25 2014 New Revision: 23390 URL: http://svn.gna.org/viewcvs/relax?rev=23390&view=rev Log: Merged revisions 23389 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r23389 | bugman | 2014-05-23 19:39:53 +0200 (Fri, 23 May 2014) | 6 lines Small speed up for all the isotropic cone and pseudo-elliptic cone frame order models. The vector length calculation for the numeric PCS integration has been simplified and shifted outside of a loop to take advantage of the speed of numpy. ........ Modified: branches/frame_order_cleanup/ (props changed) branches/frame_order_cleanup/lib/frame_order/matrix_ops.py Propchange: branches/frame_order_cleanup/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri May 23 20:08:25 2014 @@ -1 +1 @@ -/trunk:1-23385 +/trunk:1-23389 Modified: branches/frame_order_cleanup/lib/frame_order/matrix_ops.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/matrix_ops.py?rev=23390&r1=23389&r2=23390&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/matrix_ops.py (original) +++ branches/frame_order_cleanup/lib/frame_order/matrix_ops.py Fri May 23 20:08:25 2014 @@ -23,8 +23,8 @@ """Module for the handling of Frame Order.""" # Python module imports. -from math import cos, sin, sqrt -from numpy import dot, inner, transpose +from math import cos, sin +from numpy import dot, inner, sqrt, transpose # relax module imports. from lib.linear_algebra.kronecker_product import transpose_23 @@ -134,12 +134,12 @@ rot_vect_rev = transpose(dot(R_i, r_pivot_atom_rev) + r_ln_pivot) rot_vect = transpose(dot(R_i, r_pivot_atom) + r_ln_pivot) + # The vector length (to the 5th power). + length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 + length = 1.0 / norm(rot_vect, axis=1)**5 + # Loop over the atoms. for j in range(len(r_pivot_atom[0])): - # The vector length (to the 5th power). - length_rev = 1.0 / sqrt(inner(rot_vect_rev[j], rot_vect_rev[j]))**5 - length = 1.0 / sqrt(inner(rot_vect[j], rot_vect[j]))**5 - # Loop over the alignments. for i in range(len(pcs_theta)): # Skip missing data. @@ -149,10 +149,10 @@ # The projection. if full_in_ref_frame[i]: proj = dot(rot_vect[j], dot(A[i], rot_vect[j])) - length_i = length + length_i = length[j] else: proj = dot(rot_vect_rev[j], dot(A[i], rot_vect_rev[j])) - length_i = length_rev + length_i = length_rev[j] # The PCS. pcs_theta[i, j] += proj * length_i @@ -219,12 +219,12 @@ rot_vect_rev = transpose(dot(R_i, r_pivot_atom_rev) + r_ln_pivot) rot_vect = transpose(dot(R_i, r_pivot_atom) + r_ln_pivot) + # The vector length (to the 5th power). + length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 + length = 1.0 / norm(rot_vect, axis=1)**5 + # Loop over the atoms. for j in range(len(r_pivot_atom[0])): - # The vector length (to the 5th power). - length_rev = 1.0 / sqrt(inner(rot_vect_rev[j], rot_vect_rev[j]))**5 - length = 1.0 / sqrt(inner(rot_vect[j], rot_vect[j]))**5 - # Loop over the alignments. for i in range(len(pcs_theta)): # Skip missing data. @@ -234,10 +234,10 @@ # The projection. if full_in_ref_frame[i]: proj = dot(rot_vect[j], dot(A[i], rot_vect[j])) - length_i = length + length_i = length[j] else: proj = dot(rot_vect_rev[j], dot(A[i], rot_vect_rev[j])) - length_i = length_rev + length_i = length_rev[j] # The PCS. pcs_theta[i, j] += proj * length_i