Skip to content
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

use isfresh like mechinisim for precs #547

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

oscardssmith
Copy link
Contributor

alternative to #535, fixes #527 for real this time. I don't love this answer, but I think it is the easiest way for now.

@j-fu
Copy link
Contributor

j-fu commented Oct 15, 2024

I think we could keep the reuse_cache keyword, which is the nicer API.
In common.jl L264 we could do

function SciMLBase.solve!(cache::LinearCache, args...; reuse_precs=cache.precsisfresh, kwargs...)
    cache.precsisfresh=reuse_precs
    solve!(cache, cache.alg, args...; kwargs...)
end

@j-fu
Copy link
Contributor

j-fu commented Oct 16, 2024

Or maybe this could go into reinit! ?

function SciMLBase.reinit!(cache::LinearCache;
                           A = nothing,
                           b = cache.b,
                           u = cache.u,
                           p = nothing,
                           reinit_cache = false,
                           reuse_precs = false)
    (; alg, cacheval, abstol, reltol, maxiters, verbose, assumptions, sensealg) = cache


    isfresh = isnothing(A)
    precsisfresh =  ( isfresh || isnothing(p) ) && !reuse_precs

Appears to me a bit more consistent, but not sure.

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.

reinit! calls precs three times
2 participants