Skip to content

Commit

Permalink
Refactor ctmrg_move error computation
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed May 27, 2024
1 parent 15b6863 commit 7c242df
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/algorithms/ctmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +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)
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 7c242df

Please sign in to comment.