@@ -198,26 +198,36 @@ function SciMLBase.reinit!(cache::LinearCache;
198
198
A = nothing ,
199
199
b = cache. b,
200
200
u = cache. u,
201
- p = nothing ,)
201
+ p = nothing ,
202
+ reinit_cache = false ,)
202
203
(; alg, cacheval, isfresh, abstol, reltol, maxiters, verbose, assumptions, sensealg) = cache
203
204
204
205
precs = hasproperty (alg, :precs ) ? alg. precs : DEFAULT_PRECS
205
206
Pl, Pr = if isnothing (A) || isnothing (p)
206
- (cache. Pl, cache. Pr)
207
- else
208
207
if isnothing (A)
209
208
A = cache. A
210
209
end
211
210
if isnothing (p)
212
211
p = cache. p
213
212
end
214
213
precs (A, p)
214
+ else
215
+ (cache. Pl, cache. Pr)
215
216
end
216
217
217
- return LinearCache{typeof (A), typeof (b), typeof (u), typeof (p), typeof (alg), typeof (cacheval),
218
- typeof (Pl), typeof (Pr), typeof (reltol), typeof (assumptions. issq),
219
- typeof (sensealg)}(A, b, u, p, alg, cacheval, isfresh, Pl, Pr, abstol, reltol,
220
- maxiters, verbose, assumptions, sensealg)
218
+ if reinit_cache
219
+ return LinearCache{typeof (A), typeof (b), typeof (u), typeof (p), typeof (alg), typeof (cacheval),
220
+ typeof (Pl), typeof (Pr), typeof (reltol), typeof (assumptions. issq),
221
+ typeof (sensealg)}(A, b, u, p, alg, cacheval, isfresh, Pl, Pr, abstol, reltol,
222
+ maxiters, verbose, assumptions, sensealg)
223
+ else
224
+ cache. A = A
225
+ cache. b = b
226
+ cache. u = u
227
+ cache. p = p
228
+ cache. Pl = Pl
229
+ cache. Pr = Pr
230
+ end
221
231
end
222
232
223
233
function SciMLBase. solve (prob:: LinearProblem , args... ; kwargs... )
0 commit comments