Skip to content

Fix the solution bookkeeping for save_everystep=false (#428) - #429

Open
nathanaelbosch wants to merge 1 commit into
mainfrom
worktree-fix-428-calibrate-save-everystep
Open

Fix the solution bookkeeping for save_everystep=false (#428)#429
nathanaelbosch wants to merge 1 commit into
mainfrom
worktree-fix-428-calibrate-save-everystep

Conversation

@nathanaelbosch

Copy link
Copy Markdown
Owner

With save_everystep=false, savevalues! skips all of its ProbNumDiffEq-specific saving, so sol.x_filt was left with only the initial state and sol.diffusions was left empty. Two things broke as a result:

  • calibrate_solution! zips sol.pu (2 entries) against sol.x_filt (1 entry), so with a calibrated static diffusion the final sol.pu[end].Σ never got rescaled by the quasi-MLE sigma^2, and sigma^2 was not recoverable from the solution either.
  • Interpolating such a solution threw a BoundsError, since the interpolation indexes into the empty sol.diffusions. This is what the WorkPrecisionSet test with a dense TestSolution was marked broken for.

pn_solution_endpoint_match_cur_integrator! now always saves the endpoint into sol.x_filt, and saves the last step's diffusion when nothing was saved during the solve. The endpoint used integ.saveiter_dense for x_filt, which stays at 1 whenever dense=false; it now uses integ.saveiter like savevalues! does.

With `save_everystep=false`, `savevalues!` skips all of its
ProbNumDiffEq-specific saving, so `sol.x_filt` was left with only the
initial state and `sol.diffusions` was left empty. Two things broke as a
result:

- `calibrate_solution!` zips `sol.pu` (2 entries) against `sol.x_filt`
  (1 entry), so with a calibrated static diffusion the final `sol.pu[end].Σ`
  never got rescaled by the quasi-MLE sigma^2, and sigma^2 was not recoverable
  from the solution either.
- Interpolating such a solution threw a `BoundsError`, since the
  interpolation indexes into the empty `sol.diffusions`. This is what the
  `WorkPrecisionSet` test with a dense `TestSolution` was marked broken for.

`pn_solution_endpoint_match_cur_integrator!` now always saves the endpoint
into `sol.x_filt`, and saves the last step's diffusion when nothing was saved
during the solve. The endpoint used `integ.saveiter_dense` for `x_filt`, which
stays at 1 whenever `dense=false`; it now uses `integ.saveiter` like
`savevalues!` does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.31%. Comparing base (4c6cf29) to head (63c813f).

Files with missing lines Patch % Lines
src/integrator_utils.jl 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #429      +/-   ##
==========================================
+ Coverage   91.30%   91.31%   +0.01%     
==========================================
  Files          44       44              
  Lines        2230     2235       +5     
==========================================
+ Hits         2036     2041       +5     
  Misses        194      194              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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