6
6
P * x = x .* (1/P.s)
7
7
Pi * x = x .* (P.s)
8
8
9
- Right
9
+ RIGHT
10
10
P * x = x .* (P.s)
11
11
Pi * x = x .* (1/P.s)
12
12
"""
@@ -16,19 +16,15 @@ struct ScaleVector{T}
16
16
end
17
17
18
18
Base. eltype (A:: ScaleVector ) = eltype (A. s)
19
-
20
- # function Base.*(A::ScaleVector, x)
21
- # y = similar(x)
22
- # mul!(y, A, x)
23
- # end
19
+ Base. adjoint (A:: ScaleVector ) = copy (A)
20
+ Base. inv (A:: ScaleVector ) = ScaleVector (1 / A. s, A. isleft)
24
21
25
22
# y = A x
26
23
function LinearAlgebra. mul! (y, A:: ScaleVector , x)
27
24
A. s == one (eltype (A. s)) && return y = x
28
25
29
26
s = A. isleft ? 1 / A. s : A. s
30
27
mul! (y, s, x)
31
-
32
28
end
33
29
34
30
# A B α + C β
@@ -63,6 +59,8 @@ struct ComposePreconditioner{Ti,To}
63
59
end
64
60
65
61
Base. eltype (A:: ComposePreconditioner ) = Float64 # eltype(A.inner)
62
+ Base. adjoint (A:: ComposePreconditioner ) = ComposePreconditioner (A. outer' , A. inner' )
63
+ Base. inv (A:: ComposePreconditioner ) = ComposePreconditioner (inv (A. outer), inv (A. inner))
66
64
67
65
# y = A x
68
66
function LinearAlgebra. mul! (y, A:: ComposePreconditioner , x)
@@ -200,6 +198,10 @@ function SciMLBase.solve(cache::LinearCache, alg::KrylovJL; kwargs...)
200
198
M = alg. Pl
201
199
N = alg. Pr
202
200
201
+ """
202
+ TODO - pass in inv(Pl), inv(Pr) to Krylov.jl
203
+ """
204
+
203
205
# M = ComposePreconditioner(alg.Pl, cache.Pl) # left precond
204
206
# N = ComposePreconditioner(alg.Pr, cache.Pr) # right
205
207
0 commit comments