Repository navigation
Fix bounded trust-region finite differences and matrix workspaces - #1272
Merged
ChrisRackauckas merged 2 commits intoSep 13, 2026
Conversation
Reuse the native bounded finite-difference stencils for concrete Jacobians and derivative products, including sparse prototypes and scalar caches. Preserve multidimensional state and residual shapes when multiplying Jacobian products into bounded trust-region workspaces. 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 transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Only construct additional bound vectors and product callbacks when the selected derivative path requires them. Preserve the original problem when no derivative callback needs wrapping. 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 transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
ChrisRackauckas-Claude
force-pushed
the
fix/bounded-trust-region-finite-difference
branch
from
September 13, 2026 11:45
99a5f0b to
9115eb4
Compare
This was referenced Sep 13, 2026
ChrisRackauckas
marked this pull request as ready for review
September 13, 2026 13:46
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.
BoundedTrustRegion(autodiff = AutoFiniteDiff())could evaluate the residual outside the box while constructing derivatives, and matrix-shaped states failed when flattened Jacobian products were written into matrix workspaces. Reuse the other native bounded methods' feasible finite-difference cache and operator products, and preserve scalar/static/matrix workspace shapes during those products. Both defects reproduce at the first BTR implementation, ab11738.The shared differentiation code moves from
native_bounded.jlintobounded_jacobian.jlso all five bounded methods share the same stencils. Sparse prototypes, analytic callbacks, matrix-free JVP/VJP paths, mixed derivative backends, fixed bounds, and parameter-changing cache reinitialization retain their existing machinery. No new public API or dependencies.Ignore until reviewed by @ChrisRackauckas.
Verification on Julia 1.13.0, one Julia thread:
git diff --check: clean.The full Core run covers 23f1b62; NativeBounds and QA were repeated after 9115eb4, the final guard that avoids unused finite-difference setup for analytic/AD paths. Core emits individual top-level summaries, so 8,739 is their sum. Literal final output:
Latest NativeBounds and QA output:
Full groups used the existing test harness:
Boundary reproducer, run on clean master and again with the fix:
Matrix-state reproducer, run at BTR introduction and again with the fix:
GPU and downstream groups were not run. No docstrings, documentation, or public API changed, so a docs build was not needed. Mixed scalar-state/array-residual combinations are a separate pre-existing generalized-solver limitation, documented with a verified explicit BoundedGaussNewton workaround at #1270.
🤖 Generated with Codex CLI 0.154.0 (model: gpt-6-astra; session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl).