Skip to content

Commit ec91786

Browse files
committed
Add new methods for krylov_workspace and krylov_solve
1 parent 07d1748 commit ec91786

File tree

2 files changed

+203
-99
lines changed

2 files changed

+203
-99
lines changed

src/interface.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,32 @@
2727
export krylov_workspace, krylov_solve, krylov_solve!
2828

2929
"""
30+
workspace = krylov_workspace(method, args...; kwargs...)
3031
workspace = krylov_workspace(Val(method), args...; kwargs...)
3132
3233
Generic function that dispatches to the appropriate workspace constructor for each subtype of [`KrylovWorkspace`](@ref) and [`BlockKrylovWorkspace`](@ref).
33-
The first argument `Val(method)`, where `method` is a symbol (such as `:cg`, `:gmres` or `:block_minres`), specifies the (block) Krylov method for which a workspace is desired.
34+
In both calls, `method` is a symbol (such as `:cg`, `:gmres` or `:block_minres`) that specifies the (block) Krylov method for which a workspace is desired.
3435
The returned workspace can later be used by [`krylov_solve!`](@ref) to execute the (block) Krylov method in-place.
36+
37+
Pass the plain symbol `method` for convenience, or wrap it in `Val(method)` to enable full compile-time specialization, improve type inference, and achieve maximum performance.
3538
"""
3639
function krylov_workspace end
3740

41+
krylov_workspace(method::Symbol, args...; kwargs...) = krylov_workspace(Val(method), args...; kwargs...)
42+
3843
"""
44+
krylov_solve(method, args...; kwargs...)
3945
krylov_solve(Val(method), args...; kwargs...)
4046
41-
Generic function that dispatches to the appropriate out-of-place (block) Krylov method specified by symbol `method` (such as `:cg`, `:gmres` or `:block_minres`).
47+
Generic function that dispatches to the appropriate out-of-place (block) Krylov method specified by `method`.
48+
In both calls, `method` is a symbol (such as `:cg`, `:gmres` or `:block_minres`).
49+
50+
Pass the plain symbol `method` for convenience, or wrap it in `Val(method)` to enable full compile-time specialization, improve type inference, and achieve maximum performance.
4251
"""
4352
function krylov_solve end
4453

54+
krylov_solve(method::Symbol, args...; kwargs...) = krylov_solve(Val(method), args...; kwargs...)
55+
4556
"""
4657
krylov_solve!(workspace, args...; kwargs...)
4758

0 commit comments

Comments
 (0)