This PR adds a caching mechanism that ensures that the ODE is called only once, and then subsequent calls are interpolated from an interpolation table.
@dlanzieri please review this PR and let me know what you think :-)
A few observations on the modifications I've made:
There is now only one place where the ODE function is called. In general, duplicating identical code is a big no-no, because if you change the ODE in one function, you may forget to update the other functions.
This PR adds a caching mechanism that ensures that the ODE is called only once, and then subsequent calls are interpolated from an interpolation table.
@dlanzieri please review this PR and let me know what you think :-)
A few observations on the modifications I've made:
There is now only one place where the ODE function is called. In general, duplicating identical code is a big no-no, because if you change the ODE in one function, you may forget to update the other functions.
I use the ODE function itself to compute second order growth instead of replicating the code for the ODE in functions
gf
andgf2
. It's the same approach that was taken in the original code here: https://github.com/modichirag/flowpm/blob/d4b4872c824c482f8315737c50181b4630453da1/flowpm/background.py#L196a few functions didn't have a
cosmo
parameter ^^' so I added it, but the documentations are missing this argumentI hope now everything should work fine