-
-
Notifications
You must be signed in to change notification settings - Fork 77
Attempt the implementation of missing reinit! for dual cache #836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
test/forwarddiff_overloads.jl
Outdated
| reinit!(cache; A = sparse(A)) | ||
| overload_x_p = solve!(cache, UMFPACKFactorization()) | ||
| backslash_x_p = A \ b | ||
| @test ≈ (overload_x_p, backslash_x_p, rtol = 1e-9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there's an extra space here?
ext/LinearSolveForwardDiffExt.jl
Outdated
|
|
||
| isfresh = !isnothing(A) | ||
| precsisfresh = !reuse_precs && (isfresh || !isnothing(p)) | ||
| isfresh |= cache.isfresh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DualLinearCache doesn't have a field isfresh. Should this be cache.linear_cache.isfresh ?
|
I forgot that I have to hit submit review for my comments to show up... |
This adds the missing reinit! method for the DualLinearCache type, which is needed when using ForwardDiff with LinearSolve and wanting to update the cache values without creating a new cache. The implementation directly mutates the cache fields (following the same pattern as the regular LinearCache reinit! method) rather than using the setX! helper functions. Closes SciML#836 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
This is an attempt to implement the missing reinit! metod for the dual cache.
I am however unsure if this is correct, at least the test works.