Skip to content

Define equality for TruncationStrategys #407

@Yue-Zhengyuan

Description

@Yue-Zhengyuan

In PEPSKit, when a trunc::SiteDependentTruncation is passed to the time evolution algorithm of a bipartite state, we need to check if trunc matches the bipartite structure by something like:

function _is_bipartite(trunc::SiteDependentTruncation)
    (size(trunc, 2) == size(trunc, 3) == 2) || (return false)
    # d = 1, 2 for x, y bond truncations
    for (d, c) in Iterators.product(1:2, 1:2)
        (trunc[d, 1, c] == trunc[d, 2, _next(c, 2)]) || (return false)
    end
    return true
end

This requires the equality of TruncationStrategys to be well-defined. Currently TruncationSpace (only exists in TensorKit) doesn't work for all sectors:

using TensorKit
t1 = truncspace(ℂ^3)
t2 = truncspace(ℂ^3)
@show t1 == t2 # true
t1 = truncspace(Z3Space(0 => 2, 2 => 1))
t2 = truncspace(Z3Space(0 => 2, 2 => 1))
@show t1 == t2 # true
t1 = truncspace(U1Space(0 => 1, 1 => 2))
t2 = truncspace(U1Space(0 => 1, 1 => 2))
@show t1 == t2 # false
t1 = truncspace(SU2Space(0 => 1, 1 => 2))
t2 = truncspace(SU2Space(0 => 1, 1 => 2))
@show t1 == t2 # false

I haven't tested the ones introduced by MatrixAlgebraKit.

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