From 536f8eca186e0328480555f26f5aad8f9ad900b3 Mon Sep 17 00:00:00 2001 From: Oscar Smith Date: Wed, 16 Oct 2024 13:18:37 -0400 Subject: [PATCH] allow `reinit! to bypass precisfresh` --- src/common.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common.jl b/src/common.jl index eb1adacd..379b54a2 100644 --- a/src/common.jl +++ b/src/common.jl @@ -217,12 +217,15 @@ function SciMLBase.reinit!(cache::LinearCache; b = cache.b, u = cache.u, p = nothing, - reinit_cache = false,) + reinit_cache = false, + reuse_precs = false) (; alg, cacheval, abstol, reltol, maxiters, verbose, assumptions, sensealg) = cache - isfresh = isnothing(A) - precsisfresh = isfresh || isnothing(p) + isfresh = !isnothing(A) + precsisfresh = reuse_precs || isfresh || !isnothing(p) + isfresh |= cache.isfresh + precsisfresh |= cache.precsisfresh A = isnothing(A) ? cache.A : A b = isnothing(b) ? cache.b : b