11# # Krylov.jl
22
3- struct KrylovJL{F,Tl,Tr, I,A,K} <: AbstractKrylovSubspaceMethod
3+ struct KrylovJL{F,I,A,K} <: AbstractKrylovSubspaceMethod
44 KrylovAlg:: F
5- Pl:: Tl
6- Pr:: Tr
75 gmres_restart:: I
86 window:: I
97 args:: A
108 kwargs:: K
119end
1210
1311function KrylovJL (args... ; KrylovAlg = Krylov. gmres!,
14- Pl= nothing , Pr= nothing ,
1512 gmres_restart= 0 , window= 0 ,
1613 kwargs... )
1714
18- Pl = (Pl === nothing ) ? Identity () : Pl
19- Pr = (Pr === nothing ) ? Identity () : Pr
20-
21- return KrylovJL (KrylovAlg, Pl, Pr, gmres_restart, window,
15+ return KrylovJL (KrylovAlg, gmres_restart, window,
2216 args, kwargs)
2317end
2418
@@ -105,8 +99,8 @@ function SciMLBase.solve(cache::LinearCache, alg::KrylovJL; kwargs...)
10599 cache = set_cacheval (cache, solver)
106100 end
107101
108- M = get_preconditioner (alg . Pl, cache. Pl)
109- N = get_preconditioner (alg . Pr, cache. Pr)
102+ M = cache. Pl
103+ N = cache. Pr
110104
111105 M = (M === Identity ()) ? I : inv (M)
112106 N = (N === Identity ()) ? I : inv (N)
@@ -145,24 +139,18 @@ end
145139
146140# # IterativeSolvers.jl
147141
148- struct IterativeSolversJL{F,Tl,Tr, I,A,K} <: AbstractKrylovSubspaceMethod
142+ struct IterativeSolversJL{F,I,A,K} <: AbstractKrylovSubspaceMethod
149143 generate_iterator:: F
150- Pl:: Tl
151- Pr:: Tr
152144 gmres_restart:: I
153145 args:: A
154146 kwargs:: K
155147end
156148
157149function IterativeSolversJL (args... ;
158150 generate_iterator = IterativeSolvers. gmres_iterable!,
159- Pl= nothing , Pr= nothing ,
160151 gmres_restart= 0 , kwargs... )
161152
162- Pl = (Pl === nothing ) ? Identity () : Pl
163- Pr = (Pr === nothing ) ? Identity () : Pr
164-
165- return IterativeSolversJL (generate_iterator, Pl, Pr, gmres_restart,
153+ return IterativeSolversJL (generate_iterator, gmres_restart,
166154 args, kwargs)
167155end
168156
@@ -184,9 +172,6 @@ IterativeSolversJL_MINRES(args...;kwargs...) =
184172 kwargs... )
185173
186174function init_cacheval (alg:: IterativeSolversJL , A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
187- Pl = get_preconditioner (alg. Pl, Pl)
188- Pr = get_preconditioner (alg. Pr, Pr)
189-
190175 restart = (alg. gmres_restart == 0 ) ? min (20 , size (A,1 )) : alg. gmres_restart
191176
192177 kwargs = (abstol= abstol, reltol= reltol, maxiter= maxiters,
0 commit comments