Skip to content

Commit 63ca390

Browse files
authored
Add references to the generic interface in the docstrings (#992)
* Improve the docstrings of in-place methods * More documentation * Add more references to the generic interface in the docstrings
1 parent cfc5e97 commit 63ca390

40 files changed

+428
-91
lines changed

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ makedocs(
2121
"Adjoint systems" => "solvers/as.md",
2222
"Saddle-point and Hermitian quasi-definite systems" => "solvers/sp_sqd.md",
2323
"Generalized saddle-point and non-Hermitian partitioned systems" => "solvers/gsp.md"],
24-
"Block-Krylov methods" => "block_krylov.md",
24+
"Block Krylov methods" => "block_krylov.md",
2525
"In-place methods" => "inplace.md",
2626
"Generic interface" => "generic_interface.md",
2727
"Storage requirements" => "storage.md",

src/bicgstab.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ If BICGSTAB stagnates, we recommend DQGMRES and BiLQ as alternative methods for
4242
4343
BICGSTAB stops when `itmax` iterations are reached or when `‖rₖ‖ ≤ atol + ‖b‖ * rtol`.
4444
45+
#### Interface
46+
47+
To easily switch between Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :bicgstab`.
48+
49+
For an in-place variant that reuses memory across solves, see [`bicgstab!`](@ref).
50+
4551
#### Input arguments
4652
4753
* `A`: a linear operator that models a matrix of dimension `n`;
@@ -82,9 +88,12 @@ function bicgstab end
8288
workspace = bicgstab!(workspace::BicgstabWorkspace, A, b; kwargs...)
8389
workspace = bicgstab!(workspace::BicgstabWorkspace, A, b, x0; kwargs...)
8490
85-
where `kwargs` are keyword arguments of [`bicgstab`](@ref).
91+
In these calls, `kwargs` are keyword arguments of [`bicgstab`](@ref).
92+
93+
See [`BicgstabWorkspace`](@ref) for instructions on how to create the `workspace`.
8694
87-
See [`BicgstabWorkspace`](@ref) for more details about the `workspace`.
95+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
96+
and [`krylov_solve!`](@ref) to run the Krylov method in-place.
8897
"""
8998
function bicgstab! end
9099

src/bilq.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ The relation `bᴴc ≠ 0` must be satisfied and by default `c = b`.
3333
When `A` is Hermitian and `b = c`, BiLQ is equivalent to SYMMLQ.
3434
BiLQ requires support for `adjoint(M)` and `adjoint(N)` if preconditioners are provided.
3535
36+
#### Interface
37+
38+
To easily switch between Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :bilq`.
39+
40+
For an in-place variant that reuses memory across solves, see [`bilq!`](@ref).
41+
3642
#### Input arguments
3743
3844
* `A`: a linear operator that models a matrix of dimension `n`;
@@ -74,9 +80,12 @@ function bilq end
7480
workspace = bilq!(workspace::BilqWorkspace, A, b; kwargs...)
7581
workspace = bilq!(workspace::BilqWorkspace, A, b, x0; kwargs...)
7682
77-
where `kwargs` are keyword arguments of [`bilq`](@ref).
83+
In these calls, `kwargs` are keyword arguments of [`bilq`](@ref).
84+
85+
See [`BilqWorkspace`](@ref) for instructions on how to create the `workspace`.
7886
79-
See [`BilqWorkspace`](@ref) for more details about the `workspace`.
87+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
88+
and [`krylov_solve!`](@ref) to run the Krylov method in-place.
8089
"""
8190
function bilq! end
8291

src/bilqr.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ The relation `bᴴc ≠ 0` must be satisfied.
3535
BiLQ is used for solving primal system `Ax = b` of size n.
3636
QMR is used for solving dual system `Aᴴy = c` of size n.
3737
38+
#### Interface
39+
40+
To easily switch between Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :bilqr`.
41+
42+
For an in-place variant that reuses memory across solves, see [`bilqr!`](@ref).
43+
3844
#### Input arguments
3945
4046
* `A`: a linear operator that models a matrix of dimension `n`;
@@ -74,9 +80,12 @@ function bilqr end
7480
workspace = bilqr!(workspace::BilqrWorkspace, A, b, c; kwargs...)
7581
workspace = bilqr!(workspace::BilqrWorkspace, A, b, c, x0, y0; kwargs...)
7682
77-
where `kwargs` are keyword arguments of [`bilqr`](@ref).
83+
In these calls, `kwargs` are keyword arguments of [`bilqr`](@ref).
84+
85+
See [`BilqrWorkspace`](@ref) for instructions on how to create the `workspace`.
7886
79-
See [`BilqrWorkspace`](@ref) for more details about the `workspace`.
87+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
88+
and [`krylov_solve!`](@ref) to run the Krylov method in-place.
8089
"""
8190
function bilqr! end
8291

src/block_gmres.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ Block-GMRES can be warm-started from an initial guess `X0` where `kwargs` are th
2222
2323
Solve the linear system AX = B of size n with p right-hand sides using block-GMRES.
2424
25+
#### Interface
26+
27+
To easily switch between block Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :block_gmres`.
28+
29+
For an in-place variant that reuses memory across solves, see [`block_gmres!`](@ref).
30+
2531
#### Input arguments
2632
2733
* `A`: a linear operator that models a matrix of dimension `n`;
@@ -59,13 +65,15 @@ function block_gmres end
5965
workspace = block_gmres!(workspace::BlockGmresWorkspace, B; kwargs...)
6066
workspace = block_gmres!(workspace::BlockGmresWorkspace, B, X0; kwargs...)
6167
62-
where `kwargs` are keyword arguments of [`block_gmres`](@ref).
63-
68+
In these calls, `kwargs` are keyword arguments of [`block_gmres`](@ref).
6469
The keyword argument `memory` is the only exception.
6570
It is only supported by `block_gmres` and is required to create a `BlockGmresWorkspace`.
6671
It cannot be changed later.
6772
68-
See [`BlockGmresWorkspace`](@ref) for more details about the `workspace`.
73+
See [`BlockGmresWorkspace`](@ref) for instructions on how to create the `workspace`.
74+
75+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
76+
and [`krylov_solve!`](@ref) to run the block Krylov method in-place.
6977
"""
7078
function block_gmres! end
7179

src/block_minres.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ Block-MINRES can be warm-started from an initial guess `X0` where `kwargs` are t
2121
2222
Solve the Hermitian linear system AX = B of size n with p right-hand sides using block-MINRES.
2323
24+
#### Interface
25+
26+
To easily switch between block Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :block_minres`.
27+
28+
For an in-place variant that reuses memory across solves, see [`block_minres!`](@ref).
29+
2430
#### Input arguments
2531
2632
* `A`: a linear operator that models a Hermitian matrix of dimension `n`;
@@ -54,9 +60,12 @@ function block_minres end
5460
workspace = block_minres!(workspace::BlockMinresWorkspace, B; kwargs...)
5561
workspace = block_minres!(workspace::BlockMinresWorkspace, B, X0; kwargs...)
5662
57-
where `kwargs` are keyword arguments of [`block_minres`](@ref).
63+
In these calls, `kwargs` are keyword arguments of [`block_minres`](@ref).
64+
65+
See [`BlockMinresWorkspace`](@ref) for instructions on how to create the `workspace`.
5866
59-
See [`BlockMinresWorkspace`](@ref) for more details about the `workspace`.
67+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
68+
and [`krylov_solve!`](@ref) to run the block Krylov method in-place.
6069
"""
6170
function block_minres! end
6271

src/car.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ CAR solves the Hermitian and positive definite linear system Ax = b of size n.
3030
CAR minimizes ‖Arₖ‖₂ when M = Iₙ and ‖AMrₖ‖_M otherwise.
3131
The estimates computed every iteration are ‖Mrₖ‖₂ and ‖AMrₖ‖_M.
3232
33+
#### Interface
34+
35+
To easily switch between Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :car`.
36+
37+
For an in-place variant that reuses memory across solves, see [`car!`](@ref).
38+
3339
#### Input arguments
3440
3541
* `A`: a linear operator that models a Hermitian positive definite matrix of dimension `n`;
@@ -67,9 +73,12 @@ function car end
6773
workspace = car!(workspace::CarWorkspace, A, b; kwargs...)
6874
workspace = car!(workspace::CarWorkspace, A, b, x0; kwargs...)
6975
70-
where `kwargs` are keyword arguments of [`car`](@ref).
76+
In these calls, `kwargs` are keyword arguments of [`car`](@ref).
77+
78+
See [`CarWorkspace`](@ref) for instructions on how to create the `workspace`.
7179
72-
See [`CarWorkspace`](@ref) for more details about the `workspace`.
80+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
81+
and [`krylov_solve!`](@ref) to run the Krylov method in-place.
7382
"""
7483
function car! end
7584

src/cg.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ The conjugate gradient method to solve the Hermitian linear system Ax = b of siz
3535
The method does _not_ abort if A is not definite.
3636
M also indicates the weighted norm in which residuals are measured.
3737
38+
#### Interface
39+
40+
To easily switch between Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :cg`.
41+
42+
For an in-place variant that reuses memory across solves, see [`cg!`](@ref).
43+
3844
#### Input arguments
3945
4046
* `A`: a linear operator that models a Hermitian positive definite matrix of dimension `n`;
@@ -74,9 +80,12 @@ function cg end
7480
workspace = cg!(workspace::CgWorkspace, A, b; kwargs...)
7581
workspace = cg!(workspace::CgWorkspace, A, b, x0; kwargs...)
7682
77-
where `kwargs` are keyword arguments of [`cg`](@ref).
83+
In these calls, `kwargs` are keyword arguments of [`cg`](@ref).
84+
85+
See [`CgWorkspace`](@ref) for instructions on how to create the `workspace`.
7886
79-
See [`CgWorkspace`](@ref) for more details about the `workspace`.
87+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
88+
and [`krylov_solve!`](@ref) to run the Krylov method in-place.
8089
"""
8190
function cg! end
8291

src/cg_lanczos.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ Hermitian linear system Ax = b of size n.
3232
3333
The method does _not_ abort if A is not definite.
3434
35+
#### Interface
36+
37+
To easily switch between Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :cg_lanczos`.
38+
39+
For an in-place variant that reuses memory across solves, see [`cg_lanczos!`](@ref).
40+
3541
#### Input arguments
3642
3743
* `A`: a linear operator that models a Hermitian matrix of dimension `n`;
@@ -71,9 +77,12 @@ function cg_lanczos end
7177
workspace = cg_lanczos!(workspace::CgLanczosWorkspace, A, b; kwargs...)
7278
workspace = cg_lanczos!(workspace::CgLanczosWorkspace, A, b, x0; kwargs...)
7379
74-
where `kwargs` are keyword arguments of [`cg_lanczos`](@ref).
80+
In these calls, `kwargs` are keyword arguments of [`cg_lanczos`](@ref).
81+
82+
See [`CgLanczosWorkspace`](@ref) for instructions on how to create the `workspace`.
7583
76-
See [`CgLanczosWorkspace`](@ref) for more details about the `workspace`.
84+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
85+
and [`krylov_solve!`](@ref) to run the Krylov method in-place.
7786
"""
7887
function cg_lanczos! end
7988

src/cg_lanczos_shift.jl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ export cg_lanczos_shift, cg_lanczos_shift!
1818
M=I, ldiv::Bool=false,
1919
check_curvature::Bool=false, atol::T=√eps(T),
2020
rtol::T=√eps(T), itmax::Int=0,
21-
timemax::Float64=Inf, verbose::Int=0, history::Bool=false,
22-
callback=workspace->false, iostream::IO=kstdout)
21+
timemax::Float64=Inf, verbose::Int=0,
22+
history::Bool=false, callback=workspace->false,
23+
iostream::IO=kstdout)
2324
2425
`T` is an `AbstractFloat` such as `Float32`, `Float64` or `BigFloat`.
2526
`FC` is `T` or `Complex{T}`.
@@ -31,6 +32,12 @@ of shifted systems
3132
3233
of size n. The method does _not_ abort if A + αI is not definite.
3334
35+
#### Interface
36+
37+
To easily switch between Krylov methods, use the generic interface [`krylov_solve`](@ref) with `method = :cg_lanczos_shift`.
38+
39+
For an in-place variant that reuses memory across solves, see [`cg_lanczos_shift!`](@ref).
40+
3441
#### Input arguments
3542
3643
* `A`: a linear operator that models a Hermitian matrix of dimension `n`;
@@ -66,9 +73,12 @@ function cg_lanczos_shift end
6673
"""
6774
workspace = cg_lanczos_shift!(workspace::CgLanczosShiftWorkspace, A, b, shifts; kwargs...)
6875
69-
where `kwargs` are keyword arguments of [`cg_lanczos_shift`](@ref).
76+
In this call, `kwargs` are keyword arguments of [`cg_lanczos_shift`](@ref).
77+
78+
See [`CgLanczosShiftWorkspace`](@ref) for instructions on how to create the `workspace`.
7079
71-
See [`CgLanczosShiftWorkspace`](@ref) for more details about the `workspace`.
80+
For a more generic interface, you can use [`krylov_workspace`](@ref) to allocate the workspace,
81+
and [`krylov_solve!`](@ref) to run the Krylov method in-place.
7282
"""
7383
function cg_lanczos_shift! end
7484

0 commit comments

Comments
 (0)