Hi,

On top of the recent changes you have made Troels, there are a number
of other things which can be done to speed up Andy's model (B14) in
relax:

http://svn.gna.org/viewcvs/*checkout*/relax/trunk/lib/dispersion/b14.py?content-type=text%2Fplain

1)  The first is int to float conversions.  This is not so important,
especially for powers where integers are preferable.  But the integer
'1' appears 5 times in the code, '2' six times, and '4' once
(excluding powers).  These can all be changed to 1.0, 2.0, or 4.0.

2)  The calculation "r20a - r20b" is performed twice.  So is "2.0 *
tcp".  And "sqrt(g1**2 + g2**2)".

3)  "1/sqrt(2)" does not need to be calculated for each function call!
 Maybe before the function define the module variable "g_fact = 1.0 /
sqrt(2.0)".  Then it is calculated once when imported and then never
again.

4)  pB, k_AB, and k_BA can be calculated within the target function
instead of in lib.dispersion.b14.  There are a number of other similar
speed ups possible ("4 * k_BA * k_AB", "k_AB - k_BA", you might find
others).

5)  Replace the function call complex(0, 1.0) with 1.0j.

That's it.  This will make the B14 model the fastest possible, and
should make a significant difference.

Regards,

Edward


P. S.  You can probably delete the "Baldwins code" comment.  I would
also suggest that as Andy wrote the code first, that he should be
first in the copyright statement.  And finally, the CR72 text in the
"Links" section of the module docstring can be deleted as there is no
comparison to B14 at those links.

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
[email protected]

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-devel

Reply via email to