Repository navigation
Fix CheckInit for immutable out-of-place mass-matrix residuals - #1629
Merged
ChrisRackauckas merged 3 commits intoOct 3, 2026
Merged
ChrisRackauckas merged 3 commits into
ChrisRackauckas merged 3 commits into
Conversation
In-place broadcast assignment into the residual fails for SVector and other immutable arrays returned by out-of-place mass-matrix RHS evaluation. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.28-64d2043 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/SciMLBase.jl/jobs/1610-cursor/log.txt on amdci2.julia.csail.mit.edu
Covers consistent SVector u0 through get_initial_values and Rodas5P solve. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.28-64d2043 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/SciMLBase.jl/jobs/1610-cursor/log.txt on amdci2.julia.csail.mit.edu
StaticArraysCore alone lacks the convenience SVector constructors the test needs; declare StaticArrays in the downstream test project. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.28-64d2043 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/SciMLBase.jl/jobs/1610-cursor/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas
marked this pull request as ready for review
October 3, 2026 05:32
ChrisRackauckas
referenced
this pull request
Oct 13, 2026
* Add a specialization marker to `OptimizationFunction`
`OptimizationFunction` had no specialization marker: its second type parameter is
the AD type, and `specialization(::OptimizationFunction)` returned that instead of
an `AbstractSpecialization`. The marker is now stored as the last type parameter,
after the field types, so code that spells out the existing parameters keeps
working. It defaults to `FullSpecialize`, so existing functions are unchanged.
`OptimizationFunction{iip, specialize}(f, adtype; kwargs...)` selects it, and
`specialization` returns it. `remake`, `ConstructionBase.setproperties` (and with
it `@set`) and `OptimizationProblem` keep it. The spelling that passes the AD
type as the second type parameter (`OptimizationFunction{iip, AD}(f; adtype)`)
still builds a `FullSpecialize` function.
What `AutoSpecialize` and `AutoDespecialize` do is up to the solver packages,
as for the other SciML functions.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Convert parameter objects to `DespecializedParameters`
Storage typed for despecialized parameters could not be assigned a new parameter
object. For example, an optimization cache built from an `AutoDespecialize`
problem stores `p` as a `DespecializedParameters`, and `reinit!(cache; p = new_p)`
threw `Cannot convert an object of type ... to an object of type
SciMLBase.DespecializedParameters`. `convert` now wraps the object, and returns an
already wrapped one unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Bump version to 3.58.0
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <[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.
Please ignore until reviewed by @ChrisRackauckas.
Summary
CheckInitmasked algebraic residuals with in-place broadcast (tmp .= ...), which throwssetindex!on immutable out-of-place RHS outputs such asSVector. Rebind withtmp = ArrayInterface.restructure(...)instead;tmpis only consumed by the residual norm check below, so this is safe for mutable arrays too. Adds a downstream regression covering consistentSVectormass-matrix ODEs viaget_initial_valuesandRodas5P.Fail-before / pass-after
Scratch env: path-dev SciMLBase + OrdinaryDiffEqRosenbrock + StaticArrays, private compile depot,
JULIA_NUM_THREADS=1.1. Issue MWE (
solve(prob, Rodas5P()))Fail-before (master
tmp .=atinitialization.jl:264, exit 1):Pass-after (rebinding fix, exit 0):
2. Committed regression testset (extracted from
test/downstream/initialization.jl)Fail-before (src reverted to
tmp .=, exit 1):Pass-after (fix restored, exit 0):
Also ran Runic
--checkandtyposon touched files (both clean).Not verified
test/downstream/initialization.jl(ModelingToolkit/Sundials-heavy); only the new SVector testset was extracted and run.GROUP=Downstreamsuite.Reviewer pushback
ArrayInterface.ismutable(tmp)instead of always rebinding?Fixes #1610
Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
CheckInitresidual masking for mass-matrixAbstractDEProblems only; rebinding preserves values for mutable and immutable residualsRodas5P; Runic/typos cleantmponly feeds the CheckInit norm check, so rebinding loses no aliasing;tmpstays concretely typed (SVector{2,Float64}/Vector{Float64}incode_typed); fulltest/downstream/initialization.jlpasses on this branch, and with master'stmp .=line only the new SVector testset errors; inconsistent u0 still raisesCheckInitFailureError.SCCNonlinearProblem has no field u0) is shared with other open PRs and not caused by this change.Harness: Cursor Agent CLI 2026.09.28-64d2043; model: auto; transcript: /home/crackauc/sandbox/goals/issue-backlog/ibd/SciMLBase.jl/jobs/1610-cursor/log.txt on amdci2.julia.csail.mit.edu