Repository navigation
Serve Radau's complex stage pair from the split W - #4333
Merged
ChrisRackauckas merged 2 commits intoAug 25, 2026
Merged
ChrisRackauckas merged 2 commits into
ChrisRackauckas merged 2 commits into
Conversation
A FIRK step forms a real stage matrix and complex-conjugate pairs from one Jacobian -- 279 stage-matrix updates against 3 Jacobians on the Brusselator -- and previously discarded the split form, so LHLFactorization re-reduced from scratch per update and was refused outright. Both stages now stay split. The real stage keeps the WOperator build_J_W made; each complex pair becomes a WOperator whose gamma slot is complex while its Jacobian, the same object as the real stage's, stays real. Inside LinearSolve one real O(n^3) reduction per stage matrix then serves every dtgamma, with only the shift going complex. firk_new_J! marks every stage matrix stale when it rewrites J in place; without that the pair's cached reduction kept answering for the previous Jacobian (6 test failures, wrong trajectories). RadauIIA5 on the 128-unknown Brusselator at tol 1e-8, single-threaded BLAS, best of 5: LU 0.2308 s err=5.0e-08 LHL 0.0891 s err=1.4e-07 (2.6x) LHL r=0 0.0754 s err=1.4e-07 (3.1x) against 5.2x *slower* before, which is why the guard existed. Closes SciML#4281's headline; the remaining refinement there -- sharing literally one reduction across the real and complex caches instead of one per stage matrix -- saves only reductions that already amortize over ~90 shifts each. Co-Authored-By: Chris Rackauckas <[email protected]>
This was referenced Aug 21, 2026
ChrisRackauckas
marked this pull request as ready for review
August 22, 2026 21:42
Move the Radau factorization coverage out of the BDF test group and make the BDF test dependencies self-contained.
Member
|
Follow-up in bb955cd:
Local verification:
The BDF QA dependency-resolution blockers are fixed. That suite then reached its allocation checks locally and reported the existing 160-byte warmed FBDF and DFBDF allocations; those solver allocation checks are unrelated to this test-ownership change. |
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.
Note
Please ignore this PR until it has been reviewed by @ChrisRackauckas.
Closes the headline of #4281. Follows #4266, which was squash-merged from its reviewed tip before this commit was pushed to that branch — hence the separate PR.
What changed and why
A FIRK step forms a real stage matrix and complex-conjugate pairs from one Jacobian (279 stage-matrix updates against 3 Jacobians on the Brusselator), and previously discarded the split form, so
LHLFactorizationre-reduced from scratch per update — measured 5.2× slower than LU, which is why #4266 shipped anArgumentErrorguard. Both stages now stay split: the real stage keeps theWOperatorbuild_J_Wmade, and each complex pair becomes aWOperatorwhosegammaslot is complex while its Jacobian — the same object as the real stage's — stays real. Inside LinearSolve one real O(n³) reduction per stage matrix then serves everydtgamma, with only the shift going complex (ws.factors::Matrix{Float64},ws.σ::ComplexF64— asserted in the tests). Covers RadauIIA3 (complex-only), RadauIIA5, RadauIIA9, and AdaptiveRadau (vector of pairs).The correctness keystone is
firk_new_J!marking every stage matrix stale when it rewritesJin place; the guard and_firk_reject_reduction_reuseare removed.Benchmark (the #4281 measurement)
RadauIIA5, 128-unknown Brusselator, tol 1e-8, single-threaded BLAS, best of 5:
against 5.2× slower before. Caveat: the LHL run took
njacs=1vs LU's 3 (different Newton histories), so the timing is not perfectly controlled; the correctness tests exercisenjacs > 1explicitly.Failing-before / passing-after
Before this change the new tests cannot pass:
RadauIIA5(linsolve = LHLFactorization())throwsArgumentError(the #4266 guard) — the old@test_throwsasserting that is flipped by this PR into trajectory tests. The staleness marking is separately shown to be load-bearing, both ways:_mark_J_moved!(::AbstractVector) = nothing): 2 failures, exactly the AdaptiveRadau assertions.With the change,
lib/OrdinaryDiffEqBDF/test/lhl_factorization_tests.jlexit 0:including RadauIIA3/5/9/AdaptiveRadau trajectory ≈ LU at rtol 1e-6 on a stiff dense problem with
njacs > 1, and AdaptiveRadau structure assertions (every element of theW2vector is a split complex-γWOperatorover the sharedJ).lib/OrdinaryDiffEqFIRK/test/ode_firk_tests.jl(LU/Krylov/GaussLegendre/AdaptiveRadau paths, no LHL): exit 0, no failures. Runic and typos clean.Version
No bump: rides OrdinaryDiffEqFIRK 2.8.0, which #4266 bumped and which is not yet registered (registry has 2.7.0).
Not verified / out of scope
Jmoves; with ~90 shifts amortizing each, the residual saving is a small constant and needs a cross-cache interface. Stays on RadauIIA: reuse one Jacobian reduction across the real and complex stage matrices #4281.🤖 Generated with Claude Code
https://claude.ai/code/session_014CrTAi2YLkosEXXbudXyKf