@@ -8,9 +8,6 @@ struct InvDiagonalPreconditioner{D}
88end
99
1010Base. eltype (A:: Union{DiagonalPreconditioner,InvDiagonalPreconditioner} ) = eltype (A. diag)
11- Base. adjoint (A:: Union{DiagonalPreconditioner,InvDiagonalPreconditioner} ) = A
12- Base. inv (A:: DiagonalPreconditioner ) = InvDiagonalPreconditioner (A. diag)
13- Base. inv (A:: InvDiagonalPreconditioner ) = DiagonalPreconditioner (A. diag)
1411
1512function LinearAlgebra. ldiv! (A:: DiagonalPreconditioner , x)
1613 x .= x ./ A. diag
@@ -61,8 +58,6 @@ struct ComposePreconditioner{Ti,To}
6158end
6259
6360Base. eltype (A:: ComposePreconditioner ) = promote_type (eltype (A. inner), eltype (A. outer))
64- Base. adjoint (A:: ComposePreconditioner ) = ComposePreconditioner (A. outer' , A. inner' )
65- Base. inv (A:: ComposePreconditioner ) = InvComposePreconditioner (A)
6661
6762function LinearAlgebra. ldiv! (A:: ComposePreconditioner , x)
6863 @unpack inner, outer = A
@@ -78,20 +73,9 @@ function LinearAlgebra.ldiv!(y, A::ComposePreconditioner, x)
7873 ldiv! (outer, y)
7974end
8075
81- # This is just an implementation detail for Krylov.jl
82- # It wants to use mul! instead of ldiv! so we convert.
83-
84- struct InvComposePreconditioner{Tp <: ComposePreconditioner }
85- P:: Tp
76+ struct InvPreconditioner{T}
77+ P:: T
8678end
8779
88- InvComposePreconditioner (inner, outer) = InvComposePreconditioner (ComposePreconditioner (inner, outer))
89-
90- Base. eltype (A:: InvComposePreconditioner ) = Base. eltype (A. P)
91- Base. adjoint (A:: InvComposePreconditioner ) = InvComposePreconditioner (A. P' )
92- Base. inv (A:: InvComposePreconditioner ) = deepcopy (A. P)
93-
94- function LinearAlgebra. mul! (y, A:: InvComposePreconditioner , x)
95- @unpack P = A
96- ldiv! (y, P, x)
97- end
80+ Base. eltype (A:: InvPreconditioner ) = Base. eltype (A. P)
81+ LinearAlgebra. mul! (y, A:: InvPreconditioner , x) = ldiv! (y, A. P, x)
0 commit comments