Lisandro Dalcin <dalc...@...> writes: > On 4 March 2010 09:05, Dag Sverre Seljebotn <dagss <at> student.matnat.uio.no> wrote: > > Are anybody aware of a library for solving ODEs with fast callbacks to > > Cython? The ones in SciPy require a Python callback at every step... > > > > IIRC, Jon Olav Vik was working on a Sundials wrapper... Search cython-devel.
http://thread.gmane.org/gmane.comp.python.cython.devel/6497 Quick summary (not of the previous discussion, but of some options now): Sundials is a feature-rich C library with a fairly fine-grained API for integrating differential equations. https://computation.llnl.gov/casc/sundials/ It also has Fortran bindings. Pysundials http://pysundials.sourceforge.net/ is based on J. G. Dominy's MSc thesis, "PySUNDIALS: Providing python bindings to a robust suite of mathematical tools for computational systems biology". http://etd.sun.ac.za/handle/10019/2523 I've built a coarser-grained wrapper for CVODE that you're welcome to try out. As mentioned in our previous discussion, Pysundials has an almost one-to-one correspondence with the fine-grained Sundials API. With your expertise you might be able to cythonize Sundials directly with little effort, with the end result being very similar to Pysundials. I tried, but am not familiar enough with C to generate the Cython declarations for all public parts of Sundials. Another option is to just cythonize Pysundials, but I encountered two main problems: * Nested functions (I tried checking out Cython-closures, but couldn't get it to work in a few quick attempts.) * Pysundials creates a callback function by eval'ing an expression involving the RHS function. I think it might be possible to rewrite those problem spots to allow Pysundials to bypass Python for Cython RHS's. However, just "rewriting" Pysundials in Cython is probably the cleaner option, and possibly just as easy for you. There is also PyDSTool, http://sourceforge.net/projects/pydstool/ http://www.cam.cornell.edu/~rclewley/cgi-bin/moin.cgi/MainProjectPage which I haven't taken the time to check out, though I have this nagging feeling that it might have saved me quite some time... Jon Olav _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
