Skip to content

Commit 9a5d488

Browse files
author
mohamed82008
committed
Documenting CGStateVariables
1 parent 7466658 commit 9a5d488

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/cg.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ end
9090

9191
# Utility functions
9292

93+
"""
94+
Intermediate CG state variables to be used inside cg and cg!. `u`, `r` and `c` should be of the same type as the solution of `cg` or `cg!`.
95+
```
96+
struct CGStateVariables{T,Tx<:AbstractArray{T}}
97+
u::Tx
98+
r::Tx
99+
c::Tx
100+
end
101+
```
102+
"""
93103
struct CGStateVariables{T,Tx<:AbstractArray{T}}
94104
u::Tx
95105
r::Tx
@@ -154,15 +164,16 @@ cg(A, b; kwargs...) = cg!(zerox(A, b), A, b; initially_zero = true, kwargs...)
154164
155165
## Keywords
156166
167+
- `statevars::CGStateVariables`: Has 3 arrays similar to `x` to hold intermediate results;
157168
- `initially_zero::Bool`: If `true` assumes that `iszero(x)` so that one
158169
matrix-vector product can be saved when computing the initial
159170
residual vector;
160171
- `Pl = Identity()`: left preconditioner of the method. Should be symmetric,
161-
positive-definite like `A`.
172+
positive-definite like `A`;
162173
- `tol::Real = sqrt(eps(real(eltype(b))))`: tolerance for stopping condition `|r_k| / |r_0| ≤ tol`;
163174
- `maxiter::Int = size(A,2)`: maximum number of iterations;
164175
- `verbose::Bool = false`: print method information;
165-
- `log::Bool = false`: keep track of the residual norm in each iteration;
176+
- `log::Bool = false`: keep track of the residual norm in each iteration.
166177
167178
# Output
168179

0 commit comments

Comments
 (0)