Hello, Attached is a patch which adds a wrapper class 'zode' to integrate.ode. It allows one to conviniently solve systems of odes with complex values using the existing real valued solvers vode, dopri5, dop853, instead of zode, by simply integrating the real/imag parts. Is this worth commiting? It appears to me to be considerably faster than zvode for my big systems of equations. I'm not sure why, as I intuitively thought all the data copying etc. would slow it down. But it is after all only a convenience, anyone can do it themselves. Cheers, John
Mon, 23 Feb 2009 18:25:45 +0000, John Travers wrote:
Attached is a patch which adds a wrapper class 'zode' to integrate.ode. It allows one to conviniently solve systems of odes with complex values using the existing real valued solvers vode, dopri5, dop853, instead of zode, by simply integrating the real/imag parts.
Is this worth commiting?
Looks good to me, and may be generally useful, so I'm +1 But before committing, I'd suggest a couple of things: - The name 'zode' is slightly confusing vs. ZVODE and not very descriptive. Maybe 'complex_ode' would be better? This would leave us wiggle room later on with the naming... - Is it possible to do the real -> complex switch automatically, based on the type of return value from (a trial evaluation of) f? On a second thought, this might be brittle. - Since 'ode' supports Jacobians, it'd be nice if the wrapper supported them, too.
It appears to me to be considerably faster than zvode for my big systems of equations. I'm not sure why, as I intuitively thought all the data copying etc. would slow it down.
Is your RHS an analytic function of all of the variables? The ZVODE docs seem to mention this as a requirement. But I don't know if the ZVODE implementation itself is supposed to be fast. -- Pauli Virtanen
On Mon, Feb 23, 2009 at 8:54 PM, Pauli Virtanen <pav@iki.fi> wrote:
Mon, 23 Feb 2009 18:25:45 +0000, John Travers wrote:
Attached is a patch which adds a wrapper class 'zode' to integrate.ode. It allows one to conviniently solve systems of odes with complex values using the existing real valued solvers vode, dopri5, dop853, instead of zode, by simply integrating the real/imag parts.
Is this worth commiting?
Looks good to me, and may be generally useful, so I'm +1
OK, it was commited as rev 5594 with the following corrections:
But before committing, I'd suggest a couple of things:
- The name 'zode' is slightly confusing vs. ZVODE and not very descriptive. Maybe 'complex_ode' would be better?
Fixed.
This would leave us wiggle room later on with the naming...
- Is it possible to do the real -> complex switch automatically, based on the type of return value from (a trial evaluation of) f?
On a second thought, this might be brittle.
I think this would be too much black magic. At least in the current way the users intention must be explicit.
- Since 'ode' supports Jacobians, it'd be nice if the wrapper supported them, too.
I've added this, but it could do with more testing as I'm a little unsure of the signs. It passes the one complex problem test with a Jacobian.
It appears to me to be considerably faster than zvode for my big systems of equations. I'm not sure why, as I intuitively thought all the data copying etc. would slow it down.
Is your RHS an analytic function of all of the variables? The ZVODE docs seem to mention this as a requirement. But I don't know if the ZVODE implementation itself is supposed to be fast.
I think it is only a requirement for the stiff solver. But my RHS is analytic anayway. Further testing has shown that vode only has a slight advantage over zvode, but dopri5 with th complex wrapper thrashes them both. Cheers, John
participants (2)
-
John Travers
-
Pauli Virtanen