Skip to content

Commit 8be49ff

Browse files
Oscar Smithavik-pal
authored andcommitted
simplify __wrapprecs
previously the preconditioner being set was a very complicated `IdentityOperator`. Using a regular `IdentityOperator` means that solvers that don't support one of the preconditioners won't throw warnings since they mostly know that `IdentityOperator`s aren't real.
1 parent 05aa3db commit 8be49ff

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/internal/linear_solve.jl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,9 @@ function __set_lincache_A(lincache, new_A)
242242
end
243243
end
244244

245-
@inline function __wrapprecs(_Pl, _Pr, weight)
246-
Pl = _Pl !== nothing ?
247-
ComposePreconditioner(InvPreconditioner(Diagonal(_vec(weight))), _Pl) :
248-
InvPreconditioner(Diagonal(_vec(weight)))
249-
250-
Pr = _Pr !== nothing ? ComposePreconditioner(Diagonal(_vec(weight)), _Pr) :
251-
Diagonal(_vec(weight))
252-
245+
function __wrapprecs(_Pl, _Pr, weight)
246+
Pl = _Pl !== nothing ?= _Pl : IdentityOperator(length(weight))
247+
Pr = _Pr !== nothing ? _Pr : IdentityOperator(length(weight))
253248
return Pl, Pr
254249
end
255250

0 commit comments

Comments
 (0)