Skip to content

Commit

Permalink
simplify __wrapprecs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
oscardssmith authored Sep 25, 2024
1 parent 153244f commit 0e8c353
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/internal/linear_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,9 @@ function __set_lincache_A(lincache, new_A)
end
end

@inline function __wrapprecs(_Pl, _Pr, weight)
Pl = _Pl !== nothing ?
ComposePreconditioner(InvPreconditioner(Diagonal(_vec(weight))), _Pl) :
InvPreconditioner(Diagonal(_vec(weight)))

Pr = _Pr !== nothing ? ComposePreconditioner(Diagonal(_vec(weight)), _Pr) :
Diagonal(_vec(weight))

function __wrapprecs(_Pl, _Pr, weight)
Pl = _Pl !== nothing ?= _Pl : IdentityOperator(length(weight))
Pr = _Pr !== nothing ? _Pr : IdentityOperator(length(weight))
return Pl, Pr
end

Expand Down

0 comments on commit 0e8c353

Please sign in to comment.