Skip to content

Shape default initialization guesses for array derivatives - #5132

Closed
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/array-derivative-initialization-guesses
Closed

ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/array-derivative-initialization-guesses

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #5093.

Default guesses for array derivatives now have the derivative's shape. Previously the initialization system stored a scalar false for a whole-array dummy derivative, and reading its elements raised MethodError: no method matching vec(::Bool). The change preserves scalar defaults and explicit user guesses.

The regression constructs vector and matrix array-equation DAEs with initialization enabled and checks the initial states, derivatives, and residuals.

Regression evidence

Unfixed source:

MethodError: no method matching vec(::Bool)
Test Summary:                           | Error  Total   Time
Array derivative initialization guesses |     2      2  10.3s

Fixed source, same test:

Test Summary:                           | Pass  Total   Time
Array derivative initialization guesses |    6      6  15.6s

Validation

Focused regression command (run before and after the source change):

TMPDIR="$PWD/tmp" /home/crackauc/.juliaup/bin/julia +1.12 --project=ModelingToolkit.jl/lib/ModelingToolkitBase ModelingToolkit.jl/lib/ModelingToolkitBase/test/array_initialization.jl

Full Initialization group on rebased commit 832bcc22353a2fb553699db71248e0f59f72c9d4, based on upstream master 21814d32c28572b27a77284f318d251a41c5a4c8:

TMPDIR="$PWD/tmp" JULIA_PKG_PRECOMPILE_AUTO=0 GROUP=Initialization /home/crackauc/.juliaup/bin/julia +1.12 --project=ModelingToolkit.jl/lib/ModelingToolkitBase -e 'using Pkg; Pkg.test()'
Array derivative initialization |    6      6  3m57.1s
Guess Propagation |   11     11  5m38.0s
InitializationSystem Test |  731      12    743  22m09.8s
Initial Values Test |   65     65  4m32.4s
Testing ModelingToolkitBase tests passed

813 passes and 12 pre-existing broken tests; no test was skipped or changed to broken by this PR.

On rebased commit 832bcc22353a2fb553699db71248e0f59f72c9d4, GROUP=QA /home/crackauc/.juliaup/bin/julia +1.12 --project=ModelingToolkit.jl/lib/ModelingToolkitBase -e 'using Pkg; Pkg.test()' did not pass:

Test Summary: | Pass  Total     Time
JET Tests     |   54     54  3m37.8s
Test Summary:                                  | Pass  Fail  Total      Time
Aqua Tests                                     |   20     1     21  24m51.3s

The failed Aqua check is package-level JET analysis with 234 reports about generated Moshi variables. The existing standalone reproducer has four reports before Roger-luo/Moshi.jl#93 and zero with that patch. A controlled clean-master comparison analyzed the same 5,274 definitions with zero cached results: released Moshi produced 234 reports and failed (22m50.7s); the patch produced zero reports and passed (4m54.5s). This PR does not suppress reports or modify QA dependencies.

Runic 1.10.0, typos over the diff, and git diff --check passed. Before rebasing, the direct regression was also rerun with --compiled-modules=existing: 6/6 passed (1m46.9s).

The observed QA failure is tracked separately at #5063. Do not present it as passing. No docs or public API changes are included in this fix. GPU and Julia prerelease jobs have not been run locally.

CI failures at 10beae0

Refreshed CI at 832bcc2

Please ignore this draft until reviewed by @ChrisRackauckas.

🤖 Generated with Codex CLI 0.154.0 (model: gpt-6-astra; local session ID: 01a099aa-308a-7fd3-91bd-9fb2dc357b91).

Fixes SciML#5093

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local session ID 01a099aa-308a-7fd3-91bd-9fb2dc357b91
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.

DAEProblem from a system with array-form differential equations fails with MethodError: no method matching vec(::Bool)

2 participants