Skip to content

Reset LeapfrogMidpoint history after a vector-field jump - #798

Open
DiadkoShmek wants to merge 1 commit into
patrick-kidger:mainfrom
DiadkoShmek:lezo-leapfrog-jump-20261104
Open

DiadkoShmek wants to merge 1 commit into
patrick-kidger:mainfrom
DiadkoShmek:lezo-leapfrog-jump-20261104

Conversation

@DiadkoShmek

Copy link
Copy Markdown

LeapfrogMidpoint.step() ignores made_jump, so a resumed solve can combine pre-discontinuity history with the new vector field. Solving y'=1 from 0 to 1 with dt0=0.25, then resuming with y'=2, retained solver_state and made_jump=True, gives 1.75 at time 1.25 instead of the exact 1.5. Later steps can alternate between correct and incorrect states; endpoint-only checks can miss the error.

Select (t0, y0) as the history after a jump, using the existing Euler startup. Elementwise selection supports traced jump flags and the scalar promotion already supported by direct init/step calls. The solver-state representation and ordinary continuation remain intact.

Two compact regressions in the existing solver test module cover forward/backward restart values and analytic rate gradients, plus no-jump time/state promotion controls.

Validation on current main e950aa2 with CPU JAX 0.12.0.1:

  • Exact final regression file on the base: two restart failures and two passing promotion controls.
  • Final regressions and adjacent Leapfrog/basic-integration, HalfSolver and step-controller checks: 31 passed. One existing parametrization warning remains.
  • A separate local analytic matrix checks all four saved post-jump states, gradients, float32/float64, mixed dynamic jump flags, complex state, and HalfSolver/clip-controller controls: 14 failing comparisons on the base / 24 passing controls; all 38 comparisons pass with the fix.
  • Project-pinned Ruff 0.13.0 lint/format and Pyright 1.1.405 pass on both changed files; git diff --check passes.

The full repository suite, accelerators, general SDE coverage and performance were not evaluated. Implementation and testing were AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant