[SciPy-User] ODE integration : pre allocation
Thu Jul 19 10:53:02 CDT 2012
Le mercredi 04 juillet 2012 à 13:07 +0200, Fabrice Silva a écrit :
> Hi folks,
> I was wondering if the ode integrators in scipy.integrate.ode handle the
> pre-allocation of the result of the rhs (i.e. y'=f(y,t) ).
> A creation/allocation of the result array may lead to a strong
> performance penalty, am I wrong ?
> Is there a way to provide a reference to a pre-allocated array that
> would only have to be filled ? For example, the callable signature would
> be :
> f(t, y, y', *f_args)
> where t, y and f_args are inputs, and y' is the output. When calling the
> callable, y' would be a reference to the result array to be filled.
> Any thought?
This would be possible for *vode solvers by changing in vode.pyf (L12)
double precision dimension(n),intent(out,c) :: ydot
double precision dimension(n),intent(in,out,c) :: ydot
Same in dop.pyf
double precision dimension(n),intent(out,c) :: f
double precision dimension(n),intent(in,out,c) :: f
removed the need to allocate an array for the ydot result.
More information about the SciPy-User