Skip to content

Commit 1686649

Browse files
committed
docstring fixes
1 parent f1147f5 commit 1686649

4 files changed

Lines changed: 43 additions & 9 deletions

File tree

src/implementations/truncation.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,6 @@ _ind_intersect(A, B) = intersect(A, B)
119119

120120
# Truncation error
121121
# ----------------
122-
@doc """
123-
truncation_error(values, ind)
124-
truncation_error!(values, ind)
125-
126-
Determine the truncation error of selecting `ind` out of the `values`.
127-
This is defined as the 2-norm of the discarded values.
128-
""" truncation_error, truncation_error!
129-
130122
truncation_error(values::AbstractVector, ind) = truncation_error!(copy(values), ind)
131123
# destroys input in order to maximize accuracy:
132124
# sqrt(norm(values)^2 - norm(values[ind])^2) might suffer from floating point error

src/interface/eig.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ selected according to a truncation strategy.
4545
The function also returns `ϵ`, the truncation error defined as the 2-norm of the
4646
discarded eigenvalues.
4747
48+
## Keyword arguments
49+
The behavior of this function is controlled by the following keyword arguments:
50+
- `trunc`: Specifies the truncation strategy. This can be:
51+
- A `NamedTuple` with fields `atol`, `rtol`, and/or `maxrank`, which will be converted to
52+
a [`TruncationStrategy`](@ref). For details on available truncation strategies, see
53+
[Truncations](@ref).
54+
- A `TruncationStrategy` object directly (e.g., `truncrank(10)`, `trunctol(atol=1e-6)`, or
55+
combinations using `&`).
56+
- `nothing` (default), which keeps all eigenvalues.
57+
- Other keyword arguments are passed to the algorithm selection procedure. If no explicit
58+
`alg` is provided, these keywords are used to select and configure the algorithm through
59+
[`MatrixAlgebraKit.select_algorithm`](@ref). The remaining keywords after algorithm
60+
selection are passed to the algorithm constructor. See [`MatrixAlgebraKit.default_algorithm`](@ref)
61+
for the default algorithm selection behavior.
62+
When `alg` is a [`TruncatedAlgorithm`](@ref), the `trunc` keyword cannot be specified as the
63+
truncation strategy is already embedded in the algorithm.
64+
4865
!!! note
4966
The bang method `eig_trunc!` optionally accepts the output structure and
5067
possibly destroys the input matrix `A`. Always use the return value of the function

src/interface/svd.jl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,27 @@ square diagonal matrix of size `(k, k)`, with `k` is set by the truncation strat
5454
5555
The function also returns `ϵ`, the truncation error defined as the 2-norm of the
5656
discarded singular values.
57-
57+
58+
## Keyword arguments
59+
The behavior of this function is controlled by the following keyword arguments:
60+
61+
- `trunc`: Specifies the truncation strategy. This can be:
62+
- A `NamedTuple` with fields `atol`, `rtol`, and/or `maxrank`, which will be converted to
63+
a [`TruncationStrategy`](@ref). For details on available truncation strategies, see
64+
[Truncations](@ref).
65+
- A `TruncationStrategy` object directly (e.g., `truncrank(10)`, `trunctol(atol=1e-6)`, or
66+
combinations using `&`).
67+
- `nothing` (default), which keeps all singular values.
68+
69+
- Other keyword arguments are passed to the algorithm selection procedure. If no explicit
70+
`alg` is provided, these keywords are used to select and configure the algorithm through
71+
[`MatrixAlgebraKit.select_algorithm`](@ref). The remaining keywords after algorithm
72+
selection are passed to the algorithm constructor. See [`MatrixAlgebraKit.default_algorithm`](@ref)
73+
for the default algorithm selection behavior.
74+
75+
When `alg` is a [`TruncatedAlgorithm`](@ref), the `trunc` keyword cannot be specified as the
76+
truncation strategy is already embedded in the algorithm.
77+
5878
!!! note
5979
The bang method `svd_trunc!` optionally accepts the output structure and
6080
possibly destroys the input matrix `A`. Always use the return value of the function

src/interface/truncation.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,8 @@ Base.:&(::NoTruncation, ::NoTruncation) = notrunc()
181181
# disambiguate
182182
Base.:&(::NoTruncation, trunc::TruncationIntersection) = trunc
183183
Base.:&(trunc::TruncationIntersection, ::NoTruncation) = trunc
184+
185+
@doc """
186+
truncation_error(values, ind)
187+
Compute the truncation error as the 2-norm of the values that are not kept by `ind`.
188+
""" truncation_error, truncation_error!

0 commit comments

Comments
 (0)