[SciPy-dev] Wrapped up lsodar

Ryan Gutenkunst rng7 at cornell.edu
Mon Jul 25 14:07:04 CDT 2005

Hi all,

I've wrapped up the lsodar integration routine from odepack. 
(http://www.netlib.org/odepack/) In the hopes of being useful to SciPy, 
I've made the wrapper backward-compatible with the current odeint in SciPy.

Enhancements to the old odeint:
* Root-finding: Solve dydt = f while looking for roots of the function 
g(y, t). For a given root, the integrator can either just record its 
crossing, or terminate at that point.
* Intermediate output mode: If int_pts = True, then the integrator 
returns yout and tout, which include every step the integrator took. 
This is useful if you want to track the behavior of a function, but 
don't know where the interesting regions are ahead of time.
* f2py used to wrap: I have some vague recollection of a desire to move 
away from hand-generated wrappers in SciPy.

Issues remaining: (I'd love help with any of these.)
* col_deriv: The jacobian could be calculated in Fortran order, which 
would prevent a few array copies. I think f2py provides a way to specify 
whether arrays should be copied/transposed, but I couldn't understand 
it. :-)
* Banded jacobians: I never used this feature, and I don't really 
understand it, so there's no test cases for it yet.
* Speed: It's about 10% slower than odeint on a test problem. I don't 
know yet how much of the slowdown is in the wrapping or the algorithm 
switch. It might also just be that my f2py'ing is linking to different 
libraries than odeint was compiled with on this machine.

I'm not sure whether this is actually interesting to SciPy, but I 
figured I put it out there.

Any comments are appreciated, and if changes need to be made to get it 
into the core SciPy distribution, I'm happy to make them.

(The attached .tgz file contains:
  lsodar.pyf - The f2py wrapper file
  lsodar.py - The python interface
  test_lsodar.py - Unit tests for the integrator
  speedTest.py - A race between odeint and the newly-wrapped version)


Ryan Gutenkunst               |
Cornell LASSP                 |       "It is not the mountain
                               |        we conquer but ourselves."
Clark 535 / (607)227-7914     |        -- Sir Edmund Hillary
AIM: JepettoRNG               |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lsodar.tgz
Type: application/x-tar
Size: 6826 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20050725/cb53b3a0/attachment.tar 

More information about the Scipy-dev mailing list