Skip to content

Commit f357e32

Browse files
Merge pull request #232 from rveltz/main
correct mistake in constructor of KrylovKitJL
2 parents 269de36 + 1d24a2c commit f357e32

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/iterative_wrappers.jl

+6-5
Original file line numberDiff line numberDiff line change
@@ -291,27 +291,28 @@ end
291291
function KrylovKitJL(args...;
292292
KrylovAlg = KrylovKit.GMRES, gmres_restart = 0,
293293
kwargs...)
294-
return KrylovJL(KrylovAlg, gmres_restart, args, kwargs)
294+
return KrylovKitJL(KrylovAlg, gmres_restart, args, kwargs)
295295
end
296296

297297
function KrylovKitJL_CG(args...; kwargs...)
298-
KrylovKitJL(args...; KrylovAlg = KrylovKit.CG, kwargs...)
298+
KrylovKitJL(args...; KrylovAlg = KrylovKit.CG, kwargs..., isposdef = true)
299299
end
300+
300301
function KrylovKitJL_GMRES(args...; kwargs...)
301302
KrylovKitJL(args...; KrylovAlg = KrylovKit.GMRES, kwargs...)
302303
end
303304

304-
function SciMLBase.solve(cache::LinearCache, alg::KrylovKitJL, kwargs...)
305+
function SciMLBase.solve(cache::LinearCache, alg::KrylovKitJL; kwargs...)
305306
atol = float(cache.abstol)
306307
rtol = float(cache.reltol)
307308
maxiter = cache.maxiters
308309
verbosity = cache.verbose ? 1 : 0
309-
krylovdim = (alg.gmres_restart == 0) ? min(20, size(A, 1)) : alg.gmres_restart
310+
krylovdim = (alg.gmres_restart == 0) ? min(20, size(cache.A, 1)) : alg.gmres_restart
310311

311312
kwargs = (atol = atol, rtol = rtol, maxiter = maxiter, verbosity = verbosity,
312313
krylovdim = krylovdim, alg.kwargs...)
313314

314-
x, info = KrylovKit.linsolve(cache.A, cache.b, cache.u, alg.KrylovAlg)
315+
x, info = KrylovKit.linsolve(cache.A, cache.b, cache.u; kwargs...)
315316

316317
copy!(cache.u, x)
317318
resid = info.normres

test/basictests.jl

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ end
193193
("CG", KrylovKitJL_CG(kwargs...)),
194194
("GMRES", KrylovKitJL_GMRES(kwargs...)))
195195
@testset "$(alg[1])" begin test_interface(alg[2], prob1, prob2) end
196+
@test alg[2] isa KrylovKitJL
196197
end
197198
end
198199

0 commit comments

Comments
 (0)