Skip to content

Commit 9da59e3

Browse files
committed
correct mistake in constructor of KrylovKitJL
improve testing in solve(::KrylovKit)
1 parent 269de36 commit 9da59e3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/iterative_wrappers.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,11 @@ 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
300300
function KrylovKitJL_GMRES(args...; kwargs...)
301301
KrylovKitJL(args...; KrylovAlg = KrylovKit.GMRES, kwargs...)
@@ -306,12 +306,12 @@ function SciMLBase.solve(cache::LinearCache, alg::KrylovKitJL, kwargs...)
306306
rtol = float(cache.reltol)
307307
maxiter = cache.maxiters
308308
verbosity = cache.verbose ? 1 : 0
309-
krylovdim = (alg.gmres_restart == 0) ? min(20, size(A, 1)) : alg.gmres_restart
309+
krylovdim = (alg.gmres_restart == 0) ? min(20, size(cache.A, 1)) : alg.gmres_restart
310310

311311
kwargs = (atol = atol, rtol = rtol, maxiter = maxiter, verbosity = verbosity,
312312
krylovdim = krylovdim, alg.kwargs...)
313313

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

316316
copy!(cache.u, x)
317317
resid = info.normres

test/basictests.jl

Lines changed: 1 addition & 0 deletions
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)