Skip to content

truncrank with symmetries seems to lead to unbalanced charges #588

Open

Description

@kshyatt

Here's an MWE:

using TensorKit, LinearAlgebra, Random
Random.seed!(1)

# blocks have identical singular values up to rounding.
V = U1Space(0 => 2, 1 => 1, -1 => 1)
A = randn(ComplexF64, V ⊗ V ← V ⊗ V)
@tensor T[a1 a2 b1 b2; c1 c2 d1 d2] := A[a1 a2; c1 c2] * conj(A[b1 b2; d1 d2])

_, Sfull, _ = svd_compact(T)
for q in (1, 2)
    Δ = maximum(abs, diag(block(Sfull, U1Irrep(q))) .- diag(block(Sfull, U1Irrep(-q))))
    println("q = ±$q: singular value difference = $Δ")
end

# truncate and figure out if any charges are missing their opposite sign partner(s)
function unbalanced(trunc)
    _, S, _ = svd_trunc(T; trunc)
    W = space(S, 1)
    d = Dict(c.charge => dim(W, c) for c in sectors(W))
    return dim(W), sort([q for q in keys(d) if d[q] != get(d, -q, 0)])
end

for χ in 20:30
    n, bad = unbalanced(truncrank(χ))
    println("truncrank($χ): kept $n, unbalanced charges $bad")
end
n, bad = unbalanced(trunctol(; rtol = 1.0e-2))
println("trunctol(rtol = 1e-2): kept $n, unbalanced charges $bad")

Basically, we sometimes have a situation where +q and -q have the same singular values, but the truncation chops away only one of them, leading to unbalanced charges. I think truncrank should instead remove both, if they have approximately the same singular values. This arose because @GlebFedorovich noticed mysterious imaginary components arising in some CTMRG calculations. If you guess unluckily for the rank to truncate to, you end up repeatedly ping-ponging between +q and -q. I also don't find that using trunctol(; rtol=something) & truncrank(max_chi) really helps either.

Activity

  1. Yue-Zhengyuan commented on Oct 22, 2026

    @Yue-Zhengyuan
    Member

    I feel this is very much related to QuantumKitHub/MatrixAlgebraKit.jl#101. I have started to port truncdegen back to MAK in this branch, but haven't got energy to fully finish it.

  2. kshyatt commented on Oct 22, 2026

    @kshyatt
    MemberAuthor

    I have some trial branches at MAK and here I can turn into real PRs, I'll do so today

  3. kshyatt commented on Oct 27, 2026

    @kshyatt
    MemberAuthor

    Wait why did this get closed? I still need to make the branch here at TensorKit

  4. lkdvos commented on Oct 27, 2026

    @lkdvos
    Member

    Oh right, that's my bad

  5. reopened this on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions