From 7c242df789eef90702e49256b4375d5e41e6634f Mon Sep 17 00:00:00 2001 From: lkdvos Date: Mon, 27 May 2024 13:16:05 +0200 Subject: [PATCH] Refactor ctmrg_move error computation --- src/algorithms/ctmrg.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/algorithms/ctmrg.jl b/src/algorithms/ctmrg.jl index 4499ffcb..0bc9b714 100644 --- a/src/algorithms/ctmrg.jl +++ b/src/algorithms/ctmrg.jl @@ -329,7 +329,9 @@ 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 @@ -337,9 +339,6 @@ function left_move(state, env::CTMRGEnv{C,T}, alg::CTMRG) where {C,T} 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