Skip to content

Commit

Permalink
Fixed error in threshold-based SVD
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoFlorio authored Nov 26, 2024
1 parent c6b3304 commit 024a1df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/svd_trunc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
end

0 comments on commit 024a1df

Please sign in to comment.