Skip to content

Handle operator-backed instability diagnostics - #4244

Closed
ChrisRackauckas-Claude wants to merge 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-matrixoperator-instability-logging
Closed

ChrisRackauckas-Claude wants to merge 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-matrixoperator-instability-logging

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

Ignore this PR until reviewed by @ChrisRackauckas.

What changed and why

This fixes two failures in the numerical-instability diagnostic for operator-backed Jacobians:

  • unwrap SciMLOperators.MatrixOperator before scanning its entries;
  • if zero(cache.J) produces an AbstractSciMLOperator sentinel such as NullOperator, retain the stored Jacobian instead of calling jacobian! on that sentinel.

These paths run while reporting an existing solver failure; the patch prevents the diagnostic itself from throwing a second exception. OrdinaryDiffEqCore is bumped to 4.15.1 and OrdinaryDiffEqDifferentiation to 3.9.1.

Failing before / passing after

The MatrixOperator scanner regression test fails without the first fix:

MatrixOperator numerical instability entries: Error During Test
MethodError: no method matching _find_large_jac_entries!(..., ::MatrixOperator{..., SparseMatrixCSC{...}, ...})
Test Summary:                                 | Error  Total
MatrixOperator numerical instability entries |     1      1

The same official test passes after the fix:

MatrixOperator numerical instability entries | 3 pass, 3 total
Sparse isdiag Performance                    | 10 pass, 10 total

The NullOperator regression begins exactly at 0ed2615. A standalone Rosenbrock23 + KLU + MatrixOperator reproducer behaves as follows:

parent 9d92d1c7220ab2fbb2a8f141a27ddd95db904789:
(retcode = ReturnCode.Unstable, njacs = 0, nw = 1)

introducing commit 0ed2615804a38c915846358d39987f689f2511e6:
MethodError: no method matching jacobian!(::NullOperator, ::SciMLBase.UJacobianWrapper, ...)

patched:
(retcode = ReturnCode.Unstable, njacs = 0, nw = 1)

The existing OrdinaryDiffEqNonlinearSolve/test/linear_solver_tests.jl is the exact regression detector and passes after the combined fix:

Hires MatrixOperator tests         | 36 pass, 36 total
Float32 MatrixOperator tests       | 36 pass, 36 total

Local verification

OrdinaryDiffEqCore GROUP=Core
  Developer Time Queue API 10/10; Developer Codegen API 2/2;
  Sparse isdiag 8/8; Algebraic Vars 22/22; interpolation 49/49;
  Testing OrdinaryDiffEqCore tests passed

OrdinaryDiffEqCore GROUP=QA
  JET 30 pass, 1 existing broken; Aqua 26 pass

OrdinaryDiffEqDifferentiation GROUP=Core
  includes DAE sparse 4/4, sparsity 9/9, ScalarOperator 9/9,
  stale-W 12/12, Krylov nf 21/21, tolerance 7/7;
  Testing OrdinaryDiffEqDifferentiation tests passed

OrdinaryDiffEqDifferentiation GROUP=QA
  JET 1/1; Aqua 19/19

Runic over every changed Julia file, typos over the diff, and git diff --check passed.

Not verified

GPU and version-matrix jobs were not run locally. No docs build was run because this changes no public API, docstring, or documentation.

Copy link
Copy Markdown
Member Author

CI triage: the format-check failure is clean-master Runic drift in exactly the three files covered by #4313 (integrator_utils.jl, nonfulldiagonal_sparse_tests.jl, and rosenbrock_tableaus.jl). This PR’s changed files passed local Runic, and its one-line diagnostic fix is not present in the formatter diff.

@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/fix-matrixoperator-instability-logging branch from a3f492f to 9b5cf69 Compare August 20, 2026 14:41

Copy link
Copy Markdown
Member Author

Rebased the unchanged diagnostic patch onto current master f854ccc2f6b5057ad768a84741b783c239993bbf after fetching and auditing the remote branch. The intervening commits change documentation and the already-merged DiffEqBase callback test, not these Core/Differentiation paths. Post-rebase Runic over all changed Julia files, typos over the full diff, and git diff --check pass. New head: 9b5cf699f6a583abc37f3349469fab720b1ec368.

@ChrisRackauckas

Copy link
Copy Markdown
Member

Closing as superseded: already on master or replaced by later work.


🤖 Posted by an AI agent — harness: Claude Code, model: claude-opus-5[1m]. Chris asked for these closures directly.

https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

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.

2 participants