Menu

SVN archive Commit Log


Commit Date  
[r24160] by tlinnet

Moved the calculation the evolution matrix out of for loops.

The trick is that numpy.einsum allows for dot product of higher dimension:

- The the essential evolution matrix.
- This is a dot product of the outer [7][7] matrix of the Rexpo_mat and r180x_mat matrixes, which
- have the shape [NE][NS][NM][NO][ND][7][7].
- This can be achieved by using numpy einsum, and where ellipsis notation will use the last axis.
evolution_matrix_mat = einsum('...ij,...jk', Rexpo_mat, r180x_mat)
evolution_matrix_mat = einsum('...ij,...jk', evolution_matrix_mat, Rexpo_mat)
evolution_matrix_mat = einsum('...ij,...jk', evolution_matrix_mat, evolution_matrix_mat)

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

2014-06-19 15:42:16 Tree
[r24159] by tlinnet

Made notation consistent for variables, using "_i" to clarify extracted data from matrix.

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

2014-06-19 15:42:14 Tree
[r24158] by tlinnet

Implemented double speed of model NS CPMG 2site 3D:

This is done by moving the costly calculation of the matrix exponential out of the for loops.
The trick was to find a method to do dot product of higher dimensions.
Thiw was done with numpy.einsum:
Example at:
http://wiki.nmr-relax.com/Numpy_linalg#Ellipsis_broadcasting_in_numpy.einsum

Example:
dot_V_W = einsum('...ij,...jk', V, W_exp_diag)
Where V, and W_exp_diag has shape: [NE][NS][NM][NO][ND][7][7]

The profiling script shows a 2X speed up.

----BEFORE:
SINGLE
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 18.811 18.811 <string>:1(<module>)
1 0.002 0.002 18.811 18.811 pf_3d:407(single)
CLUSTER
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 18.315 18.315 <string>:1(<module>)
1 0.001 0.001 18.315 18.315 pf_3d:431(cluster)

-----AFTER:
SINGLE
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 8.818 8.818 <string>:1(<module>)
1 0.002 0.002 8.818 8.818 pf_3d:407(single)
CLUSTER
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 9.082 9.082 <string>:1(<module>)
1 0.001 0.001 9.082 9.082 pf_3d:431(cluster)

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

2014-06-19 15:42:05 Tree
[r24157] by tlinnet

Inserted intermediate step, to check if the matrix propagator to evolve the magnetization is equal
when done for lower dimensional data of shape [7][7] and higher dimensional data of shape [NE][NS][NM][NO][ND][7][7].

A short example is shown at the wiki:
http://wiki.nmr-relax.com/Numpy_linalg#Ellipsis_broadcasting_in_numpy.einsum

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

2014-06-19 15:42:02 Tree
[r24156] by tlinnet

Added function to compute the matrix exponential for higher dimensional data of shape [NE][NS][NM][NO][ND][7][7].

This is done by using numpy.einsum, to make the dot product of the last two axis.

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

2014-06-19 15:41:59 Tree
[r24155] by tlinnet

Added another intermediate step.

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

2014-06-19 15:41:55 Tree
[r24154] by tlinnet

Added intermediate step with for loops.

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

2014-06-19 15:41:51 Tree
[r24153] by tlinnet

Shifted the computation of Rexpo two loops up.

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

2014-06-19 15:41:49 Tree
[r24152] by tlinnet

Implemented test, to see if 3D exchange matrixes are the same.

This can be tested while running systemtest test_hansen_cpmg_data_to_ns_cpmg_2site_3D.

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

2014-06-19 15:41:45 Tree
[r24151] by tlinnet

Implemented the collection of the 3D exchange matrix, for rank [NE][NS][NM][NO][ND][7][7].

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

2014-06-19 15:41:41 Tree
Older >
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.