| I have a few hundred lines of code that calculate a system of ODEs. The resulting system of several hundred to several thousand equations take a long time to integrate. (I'm using SciPy's integrate interface; testing on a small case suggested it's several times faster than GSL's ode_solver for my problem.) Of course, most of the time is spent in evaluating my equations. I'm already using fast_callable to speed up the calculations. It made a wonderful difference. But it's still taking hours or even days for the larger systems. I want to put this integration inside an optimizer, so any speed gain is great. Stealing the example from the reference manual (http://www.sagemath.org/doc/numerical_sage/scipy.html), I'm currently doing something like the following. I don't think I can speed up the integrate routine. Can I do anything to speed up Thanks! |
| You may be able to use Cython to speed up such things. In order to do so most efficiently, you'd want to I'm not at all a Cython expert, though; I know it really depends on the specifics of your use case, and of course Good luck! |
| In my opinion, the funcion desolve_odeint (in versions >=4.6) provides what you want. Basically it takes a symbolic expression as the vector field, it compiles it to a fast float expression and then integrates it using the scipy.odeint solver. I have never used with hundreds of variables, but let us know your experiences... In your case I would do the following: and if you want a nice plot
But didn't the original poster already use scipy.odeint and fast_callable/fast_float? Let's hope it works, though!
kcrisman (Mar 30 '11) |
Asked: Mar 12 '11
Seen: 208 times
Last updated: Mar 30 '11
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.