diffrax icon indicating copy to clipboard operation
diffrax copied to clipboard

Restart after event

Open dkweiss31 opened this issue 1 year ago • 2 comments

I'm wondering if you'd be interested in a PR that would allow for solves that are terminated via events to be restarted (after some user-supplied update function is called) until t1 is reached?

This is something very relevant for quantum applications: a typical trajectory can experience multiple events or "jumps" before the final time. If however this is not something you think might be of general interest, happy to implement this outside of diffrax.

dkweiss31 avatar Aug 17 '24 03:08 dkweiss31

I think this is probably best done outside of Diffrax -- users may wish to do arbitrary things across the jump, and I thnk it'd be hard to provide an API that supports them all.

I'll note that doing this restart is just a matter of wrapping diffrax.diffeqsolve in a lax.while_loop, so it should be straigtforward.

patrick-kidger avatar Aug 17 '24 06:08 patrick-kidger

Understood, thank you!

dkweiss31 avatar Aug 17 '24 12:08 dkweiss31