|
50 | 50 |
|
51 | 51 | InvComposePreconditioner(inner, outer) = InvComposePreconditioner(ComposePreconditioner(inner, outer))
|
52 | 52 |
|
53 |
| -Base.eltype(A::InvComposePreconditioner) = Float64 #eltype(A.inner) |
54 |
| -#Base.adjoint(A::InvComposePreconditioner) = ComposePreconditioner(A.outer', A.inner') |
55 |
| -Base.inv(A::InvComposePreconditioner) = ComposePreconditioner(A.P) |
| 53 | +Base.eltype(A::InvComposePreconditioner) = Base.eltype(A.P) |
| 54 | +Base.adjoint(A::InvComposePreconditioner) = InvComposePreconditioner(A.P') |
| 55 | +Base.inv(A::InvComposePreconditioner) = deepcopy(A.P) |
56 | 56 |
|
57 | 57 | function LinearAlgebra.mul!(y, A::InvComposePreconditioner, x)
|
58 | 58 | @unpack P = A
|
|
61 | 61 |
|
62 | 62 | function LinearAlgebra.mul!(C, A::InvComposePreconditioner, B, α, β)
|
63 | 63 | @unpack P = A
|
| 64 | + tmp = copy(B) |
| 65 | + ldiv!(tmp, P, B) |
| 66 | + mul!(C, I, tmp, α, β) |
64 | 67 | end
|
65 | 68 |
|
66 | 69 | function LinearAlgebra.ldiv!(A::InvComposePreconditioner, x)
|
67 | 70 | @unpack P = A
|
| 71 | + y = copy(x) |
| 72 | + mul!(x, P, y) |
68 | 73 | end
|
69 | 74 |
|
70 | 75 | function LinearAlgebra.ldiv!(y, A::InvComposePreconditioner, x)
|
@@ -175,15 +180,8 @@ function SciMLBase.solve(cache::LinearCache, alg::KrylovJL; kwargs...)
|
175 | 180 | cache = set_cacheval(cache, solver)
|
176 | 181 | end
|
177 | 182 |
|
178 |
| - M = alg.Pl |
179 |
| - N = alg.Pr |
180 |
| - |
181 |
| - """ |
182 |
| - TODO - pass in inv(Pl), inv(Pr) to Krylov.jl |
183 |
| - """ |
184 |
| - |
185 |
| -# M = InvComposePreconditioner(alg.Pl, cache.Pl) # left precond |
186 |
| -# N = InvComposePreconditioner(alg.Pr, cache.Pr) # right |
| 183 | + M = InvComposePreconditioner(alg.Pl, cache.Pl) # left precond |
| 184 | + N = InvComposePreconditioner(alg.Pr, cache.Pr) # right |
187 | 185 |
|
188 | 186 | atol = cache.abstol
|
189 | 187 | rtol = cache.reltol
|
|
0 commit comments