NonlinearSolveAlg: extend W-reuse to WOperator with concrete underlying Jacobian#3753
Open
singhharsh1708 wants to merge 1 commit into
Open
NonlinearSolveAlg: extend W-reuse to WOperator with concrete underlying Jacobian#3753singhharsh1708 wants to merge 1 commit into
singhharsh1708 wants to merge 1 commit into
Conversation
…ng J Hand the WOperator's _concrete_form to NonlinearSolve as analytic jac (Closes SciML#3697 for the concrete-J case; matrix-free WOperators still fall back).
389657e to
a1568f2
Compare
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.
Closes #3697 for the common case.
Summary
`build_nlsolver` previously gated `use_w_reuse` on
```julia
W isa AbstractMatrix && !(W isa AbstractSciMLOperator)
```
which excluded `WOperator` entirely. But a `WOperator` built around a concrete Jacobian (the typical setup when the user picks an iterative linsolve such as `KrylovJL_GMRES` with `concrete_jac = true`) carries the materialized `M/γdt - J` in its `_concrete_form` field, and `_update_nlsolvealg_W!` already writes the refreshed W there via `jacobian2W!`. We can hand that buffer to NonlinearSolve as the analytic Jacobian unchanged.
Truly matrix-free `WOperator`s (where `W.J` is itself an `AbstractSciMLOperator`) still fall back to AD/FD on the inner Newton — handing those off as analytic Jacobians is a deeper change tracked separately.
Measured
Robertson, `linsolve = KrylovJL_GMRES(), concrete_jac = true`, `nlsolve = NonlinearSolveAlg(NewtonRaphson(autodiff = AutoFiniteDiff()))`:
Audit