Repository navigation
Honor ImplicitEuler first-stage predictor (combines #3870 + #3873, fixes out-of-place MaxOrder) - #3879
Merged
ChrisRackauckas merged 1 commit intoJul 12, 2026
Conversation
…seed Restore the public predictor selection for the implicit first stage of direct ImplicitEuler solves, regressed by SciML#3694 which always used the linear `dt * fsalfirst` seed. `Trivial` now seeds z = 0, `Linear` seeds z = dt·f(uprev), and `MaxOrder` extrapolates the previous step's interpolant. BDF algorithms (e.g. ABDF2) that reuse the IE tableau via `cache.eulercache` without a `predictor` field keep the linear bootstrap seed through the `!hasproperty(alg, :predictor)` gate — provably the same seed as master. Also fix an out-of-place crash: the MaxOrder branch used the in-place `current_extrapolant!(u, …)`, which throws `fill!(::Float64, ::Float64)` for scalar/SVector out-of-place `u`. The out-of-place path now uses the non-mutating `current_extrapolant`. Add Trivial/Linear/MaxOrder regression coverage on both the in-place and out-of-place paths, and bump OrdinaryDiffEqSDIRK to v2.8.1. Combines and supersedes SciML#3870 and SciML#3873. Co-Authored-By: Chris Rackauckas <[email protected]>
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.
Ignore this PR until reviewed by @ChrisRackauckas.
Summary
Combines and supersedes #3870 and #3873, which were two independent attempts at the same fix. This PR takes the more complete pieces of each and fixes a latent bug present in both of them.
Predictor.Trivial,Predictor.Linear, andPredictor.MaxOrderwhen seeding the implicit first stage of directImplicitEulersolves (regressed by Fix ABDF2 𝒪est regression on nlstep tests: linear-extrap initial guess for IE bootstrap #3694, which always used the lineardt * fsalfirstseed and ignored the public predictor).ABDF2) that reuse the Implicit Euler tableau viacache.eulercachewithout carrying apredictorfield — provably identical seed to the currentmaster.MaxOrderbranch calls the in-placecurrent_extrapolant!(u, …), which throwsMethodError: no method matching fill!(::Float64, ::Float64)for scalar out-of-place problems (ImplicitEuler(predictor = Predictor.MaxOrder)on a scalarODEProblem). This PR uses the non-mutatingcurrent_extrapolanton the out-of-place path.MaxOrderseed.Relationship to #3870 and #3873
!hasproperty(alg, :predictor)!(alg isa ImplicitEuler) && Trivial!hasproperty(alg, :predictor)_predictorcomment refreshedMaxOrderMaxOrdertest coverageThe
!hasproperty(alg, :predictor)gate (from #3870) is preferred over #3873's!(alg isa ImplicitEuler) && predictor == Predictor.Trivial: it mirrors_predictor's own logic (the single source of truth for "does this alg participate in the predictor system") and does not hard-codeImplicitEuleras the only predictor-carrying algorithm, so a future predictor-aware SDIRK method routed through the IE tableau would still honor an explicitTrivialrequest. On the current codebase the two conditions are behaviorally identical, since the onlypredictor-carrying algorithm reaching this branch isImplicitEuleritself.Why the out-of-place fix matters
The stage-2+ predictor ladder already computes the
MaxOrderguess functionally (a non-mutating Hermite power form). Both prior PRs' stage-1 branch instead reused the in-placecurrent_extrapolant!, writing intou. That is fine on the in-place path (whereuis a mutable cache array) but fails on the out-of-place path whenuis immutable (a scalar orSVector). Reproduced on this branch by temporarily restoring the in-place form:The default
ImplicitEulerpredictor isTrivial, so no existing test exercised theMaxOrderstage-1 seed — which is why neither prior PR caught this.Local verification (Julia 1.10.11)
Full
Pkg.test()for OrdinaryDiffEqSDIRK (non-QA groups) on Julia 1.10.11, exit 0 —Testing OrdinaryDiffEqSDIRK tests passed:Stage predictorsbreakdown: existingStage predictors102/102, newImplicitEuler first-stage predictor seed4/4 (Trivial/Linear call-trace, in-place + out-of-place), newImplicitEuler MaxOrder stage-1 seed6/6 (scalar out-of-place + in-place),extrapolant deprecation3/3.MaxOrdercrash with the prior PRs' in-place form (MethodError: no method matching fill!(::Float64, ::Float64)) and confirmed this PR's non-mutating form resolves it.masterby construction: the bootstrap callsperform_step!(integrator, cache.eulercache, …)withalg = ABDF2, which has nopredictorfield, so!hasproperty(alg, :predictor)selects the same linear seed as before. (Confirmed the convergence group, which exercises the IE/ESDIRK path, still passes.)--checkpassed on all changed Julia files.