Skip to content

Commit

Permalink
Fix degenerate singular value check with symmetric tensors (#37)
Browse files Browse the repository at this point in the history
* Fix singular values check for symmetric tensors

* Refactor ctmrg_move error computation
  • Loading branch information
lkdvos authored May 27, 2024
1 parent 3c4c78c commit bb007b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/algorithms/ctmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,16 @@ function left_move(state, env::CTMRGEnv{C,T}, alg::CTMRG) where {C,T}
else
alg.trscheme
end
(U, S, V) = tsvd(Q_sw * Q_nw; trunc=trscheme, alg=TensorKit.SVD()) # TODO: Add field in CTMRG to choose SVD function
U, S, V, ϵ_local = tsvd!(Q_sw * Q_nw; trunc=trscheme, alg=TensorKit.SVD()) # TODO: Add field in CTMRG to choose SVD function
ϵ = max(ϵ, ϵ_local / norm(S))
# TODO: check if we can just normalize enlarged corners s.t. trunc behaves a bit better

# Compute SVD truncation error and check for degenerate singular values
ignore_derivatives() do
if alg.verbosity > 0 && is_degenerate_spectrum(S)
@warn("degenerate singular values detected: ", diag(S.data))
svals = SectorDict{sectortype(S)}(c => diag(b) for (c, b) in blocks(S))
@warn("degenerate singular values detected: ", svals)
end
n0 = norm(Q_sw * Q_nw)^2
n1 = norm(U * S * V)^2
ϵ = max(ϵ, (n0 - n1) / n0)
end

# Compute projectors
Expand Down

0 comments on commit bb007b0

Please sign in to comment.