Force dense=false for SDE/RODE solutions in InterpolationData#3274
Merged
ChrisRackauckas merged 1 commit intoSciML:masterfrom Mar 29, 2026
Merged
Conversation
SDE/RODE solvers never populate derivative stages (ks) because RODESolution has no .k field (_has_ks returns false). When a user passes dense=true to solve(), the InterpolationData was created with dense=true and empty ks, causing BoundsError in ode_interpolation! when it tries to access ks[i] for high-order interpolation. Force dense=false when W !== nothing (SDE/RODE) so that ode_interpolation falls through to linear_interpolant instead. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/SciMLSensitivity.jl
that referenced
this pull request
Mar 29, 2026
The RODE dense interpolation BoundsError is fixed at the source in OrdinaryDiffEqCore (SciML/OrdinaryDiffEq.jl#3274): force dense=false for SDE/RODE solutions so ode_interpolation uses linear interpolation. Remove the _has_empty_ks workaround from ischeckpointing — the solution will correctly have dense=false once the upstream fix lands. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
Contributor
Author
Root cause of the Rodas3/ROS34PW3 interpolation bugThe consolidation PR (#3102) added a Hermite fallback in k₁ = dt*f₀ - (u - uprev)
k₂ = 2*(u - uprev) - dt*(f₀ + f₁)But the Hermite interpolation in u(θ) = (1-θ)*y₀ + θ*y₁ + θ*(θ-1)*((1-2θ)*(y₁-y₀) + (θ-1)*dt*k[1] + θ*dt*k[2])The fallback stored wrong coefficients, producing wildly inaccurate interpolation (e.g. Fix: Remove the incorrect Hermite fallback entirely. Methods with empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SDE/RODE solvers never populate derivative stages (
ks) becauseRODESolutionhas no.kfield (_has_ksreturnsfalse, sosave_dense_at_t!is a no-op). When a user passesdense=truetosolve(), theInterpolationDatawas created withdense=trueand emptyks, causingBoundsErrorinode_interpolation!when it triesks[i]for high-order interpolation.Fix: Force
dense=falsewhenW !== nothing(SDE/RODE path) in_ode_init, right beforeInterpolationDataconstruction. This makesode_interpolationuselinear_interpolantinstead.This fixes the
BoundsError: attempt to access 0-element Vector{Vector{Vector{Float64}}} at index [50001]seen in SciMLSensitivity.jl's RODEInterpolatingAdjointtests (SciML/SciMLSensitivity.jl#1398).Test plan
dense=false)🤖 Generated with Claude Code