Truncations

Currently, truncations are supported through the following different methods:

MatrixAlgebraKit.truncrankFunction
truncrank(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.

source
MatrixAlgebraKit.trunctolFunction
trunctol(; 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.

source
MatrixAlgebraKit.truncerrorFunction
truncerror(; 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.

source

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)