Repository navigation
TrustRegionRobust: conditioning-preserving sparse subproblem solves - #1305
Merged
ChrisRackauckas merged 1 commit intoSep 22, 2026
Merged
Conversation
5 of 6 tasks
ChrisRackauckas-Claude
force-pushed
the
tr-robust-sparse
branch
3 times, most recently
from
September 18, 2026 01:59
44d635c to
03e3857
Compare
`TrustRegionRobust()` wraps `TrustRegion` with a `MoreTrustRegionDescent` whose `linsolve` is the new `RobustTrustRegionLinsolve` sentinel, resolved at `init` once the Jacobian is materialized: - Sparse-structured Jacobians solve the rectangular augmented system `[J; √λD] p = [-fu; 0]` via `LinearSolve.SparseColumnPivotedQRFactorization` — a pure-Julia, MIT-licensed, rank-revealing column-pivoted sparse QR. The sparsity pattern is λ-independent (λ only rescales values in the D-block rows), so the symbolic analysis is reused across damping trials. No `JᵀJ` is formed, so the κ² conditioning loss of the normal-equations route never applies; rank-deficient Jacobians are handled natively by the pivoting. - Dense Jacobians keep the MINPACK `lmpar`/`qrsolv` path (one pivoted QR per Jacobian, Givens updates per λ) — already conditioning-preserving. - Matrix-free Jacobians keep the augmented Krylov operator path. The sentinel forces `needs_concrete_A` so a sparse `jac_prototype` materializes, and `needs_square_A = false` so the rectangular augmented system is built. Non-square `linsolve` on a genuinely matrix-free problem errors through the usual path, as before. Trade-off vs the normal-form route (SciML#1299): each λ trial is a sparse QR refactorization of the (m+n)×n system instead of a sparse Cholesky of the n×n normal equations — measured ~9 factorizations/step vs ~1 on the sparse chained-Rosenbrock fixture — so this is the conditioning-robust option, not the fast default. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.10.21 Agent-Model: SWE-2 Max Agent-Session: /home/crackauc/.local/share/devin/cli/summaries/history_7b3b1ba7a18f464e.md (local transcript)
ChrisRackauckas-Claude
force-pushed
the
tr-robust-sparse
branch
from
September 19, 2026 23:12
03e3857 to
3b52d8c
Compare
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 23, 2026
Ships scaling = :auto for MoreTrustRegionDescent (#1300) and the new TrustRegionRobust kappa-preserving sparse subproblem solves (#1305). Minor because both add API that NonlinearSolveFirstOrder 2.10.0 consumes. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Agent-Harness: Claude Code 2.1.273 Agent-Model: claude-opus-5[1m] Agent-Session: 6a01e420-3436-4518-83cc-6cd853283cfb (local transcript; this harness publishes no conversation URL)
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 23, 2026
Ships scaling = :auto for MoreTrustRegionDescent (#1300) and the new TrustRegionRobust kappa-preserving sparse subproblem solves (#1305). Minor because both add API that NonlinearSolveFirstOrder 2.10.0 consumes. Agent-Harness: Claude Code 2.1.273 Agent-Model: claude-opus-5[1m] Agent-Session: 6a01e420-3436-4518-83cc-6cd853283cfb (local transcript; this harness publishes no conversation URL) Co-authored-by: Claude <[email protected]>
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 23, 2026
…Base floor to 2.54 FirstOrder references TrustRegionRobust, which #1305 added to NonlinearSolveBase 2.54.0 and which appears 0 times in the registered 2.53.0. The floor was 2.52. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Agent-Harness: Claude Code 2.1.273 Agent-Model: claude-opus-5[1m] Agent-Session: 6a01e420-3436-4518-83cc-6cd853283cfb (local transcript; this harness publishes no conversation URL)
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 23, 2026
…Base floor to 2.54 (#1313) FirstOrder references TrustRegionRobust, which #1305 added to NonlinearSolveBase 2.54.0 and which appears 0 times in the registered 2.53.0. The floor was 2.52. Agent-Harness: Claude Code 2.1.273 Agent-Model: claude-opus-5[1m] Agent-Session: 6a01e420-3436-4518-83cc-6cd853283cfb (local transcript; this harness publishes no conversation URL) Co-authored-by: Claude <[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.
Summary
TrustRegionRobust()is a discoverable wrapper aroundTrustRegionthat selects the conditioning-preserving formulation of the Moré subproblem for each Jacobian kind, via a newRobustTrustRegionLinsolvesentinel resolved atinit:LinearSolve.SparseColumnPivotedQRFactorizationon the rectangular augmented system[J; √λD] p = [-fu; 0]— a pure-Julia, MIT-licensed, rank-revealing column-pivoted sparse QR (SparseColumnPivotedQR.jl, already a hard dependency of LinearSolve). NoJᵀJis formed, so the κ² conditioning loss of the normal equations never applies, and rank-deficient Jacobians are handled natively by the pivoting.lmpar/qrsolvpath (one pivoted QR per Jacobian, then per-λ Givens updates) — already conditioning-preserving.This is the numerically-robust counterpart to #1299: that PR routes sparse Jacobians to the
n×nnormal-form path (fast — 102→6 sparse factorizations measured) but formsJᵀJ, squaring the condition number. This PR exposes the κ-preserving formulation as an explicit opt-in for Jacobians ill-conditioned enough thatJᵀJloses digits.The sentinel requests a concrete Jacobian (
needs_concrete_A) sojac_prototypestructure can be inspected, and a non-square system (needs_square_A = false) so the augmented path is taken. The solver itself is resolved lazily throughNonlinearSolveBaseLinearSolveExt(ext._robust_sparse_qr()), soLinearSolvestays a weak dependency of NonlinearSolveBase and a missing extension only errors when a sparse Jacobian actually needs it.The augmented sparsity pattern is λ-independent (λ rescales only the D-block values), so
SparseColumnPivotedQRFactorization's symbolic analysis is reused across damping trials via the existinglincache/update_A!machinery.Trade-offs (measured, sparse chained-Rosenbrock fixture)
Each λ trial refactorizes the
(m+n)×naugmented system rather than then×nnormal equations — hence opt-in rather than default. The step-count difference is worth a follow-up look: the rectangular path keeps hitting the trust-region boundary where the normal-form path finds interior GN steps, which may be a benign rank-revealing difference on the λ=0[J; 0]system.A further follow-up under investigation:
LHLFactorization.jl(already a LinearSolve dep) implements Wilkinson's Hessenberg reduction for shift families(σI + τJ)x = b—(BᵀB + λI)withB = JD⁻¹is exactly such a family, so one O(n³) reduction could serve all λ trials at O(n²) each, without squaring κ and without per-λ sparse refactorization.Test plan
TrustRegionRobusttestset: sparse J →normal_form === Val{false},augmented isa SparseMatrixCSC,JᵀJ === nothing, converges; dense J →lmparpath retained (augmented === nothing); invalidsubproblemoverrides throwArgumentErrorTrustRegionRobustis undefined on master (new API); testset passes 89/89 on this branchleast_squares_tests__item6.jlfile: 89/89 pass locally🤖 Generated with Devin (harness: Devin CLI 3000.10.21, model: SWE-2 Max)
Session: local transcript /home/crackauc/.local/share/devin/cli/summaries/history_7b3b1ba7a18f464e.md