You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is common for mathematically inspried code, yet the if in there is a lot of evaluations for a condition with a very predictable pattern (True, False, True, False, ....).
Making one loop for the odd and one for the even case, respectively, usually gives some speedup.
But actually, this operation can be fully vectorized leveraging NumPy's broadcasting rules.
integral is initalised with zeros which are never used, so initializing with empty would be slightly faster.
I have already forked the repository and rewrote the code to open a PR.
Kind regards
The text was updated successfully, but these errors were encountered:
Hello,
When I looked at the implementation of
_calc_kkr
I saw that there are 2 issues when it comes to speed:This is common for mathematically inspried code, yet the
if
in there is a lot of evaluations for a condition with a very predictable pattern (True
,False
,True
,False
, ....).Making one loop for the odd and one for the even case, respectively, usually gives some speedup.
But actually, this operation can be fully vectorized leveraging NumPy's broadcasting rules.
integral
is initalised with zeros which are never used, so initializing withempty
would be slightly faster.I have already forked the repository and rewrote the code to open a PR.
Kind regards
The text was updated successfully, but these errors were encountered: