Author: tlinnet Date: Tue Jul 22 16:51:38 2014 New Revision: 24626 URL: http://svn.gna.org/viewcvs/relax?rev=24626&view=rev Log: Code validation of lib/dispersion/matrix_exponential. Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis. Modified: branches/disp_spin_speed/lib/dispersion/matrix_exponential.py Modified: branches/disp_spin_speed/lib/dispersion/matrix_exponential.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/matrix_exponential.py?rev=24626&r1=24625&r2=24626&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/matrix_exponential.py (original) +++ branches/disp_spin_speed/lib/dispersion/matrix_exponential.py Tue Jul 22 16:51:38 2014 @@ -59,7 +59,7 @@ @rtype: numpy float array of rank [NE][NS][NM][NO][ND][X][X] """ - # Extract shape. + # Extract shape. NE, NS, NM, NO, ND, Row, Col = A.shape # Convert dtype, if specified. @@ -100,13 +100,13 @@ # Make dot products for higher dimension. # "...", the Ellipsis notation, is designed to mean to insert as many full slices (:) # to extend the multi-dimensional slice to all dimensions. - dot_V_W = einsum('...ij,...jk', V, W_exp_diag) + dot_V_W = einsum('...ij, ...jk', V, W_exp_diag) # Compute the (multiplicative) inverse of a matrix. inv_V = inv(V) # Calculate the exact exponential. - eA = einsum('...ij,...jk', dot_V_W, inv_V) + eA = einsum('...ij, ...jk', dot_V_W, inv_V) # Return the complex matrix. if complex_flag: @@ -171,13 +171,13 @@ # Make dot products for higher dimension. # "...", the Ellipsis notation, is designed to mean to insert as many full slices (:) # to extend the multi-dimensional slice to all dimensions. - dot_V_W = einsum('...ij,...jk', V, W_exp_diag) + dot_V_W = einsum('...ij, ...jk', V, W_exp_diag) # Compute the (multiplicative) inverse of a matrix. inv_V = inv(V) # Calculate the exact exponential. - eA = einsum('...ij,...jk', dot_V_W, inv_V) + eA = einsum('...ij, ...jk', dot_V_W, inv_V) # Return the complex matrix. if complex_flag: @@ -247,7 +247,7 @@ # If dis is negative: two complex roots # Eigenvalues lambda_1, lambda_2. - l1 = (-b + dis) / (2*a) + l1 = (-b + dis) / (2*a) l2 = (-b - dis) / (2*a) # Define M: M = V^-1 * [ [l1 0], [0 l2] ] * V