Skip to content

Commit 665350c

Browse files
author
oscarddssmith
committed
fix setproperty, remove deprecation for now
1 parent 92a6bd3 commit 665350c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/common.jl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,18 @@ end
8585

8686
function Base.setproperty!(cache::LinearCache, name::Symbol, x)
8787
if name === :A
88+
if hasproperty(cache.alg, :precs)
89+
Pl, Pr = cache.alg.precs(A, cache.p)
90+
setfield!(cache, :Pl, Pl)
91+
setfield!(cache, :Pr, Pr)
92+
end
8893
setfield!(cache, :isfresh, true)
94+
elseif name === :p
95+
if hasproperty(cache.alg, :precs)
96+
Pl, Pr = cache.alg.precs(cache.A, p)
97+
setfield!(cache, :Pl, Pl)
98+
setfield!(cache, :Pr, Pr)
99+
end
89100
elseif name === :b
90101
# In case there is something that needs to be done when b is updated
91102
update_cacheval!(cache, :b, x)
@@ -174,12 +185,14 @@ function SciMLBase.init(prob::LinearProblem, alg::SciMLLinearSolveAlgorithm,
174185
if isnothing(Pl)
175186
Pl = _Pl
176187
else
177-
@warn "passing Preconditioners at `init`/`solve` time is deprecated. Instead add a `precs` function to your algorithm."
188+
# TODO: deprecate once all docs are updated to the new form
189+
#@warn "passing Preconditioners at `init`/`solve` time is deprecated. Instead add a `precs` function to your algorithm."
178190
end
179191
if isnothing(Pr)
180192
Pr = _Pr
181193
else
182-
@warn "passing Preconditioners at `init`/`solve` time is deprecated. Instead add a `precs` function to your algorithm."
194+
# TODO: deprecate once all docs are updated to the new form
195+
#@warn "passing Preconditioners at `init`/`solve` time is deprecated. Instead add a `precs` function to your algorithm."
183196
end
184197
cacheval = init_cacheval(alg, A, b, u0_, Pl, Pr, maxiters, abstol, reltol, verbose,
185198
assumptions)

0 commit comments

Comments
 (0)