Skip to content

Commit 0396d23

Browse files
committed
make KrylovKit verbosity work
1 parent 5f93736 commit 0396d23

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ext/LinearSolveKrylovKitExt.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function SciMLBase.solve!(cache::LinearCache, alg::KrylovKitJL; kwargs...)
2626
rtol = float(cache.reltol)
2727
maxiter = cache.maxiters
2828
verbosity = cache.verbose ? 1 : 0
29+
verbosity = verbosity_to_KrylovKit(cache.verbose.numerical.Krylovkit_verbosity)
2930
krylovdim = (alg.gmres_restart == 0) ? min(20, size(cache.A, 1)) : alg.gmres_restart
3031

3132
kwargs = (atol = atol, rtol = rtol, maxiter = maxiter, verbosity = verbosity,
@@ -41,4 +42,13 @@ function SciMLBase.solve!(cache::LinearCache, alg::KrylovKitJL; kwargs...)
4142
iters = iters)
4243
end
4344

45+
function verbosity_to_KrylovKit(verb::SciML.Verbosity.Type)
46+
SciML.@match verb begin
47+
Verbosity.None() => 0
48+
Verbosity.Warn() => 1
49+
Verbosity.Error() => 2
50+
Verbosity.Info() => 3
51+
Level(x) => x
52+
_ => error("Not a valid verbosity level for KrylovKit.")
53+
end
4454
end

src/iterative_wrappers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ function SciMLBase.solve!(cache::LinearCache, alg::KrylovJL; kwargs...)
268268
atol = float(cache.abstol)
269269
rtol = float(cache.reltol)
270270
itmax = cache.maxiters
271-
verbose = cache.verbose ? 1 : 0
271+
verbose = cache.verbose
272272

273273
cacheval = if cache.alg isa DefaultLinearSolver
274274
if alg.KrylovAlg === Krylov.gmres!

0 commit comments

Comments
 (0)