[SciPy-User] help speeding up a Runge-Kuta algorithm (cython, f2py, ...)

Pauli Virtanen pav@iki...
Fri Aug 3 13:56:45 CDT 2012

03.08.2012 19:02, Ryan Krauss kirjoitti:
> Can anyone either make my Cython or Fortran approaches work or point
> me in a different direction?

Regarding Cython: run

	cython -a runge_kuta.pyx

and check the created HTML file. Slow points are highlighted with yellow.

Regarding this case:

- `cdef`, not `def` for the dxdt_* function

- from libc.math import exp

- Do not use small numpy arrays inside loops.
  Use C constructs instead.

- Use @cython.cdivision(True), @cython.boundscheck(False)

PS. Runge-Kutta

Pauli Virtanen

More information about the SciPy-User mailing list