[SciPy-User] Speeding up integrate.odeint with weave/blitz

Rob Clewley rob.clewley at gmail.com
Tue Dec 7 17:48:52 EST 2010


Gus,

On Tue, Dec 7, 2010 at 4:26 PM, Gus Ishere <gus.is.here at gmail.com> wrote:
> I currently have a call like: integrate.odeint(dX_dt,X0,t,full_output=True)
> One approach to speed up the integration time is to make dX_dt into a weave
> function. Is there a better way to speed it up and avoid the function call
> overhead in Python? Any examples would be very appreciated.
> dX_dt is very simple.

There are different compromises in the different possible approaches,
I wouldn't say any is "best". One approach is to use my PyDSTool
package (pydstool.sourceforge.net), which I think will save you work
and provide powerful options in the long term but requires some extra
installation and learning curve for the more sophisticated user
interface. It will automatically compile the dX_dt function you
specify into C and link it with the C integrator. So there is very
little overhead in interaction between your function and the
integrator, and once my code is installed this happens quite
transparently to the user. PyDSTool even gives you the opportunity to
hand-optimize the C code for your function before final compilation,
if that floats your speedboat.

-- 
Robert Clewley, Ph.D.
Assistant Professor
Neuroscience Institute and
Department of Mathematics and Statistics
Georgia State University
PO Box 5030
Atlanta, GA 30302, USA

tel: 404-413-6420 fax: 404-413-5446
http://www2.gsu.edu/~matrhc
http://neuroscience.gsu.edu/rclewley.html



More information about the SciPy-User mailing list