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

Brian Merchant bhmerchant at gmail.com
Sat Feb 20 20:53:39 EST 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20160220/a6032447/attachment.html>


More information about the SciPy-User mailing list