Truncations
Currently, truncations are supported through the following different methods:
MatrixAlgebraKit.notrunc
— Functionnotrunc()
Truncation strategy that does nothing, and keeps all the values.
MatrixAlgebraKit.truncrank
— Functiontruncrank(howmany::Integer; by=abs, rev::Bool=true)
Truncation strategy to keep the first howmany
values when sorted according to by
or the last howmany
if rev
is true.
MatrixAlgebraKit.trunctol
— Functiontrunctol(; atol::Real=0, rtol::Real=0, p::Real=2, by=abs, keep_below::Bool=false)
Truncation strategy to keep the values that satisfy by(val) > max(atol, rtol * norm(values, p)
. If keep_below = true
, discard these values instead.
MatrixAlgebraKit.truncfilter
— Functiontruncfilter(filter)
Truncation strategy to keep the values for which filter
returns true.
MatrixAlgebraKit.truncerror
— Functiontruncerror(; atol::Real=0, rtol::Real=0, p::Real=2)
Truncation strategy for truncating values such that the error in the factorization is smaller than max(atol, rtol * norm)
, where the error is determined using the p
-norm.
It is additionally possible to combine truncation strategies by making use of the &
operator. For example, truncating to a maximal dimension 10
, and discarding all values below 1e-6
would be achieved by:
maxdim = 10
atol = 1e-6
combined_trunc = truncrank(maxdim) & trunctol(; atol)