SII indexing for ComponentArray ODE solutions (sol[:x], sol(t; idxs=:x)) - #396
Merged
ChrisRackauckas merged 3 commits intoJul 24, 2026
Conversation
When an AbstractODEProblem has ComponentArray u0 and no symbolic sys is set on the ODEFunction, expose top-level component keys (and parameter keys when p is also a ComponentArray) through SII. This makes sol[:x], sol(t; idxs=:x), sol(t; idxs=[:x,:y]), and sol.ps[:a] work without a manual SymbolCache, matching the interface discussed on SciML/DifferentialEquations.jl#957. Existing getsyms plotting labels are unchanged. Explicit sys on the ODEFunction is still preferred when present. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
New #957 indexing tests `using SymbolicIndexingInterface`; it must be a direct Downstream dep (not only transitive via SciMLBase). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
ChrisRackauckas
marked this pull request as ready for review
July 24, 2026 06:17
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
Implements SymbolicIndexingInterface support for ODE problems whose state is a
ComponentArray, so named solution indexing works without a hand-builtSymbolCache.Fixes the ergonomics request in SciML/DifferentialEquations.jl#957 (and follows the design note there from @AayushSabharwal / @ChrisRackauckas: SII overloads rather than
getpropertyforwarding onDiffEqArray).Behavior
When
u0 isa ComponentArrayand theODEFunctionhas no symbolicsys:sol[:x],sol(t; idxs=:x),sol(t; idxs=[:x, :y])use top-level component keysp isa ComponentArray,sol.ps[:a]works the same wayu.b = (x,y)) remain indexable assol[:b](returns the sub-component)When
sysis already set on the function (MTK / manualSymbolCache), that system is left alone.Implementation
ext/ComponentArraysSciMLBaseExt.jlwith a smallComponentArrayIndexProviderandsymbolic_container(::AbstractODEProblem{<:ComponentArray})getsymsplotting labelsTests
sysNotes
This PR should be ignored until reviewed by @ChrisRackauckas.
Limitations / follow-ups
AbstractODEProblemfor now (SDE/DDE/etc. can reuse the same provider later)Symbol("b.x")are not registered as separate variables (top-level keys only)save_idxsComponentArray behavior (already worked for single labels)