Repository navigation
Fix construct_extension_jac for scalar and non-vector u0 - #1352
Merged
ChrisRackauckas merged 5 commits intoOct 3, 2026
Merged
ChrisRackauckas merged 5 commits into
ChrisRackauckas merged 5 commits into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/NonlinearSolve.jl/jobs/1215-cursor/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/NonlinearSolve.jl/jobs/1215-cursor/log.txt on amdci2.julia.csail.mit.edu
Reshape/unbox the caller’s state into prob.u0’s native shape instead of substituting the stored guess, and reuse the supplied residual when its shape is known. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/NonlinearSolve.jl/jobs/1215-cursor/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/NonlinearSolve.jl/jobs/1215-cursor/log.txt on amdci2.julia.csail.mit.edu
Equal-length residuals must not be reshaped to size(prob.u0); that broke matrix-state / vector-residual IIP problems under CMINPACK and NLsolveJL. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/NonlinearSolve.jl/jobs/1215-cursor/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas
marked this pull request as ready for review
October 3, 2026 05:32
This was referenced Oct 13, 2026
ChrisRackauckas
referenced
this pull request
Oct 13, 2026
Agent-Harness: Devin CLI 3000.11.3 Agent-Model: Fusion (Claude Opus 5.5 Medium + SWE-2 Medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/flash-hour.json Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
construct_extension_jacbuilt the Jacobian cache against the flattened wrapperu0, so scalar states were unwrapped intoDI.jacobianand matrix states were differentiated against a shapedp. This PR evaluates the Jacobian at the suppliedu0after restoringprob.u0's native shape, and recovers residual shape independently viaresid_prototype(never by equal length alone). Round-1/2 review findings (ignored suppliedu0; residual reshaped to state shape) are fixed. Regression tests cover scalar/matrix/vector, supplied-state ≠prob.u0, matrix-state/vector-residualresid_prototype, plus CMINPACK / NLsolveJL with explicit ADTypes backends.Fixes #1215
Fail-before / pass-after
Original shape bug (scalar / 2×2): unit tests error without the native-shape adaptation.
Round-1: supplied
u0=[3,4]withprob.u0=[1,2]must yielddiag(6,8)forinitial_jacobian.Round-2: matrix state +
resid_prototype=zeros(4)failed withDimensionMismatch(residual buffer wrongly made a matrix). After the fix:NonlinearSolveBase Core after round-2 fix: passed (extension_jac 10/10).
Commands run
Not verified
GROUP=Wrappersafter the round-2 follow-up (targeted shapes file + Core only).Risk assessment
construct_extension_jaconly.Please ignore this draft until reviewed by @ChrisRackauckas.
Harness: Cursor Agent CLI 2026.10.01-14929f9; model: auto; transcript: /home/crackauc/sandbox/goals/issue-backlog/ibd/NonlinearSolve.jl/jobs/1215-cursor/log.txt on amdci2.julia.csail.mit.edu