Update for SciMLBase v3 compatibility - #472
Merged
ChrisRackauckas merged 2 commits intoApr 23, 2026
Merged
Conversation
In SciMLBase v3 / RecursiveArrayTools v4, `AbstractVectorOfArray`
(and thus `ODESolution` and `VectorOfArray`) now subtypes `AbstractArray`
with column-major linear-indexing semantics. That changes:
- `sol[i]` : was `sol.u[i]` (timestep), now the i-th scalar element.
- `length(sol)` : was timestep count, now `prod(size(sol))`.
- `first`/`last` : was first/last timestep, now first/last scalar.
- `iterate`/`map` : was over timesteps, now over scalars.
Source/test changes in this patch:
- Ensemble tests (MIRK, FIRK nested & expanded): switch `prob_func`
from the v2 `(prob, i, repeat)` signature to the v3 `(prob, ctx)`
signature.
- `test/misc/default_solvers.jl`: user BC now indexes `sol.u[1]` /
`sol.u[end]` instead of `sol[1]` / `sol[end]`.
- `BoundaryValueDiffEqMIRK/src/adaptivity.jl` `halve_sol`: use
`sol.u` / `new_sol.u` for all timestep-indexed read/write.
- `BoundaryValueDiffEqCore/src/utils.jl`:
- `length(sol[1])` → `length(sol.u[1])` in second-order BC eval.
- `__restructure_sol(::AbstractVectorOfArray, ...)` iterates
`sol.u` for `first` and `map`.
- `__initial_guess_length(::VectorOfArray)` uses `length(u₀.u)`.
- `BoundaryValueDiffEqCore/src/solution_utils.jl`: add an `Integer`
`getindex` overload on `EvalSol` so `sol[i]` still returns the
i-th timestep (mirrors the v2 `VectorOfArray` indexing semantics
that the rest of the package assumes).
- `BoundaryValueDiffEqMIRK/src/mirk.jl` and
`BoundaryValueDiffEqFIRK/src/firk.jl`:
- Parameter-tuning paths: use `cache.y₀.u[1]` instead of
`first(cache.y₀)`, and `foreach(..., cache.y₀.u)` instead of
`map(..., cache.y₀)`.
- Solution construction loop iterates `cache.y₀.u`.
- `BoundaryValueDiffEqFIRK/src/{interpolation,adaptivity}.jl`:
`length(cache.y₀)` → `length(cache.y₀.u)` for timestep counts.
`Project.toml` compat for `SciMLBase` widened to `"2.152.1, 3"` in the
top-level package and in every lib (Core, MIRK, MIRKN, FIRK, Shooting,
Ascher).
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Let EvalSol follow the same linear-indexing semantics as v3 AbstractVectorOfArray by delegating `sol[i]` through to `VectorOfArray`. The only internal caller that relied on `sol[1]` returning a timestep was `length(sol[1])` in `BoundaryValueDiffEqCore/src/utils.jl`, which is already rewritten to `length(sol.u[1])`. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Contributor
Benchmark ResultsClick to check benchmark results
|
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
Supersedes #466 — replaces the pure compat bump with the source and test changes needed for SciMLBase v3 / RecursiveArrayTools v4, where
AbstractVectorOfArray(and thusODESolution/VectorOfArray) now subtypesAbstractArraywith column-major linear-indexing semantics.v3 breaking changes this addresses
sol[i](timestep)length(sol)(timesteps)prod(size(sol))first(sol)/last(sol)iterate(sol)/map(f, sol)prob_func(prob, i, repeat)prob_func(prob, ctx)Changes
Tests
lib/BoundaryValueDiffEqMIRK/test/ensemble_tests.jl,lib/BoundaryValueDiffEqFIRK/test/{nested,expanded}/ensemble_tests.jl: switchprob_functo the v3(prob, ctx)signature.test/misc/default_solvers.jl: user BC usessol.u[1][1]/sol.u[end][1].Source
lib/BoundaryValueDiffEqMIRK/src/adaptivity.jlhalve_sol: usesol.u/new_sol.ufor timestep-indexed read/write andlength(sol.u)for the timestep count.lib/BoundaryValueDiffEqCore/src/utils.jl:length(sol[1])→length(sol.u[1])in the second-order BC eval.__restructure_sol(::AbstractVectorOfArray, ...)iteratessol.uforfirstandmap.__initial_guess_length(::VectorOfArray)useslength(u₀.u).lib/BoundaryValueDiffEqCore/src/solution_utils.jl: added anIntegergetindexoverload onEvalSolso thatsol[i]still returns the i-th timestep, mirroring the v2VectorOfArrayindexing semantics that the rest of the package depends on.lib/BoundaryValueDiffEqMIRK/src/mirk.jlandlib/BoundaryValueDiffEqFIRK/src/firk.jl: parameter-tuning paths usecache.y₀.u[1]instead offirst(cache.y₀), andforeach(..., cache.y₀.u)instead ofmap(..., cache.y₀). Solution construction loops iteratecache.y₀.u.lib/BoundaryValueDiffEqFIRK/src/{interpolation,adaptivity}.jl:length(cache.y₀)→length(cache.y₀.u)for timestep counts.Compat
SciMLBase widened to
"2.152.1, 3"in the top-level package and in every lib (Core, MIRK, MIRKN, FIRK, Shooting, Ascher).Notes
I haven't been able to run the test suite against SciMLBase v3 locally before opening — this is a best-effort sweep targeted at the documented breaking patterns. CI is the source of truth. If additional locations surface, they follow the same
.upattern.Test plan
prob_func(prob, ctx)signature.test/misc/default_solvers.jlpasses with the updated BC.Co-Authored-By: Chris Rackauckas accounts@chrisrackauckas.com
🤖 Generated with Claude Code