Repository navigation
Rebuild the linear W on every gamma dt change - #4470
Closed
singhharsh1708 wants to merge 1 commit into
Closed
singhharsh1708 wants to merge 1 commit into
singhharsh1708 wants to merge 1 commit into
Conversation
Member
|
we also likely want to do this when using an iterative linear solver since in that case we aren't saving work by reusing |
Contributor
I am not sure about that. Building J/W and rebuilding preconditioners is not free either. |
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 12, 2026
* Rebuild the linear W on every gamma dt change * Say why the linear path ignores new_W_dt_cutoff The comment on the `islin` branch of `do_newJW` justified taking every γdt change with "there is nothing for `new_W_dt_cutoff` to amortize", which is backwards: the refactorization is exactly what that cutoff amortizes. The reason the cutoff is not worth taking here is that `defaultalg` answers `LHLFactorization` for this split `W`, and LHL absorbs a new γdt by re-shifting the Hessenberg form in O(n²) with the reduction untouched — cheap precisely because `J` never moves on a linear function. Verified at runtime that the default is LHL for this path, dense and sparse `J` alike: `_lhl_defaultable` is true and `DefaultLinearSolver.alg` is `LHLFactorization` for `ODEFunction(MatrixOperator(A))` at n = 800 sparse and n = 1000 dense. Also bumps OrdinaryDiffEqDifferentiation to 3.11.6: #4470 bumped to 3.11.5, which master has since released. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code 2.1.269 Agent-Model: claude-opus-5[1m] Agent-Session: https://claude.ai/code/session_01D1XiWgJ1PJFDLAWTM1583M Claude-Session: https://claude.ai/code/session_01D1XiWgJ1PJFDLAWTM1583M --------- Co-authored-by: singhharsh1708 <[email protected]> Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Member
Author
|
Merged as #4527. |
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.
new_W_dt_cutoffno longer applies to theislinearfunctionpath, soW = J - M/(γdt)is refactorized on every step whoseγdtdiffers, adaptive solves included; #4401 did this for fixed steps only.For a linear function
Jis constant, so a rebuild is a refactorization with no Jacobian evaluation, and keeping a staleWbuys nothing while costing Newton iterations.On the issue's 400-point heat equation with SDIRK2 at reltol 1e-8 the default cutoff took 4844 Newton iterations and 85.0 ms against 1030 and 38.2 ms with the cutoff off; at 1e-10 it is 26340 and 454.3 ms against 4680 and 173.8 ms. Dense random operators are faster too, by 23% at N=100, 11% at N=300, 5.5% at N=600 and 3.5% at N=900, and the end states agree to the last digit.
The new test in
stale_w_linear_operator_tests.jlsolves adaptively at cutoff 0.2 and 0 and compares the end state,nwandnnonliniter; on master those runs take 30 factorizations against 455.Closes #4370. The carried-over
ηthe issue also names is not what moves the answer on the adaptive path: forcing convergence withκ = 1e-4andmax_iter = 30leaves the error at 5.9e-9 against 6.1e-9.AI Disclosure: Claude assisted with this change.