Repository navigation
Use LinearSolve for ForwardDiff implicit sensitivities - #1055
Merged
ChrisRackauckas merged 1 commit intoJul 15, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]>
ChrisRackauckas
marked this pull request as ready for review
July 15, 2026 06:16
This was referenced Aug 30, 2026
ChrisRackauckas
added a commit
to SciML/BoundaryValueDiffEq.jl
that referenced
this pull request
Aug 31, 2026
The `LinearSolve = "4.2"` compat entry in the FIRK sublibrary Project.toml caps the test environment at LinearSolve 4.x. Since NonlinearSolveBase 2.36.0 requires LinearSolve 5, this holds the test environment at NonlinearSolveBase 2.35.0 -- the last release before SciML/NonlinearSolve.jl#1055 routed the ForwardDiff implicit-sensitivity solve through LinearSolve instead of a raw `Jᵤ \ Jₚ`. The nested FIRK underconstrained solves then throw `LinearAlgebra.SingularException` out of that backslash, which the LinearSolve default's LU-to-QR fallback handles. LinearSolve is an unused test dependency; the compat entry's only effect is on resolution. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code 2.1.251 Agent-Model: claude-opus-5[1m] Agent-Session: https://claude.ai/code/session_01GHa2ZK4kgnGknJBGoM2sV8 Claude-Session: https://claude.ai/code/session_01GHa2ZK4kgnGknJBGoM2sV8
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.
This PR should be ignored until reviewed by @ChrisRackauckas.
Summary
Fixes #1054 by routing the ForwardDiff implicit sensitivity solve through NonlinearSolveBase's
construct_linear_solverpath when LinearSolve is loaded, instead of using rawJᵤ \ Jₚ. This lets the AD-over-solve path use LinearSolve's singular-LU to pivoted-QR rescue for rank-deficient implicit systems.The scalar
Jᵤcase stays on Julia's native\path because LinearSolve's generic matrix-RHS setup does not handle scalarAwith matrixBhere.Tests
env JULIA_NUM_THREADS=1 JULIA_PKG_PRECOMPILE_AUTO=no JULIA_PKG_SERVER_REGISTRY_PREFERENCE=eager timeout 3600 julia +1 --startup-file=no --project=. -e 'using Test; include("test/Core/forward_ad_tests__item2.jl")'ForwardDiff.gradient(g, [4.0, 0.0]) = [0.25, 0.25]sol.retcode = SciMLBase.ReturnCode.Success,SciMLBase.successful_retcode(sol.retcode) = truetimeout 3600 julia +1 --startup-file=no --project=.runic_env -e 'using Runic; exit(Runic.main(["--check", "."]))'NONLINEARSOLVE_TEST_GROUP=Core Pkg.test()currently fails on cleanorigin/masterbefore reaching this ForwardDiff test file in23 Test Problems: Broyden; a separate investigation has been spawned per repo instructions.