[SciPy-User] Cython-izing calls to scipy.integrate.odeint: is my minimal example a good way to go about it?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[SciPy-User] Cython-izing calls to scipy.integrate.odeint: is my minimal example a good way to go about it?

Brian Merchant
Hi all,

The major bottleneck in my simulation code is the function supplied to `scipy.integrate.odeint` (call it `f`). `f` requires a lot of additional parameters (which are usually passed in as a tuple to the args keyword of `odeint`).

Based on some stuff I found on the internet, I am thinking of making `f` a Cython extension type with the methods __init__ and __call__. Here's a minimal example: https://gist.github.com/bmer/10e6ec268677288b2d60

Now, I can pass `f` to `odeint` after I initialize it, and everything works okay (tried it out).

Is this the best I can do in terms of efficiency?

Kind regards,
Brian

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/scipy-user
Loading...