Skip to content

initialize ComplexSpace from vector errors #332

@ogauthe

Description

@ogauthe

I would like to write generic code that works for any sectortype and returns a space. I have an issue with the Trivial sector:

function make_space(s::Sector)
    return Vect[sectortype(s)]([s=>1])
end

make_space(U1Irrep(0))  # Rep[U₁](…) of dim 1:\n0 => 1
make_space(SU2Irrep(0))   # Rep[SU₂](…) of dim 1:\n0 => 1
make_space(Trivial())  # MethodError

I use this logic in QuantumKitHub/PEPSKit.jl#263

Is this expected behavior or should I submit a fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions