Skip to content

Honor ImplicitEuler first-stage predictor (combines #3870 + #3873, fixes out-of-place MaxOrder) - #3879

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:combined-ie-predictor-fix
Jul 12, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:combined-ie-predictor-fix

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

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.

  • Honor Predictor.Trivial, Predictor.Linear, and Predictor.MaxOrder when seeding the implicit first stage of direct ImplicitEuler solves (regressed by Fix ABDF2 𝒪est regression on nlstep tests: linear-extrap initial guess for IE bootstrap #3694, which always used the linear dt * fsalfirst seed and ignored the public predictor).
  • Retain the linear bootstrap seed for BDF algorithms (e.g. ABDF2) that reuse the Implicit Euler tableau via cache.eulercache without carrying a predictor field — provably identical seed to the current master.
  • Fix an out-of-place crash that Honor ImplicitEuler first-stage predictor #3870 and Respect ImplicitEuler predictor in IE tableau bootstrap #3873 both introduced: their MaxOrder branch calls the in-place current_extrapolant!(u, …), which throws MethodError: no method matching fill!(::Float64, ::Float64) for scalar out-of-place problems (ImplicitEuler(predictor = Predictor.MaxOrder) on a scalar ODEProblem). This PR uses the non-mutating current_extrapolant on the out-of-place path.
  • Add regression coverage for all three predictors on both the in-place and out-of-place paths, including the previously-untested MaxOrder seed.
  • Bump OrdinaryDiffEqSDIRK to v2.8.1.

Relationship to #3870 and #3873

#3870 #3873 this PR
Version bump ✅ 2.8.1 ❌ ✅ 2.8.1
Linear-seed gating !hasproperty(alg, :predictor) !(alg isa ImplicitEuler) && Trivial !hasproperty(alg, :predictor)
_predictor comment refreshed ✅ ❌ ✅
Out-of-place MaxOrder ❌ crashes on scalars ❌ crashes on scalars ✅ fixed (non-mutating)
MaxOrder test coverage ❌ ❌ ✅

The !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-code ImplicitEuler as the only predictor-carrying algorithm, so a future predictor-aware SDIRK method routed through the IE tableau would still honor an explicit Trivial request. On the current codebase the two conditions are behaviorally identical, since the only predictor-carrying algorithm reaching this branch is ImplicitEuler itself.

Why the out-of-place fix matters

The stage-2+ predictor ladder already computes the MaxOrder guess functionally (a non-mutating Hermite power form). Both prior PRs' stage-1 branch instead reused the in-place current_extrapolant!, writing into u. That is fine on the in-place path (where u is a mutable cache array) but fails on the out-of-place path when u is immutable (a scalar or SVector). Reproduced on this branch by temporarily restoring the in-place form:

ERROR: MethodError: no method matching fill!(::Float64, ::Float64)

The default ImplicitEuler predictor is Trivial, so no existing test exercised the MaxOrder stage-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:

Tableau consistency |   57     57
Stage predictors    |  115    115      # +13 vs master: the new predictor-seed tests
Convergence         |  102  2 broken  104   # the 2 broken are pre-existing @test_broken
DAE tests           |    8      8
  • Stage predictors breakdown: existing Stage predictors 102/102, new ImplicitEuler first-stage predictor seed 4/4 (Trivial/Linear call-trace, in-place + out-of-place), new ImplicitEuler MaxOrder stage-1 seed 6/6 (scalar out-of-place + in-place), extrapolant deprecation 3/3.
  • Reproduced the out-of-place MaxOrder crash with the prior PRs' in-place form (MethodError: no method matching fill!(::Float64, ::Float64)) and confirmed this PR's non-mutating form resolves it.
  • ABDF2 bootstrap seed is unchanged from master by construction: the bootstrap calls perform_step!(integrator, cache.eulercache, …) with alg = ABDF2, which has no predictor field, so !hasproperty(alg, :predictor) selects the same linear seed as before. (Confirmed the convergence group, which exercises the IE/ESDIRK path, still passes.)
  • Runic v1.x --check passed on all changed Julia files.

…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]>
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review July 12, 2026 08:47
@ChrisRackauckas
ChrisRackauckas merged commit 6c3eac0 into SciML:master Jul 12, 2026
133 of 139 checks passed
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.

2 participants