@@ -234,37 +234,40 @@ end
234234
235235# # KrylovKit.jl
236236
237- struct KrylovKitJL{F,I,K} <: AbstractKrylovSubspaceMethod
237+ struct KrylovKitJL{F,A, I,K} <: AbstractKrylovSubspaceMethod
238238 KrylovAlg:: F
239239 gmres_restart:: I
240+ args:: A
240241 kwargs:: K
241242end
242243
243- function KrylovKitJL (KrylovAlg = KrylovKit. GMRES, gmres_restart= 0 , kwargs... )
244- return KrylovJL (KrylovAlg, gmres_restart, kwargs)
244+ function KrylovKitJL (args... ;
245+ KrylovAlg = KrylovKit. GMRES, gmres_restart = 0 ,
246+ kwargs... )
247+ return KrylovJL (KrylovAlg, gmres_restart, args, kwargs)
245248end
246249
247- KrylovKitJL_GMRES (kwargs... ) = KrylovKitJL ()
248- KrylovKitJL_CG (kwargs... ) = KrylovKitJL (KrylovKitAlg= KrylovKit. CG, kwargs... )
250+ KrylovKitJL_CG (args... ;kwargs... ) =
251+ KrylovKitJL (args... ; KrylovAlg= KrylovKit. CG, kwargs... )
252+ KrylovKitJL_GMRES (args... ;kwargs... ) =
253+ KrylovKitJL (args... ; KrylovAlg= KrylovKit. GMRES, kwargs... )
249254
250255function SciMLBase. solve (cache:: LinearCache , alg:: KrylovKitJL , kwargs... )
251256
252257 atol = float (cache. abstol)
253258 rtol = float (cache. reltol)
254259 maxiter = cache. maxiters
255260 verbosity = cache. verbose ? 1 : 0
256- krylovdim = alg. gmres_restart
261+ krylovdim = (alg . gmres_restart == 0 ) ? min ( 20 , size (A, 1 )) : alg. gmres_restart
257262
258263 kwargs = (atol= atol, rtol= rtol, maxiter= maxiter, verbosity= verbosity,
259264 krylovdim = krylovdim, alg. kwargs... )
260265
261- x, info = KrylovKit. linsolve (cache. A, cache. b, cache. u, alg. KrylovAlg,
262- [a₀ :: Number = 0 , a₁ :: Number = 1 ])
266+ x, info = KrylovKit. linsolve (cache. A, cache. b, cache. u, alg. KrylovAlg)
267+
263268 copy! (cache. u, x)
264269 resid = info. normres
265270 retcode = info. converged == 1 ? :Default : :DidNotConverge
266271 iters = info. numiter
267-
268- return SciMLBase. build_linear_solution (alg,cache. u, resid,cache;
269- retcode = retcode, iters = iters)
272+ return SciMLBase. build_linear_solution (alg, cache. u, resid, cache; retcode = retcode, iters = iters)
270273end
0 commit comments