You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/inplace.md
+26-3Lines changed: 26 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,8 @@
1
1
## [In-place methods](@id in-place)
2
2
3
3
All solvers in Krylov.jl have an in-place variant implemented in a method whose name ends with `!`.
4
-
A workspace (`KrylovWorkspace`), 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.
4
+
A workspace (`KrylovWorkspace` or `BlockKrylovWorkspace`), 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.
5
+
It should also be the same number of right-hand sides in block Krylov methods.
5
6
The section [storage requirements](@ref storage-requirements) specifies the memory needed for each Krylov method.
6
7
7
8
Each `KrylovWorkspace` has three constructors with consistent argument patterns:
@@ -44,6 +45,26 @@ lsqr_workspace = LsqrWorkspace(m, n, CuVector{Float32})
44
45
lsqr!(lsqr_workspace, A4, b4)
45
46
```
46
47
48
+
## Workspace accessors
49
+
50
+
In-place solvers update the workspace, from which solutions and statistics can be retrieved.
51
+
The following functions are available for post-solve analysis.
52
+
53
+
These functions are not exported and must be accessed using the prefix `Krylov.`, e.g. `Krylov.solution(workspace)`.
54
+
55
+
```@docs
56
+
Krylov.results
57
+
Krylov.solution
58
+
Krylov.nsolution
59
+
Krylov.statistics
60
+
Krylov.elapsed_time
61
+
Krylov.niterations
62
+
Krylov.issolved
63
+
Krylov.Aprod
64
+
Krylov.Atprod
65
+
Krylov.Bprod
66
+
```
67
+
47
68
## Examples
48
69
49
70
We illustrate the use of in-place Krylov solvers with two well-known optimization methods.
@@ -53,6 +74,7 @@ The details of the optimization methods are described in the section about [Fact
53
74
54
75
```@newton
55
76
using Krylov
77
+
import Krylov: solution
56
78
57
79
function newton(∇f, ∇²f, x₀; itmax = 200, tol = 1e-8)
58
80
@@ -63,7 +85,6 @@ function newton(∇f, ∇²f, x₀; itmax = 200, tol = 1e-8)
63
85
iter = 0
64
86
S = typeof(x)
65
87
workspace = CgWorkspace(n, n, S)
66
-
Δx = workspace.x
67
88
68
89
solved = false
69
90
tired = false
@@ -72,6 +93,7 @@ function newton(∇f, ∇²f, x₀; itmax = 200, tol = 1e-8)
0 commit comments