diff --git a/src/svd_trunc.jl b/src/svd_trunc.jl index ebfee14..87a7e53 100644 --- a/src/svd_trunc.jl +++ b/src/svd_trunc.jl @@ -37,7 +37,7 @@ function (svd_trunc::TruncThresh)(M::AbstractMatrix) U, λ, V = svd(M) λ_norm = norm(λ) mprime = 1 - s = 0.0 + s = last(λ)^2 for (k, λₖ) in Iterators.drop(Iterators.reverse(pairs(λ)), 1) s += λₖ ^ 2 if s ≥ (λ_norm * svd_trunc.ε)^2 @@ -148,4 +148,4 @@ summary(svd_trunc::TruncBondThresh) = "SVD truncation with truncation to bond si function summary_compact(svd_trunc::TruncBondThresh) ("SVD tolerance, m'", string(svd_trunc.ε)*", "*string(svd_trunc.mprime)) -end \ No newline at end of file +end