Skip to content

Commit

Permalink
Update the documentation for KrylovConstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Jan 15, 2025
1 parent 7014d74 commit 8dad4ac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/src/custom_workspaces.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# [Custom workspaces](@id custom_workspaces)

## Custom workspaces for the Poisson equation with halo regions

### Introduction
Expand Down
15 changes: 12 additions & 3 deletions docs/src/inplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
All solvers in Krylov.jl have an in-place variant implemented in a method whose name ends with `!`.
A workspace (`KrylovSolver`), which contains the storage needed by a Krylov method, can be used to solve multiple linear systems with the same dimensions and the same floating-point precision.
The section [storage requirements](@ref storage-requirements) specifies the memory needed for each Krylov method.
Each `KrylovSolver` has two constructors:
Each `KrylovSolver` has three constructors:

```@constructors
XyzSolver(A, b)
XyzSolver(m, n, S)
XyzSolver(kc::KrylovConstructor)
```

`Xyz` is the name of the Krylov method with lowercase letters except its first one (`Cg`, `Minres`, `Lsmr`, `Bicgstab`, ...).
Given an operator `A` and a right-hand side `b`, you can create a `KrylovSolver` based on the size of `A` and the type of `b` or explicitly give the dimensions `(m, n)` and the storage type `S`.
`Xyz` represents the name of the Krylov method, written in lowercase except for its first letter (e.g., `Cg`, `Minres`, `Lsmr`, `Bicgstab`, etc.).
If the name of the Krylov method contains an underscore (e.g., `minres_qlp` or `cgls_lanczos_shift`), the workspace constructor transforms it by capitalizing each word and removing underscores, resulting in names like `MinresQlpSolver` or `CglsLanczosShiftSolver`.

Given an operator `A` and a right-hand side `b`, you can create a `KrylovSolver` based on the size of `A` and the type of `b`, or explicitly provide the dimensions `(m, n)` and the storage type `S`.
We assume that `S(undef, 0)`, `S(undef, n)`, and `S(undef, m)` are well-defined for the storage type `S`.
For more advanced vector types, workspaces can also be created with the help of a `KrylovConstructor`.
```@docs
Krylov.KrylovConstructor
```
See the section [custom workspaces](@ref custom_workspaces) for an example where this constructor is the only applicable option.

For example, use `S = Vector{Float64}` if you want to solve linear systems in double precision on the CPU and `S = CuVector{Float32}` if you want to solve linear systems in single precision on an Nvidia GPU.

Expand Down
2 changes: 0 additions & 2 deletions src/block_krylov_solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ The outer constructors
solver = BlockMinresSolver(m, n, p, SV, SM)
solver = BlockMinresSolver(A, B)
solver = BlockMinresSolver(kc::BlockKrylovConstructor)
may be used in order to create these vectors.
`memory` is set to `div(n,p)` if the value given is larger than `div(n,p)`.
Expand Down Expand Up @@ -83,7 +82,6 @@ The outer constructors
solver = BlockGmresSolver(m, n, p, memory, SV, SM)
solver = BlockGmresSolver(A, B, memory = 5)
solver = BlockGmresSolver(kc::BlockKrylovConstructor, memory = 5)
may be used in order to create these vectors.
`memory` is set to `div(n,p)` if the value given is larger than `div(n,p)`.
Expand Down

0 comments on commit 8dad4ac

Please sign in to comment.