Skip to content

Inconsistent handling of empty tensors when using multifusion sectors #514

Description

@leburgel

There is some inconsistency in how tensor maps without any valid fusion channels are handled when using multifusion sectors. Depending on how the spaces of such a tensor are partitioned between the domain and codomain, construction and manipulation eithers returns an empty tensor with norm zero, or throws an ArgumentError.

For example:

using TensorKit, TensorKitSectors

C0, C1 = IsingBimodule(1, 1, 0), IsingBimodule(1, 1, 1)
D0, D1 = IsingBimodule(2, 2, 0), IsingBimodule(2, 2, 1)
M, Mop = IsingBimodule(1, 2, 0), IsingBimodule(2, 1, 0)

V = (
    Vect[IsingBimodule](C0 => 2, C1 => 1), Vect[IsingBimodule](Mop => 1)',
    Vect[IsingBimodule](D0 => 2, D1 => 2), Vect[IsingBimodule](M => 2)',
    Vect[IsingBimodule](C0 => 3, C1 => 2),
)
t = randn(Float64, V[1]  V[2]  V[3]  V[4]  V[5])
# t is fine: norm(t) == 0.0, blocksectors(t) == IsingBimodule[]
@show norm(t)
@show blocksectors(t)

repartition(t, 0)   # ok, norm = 0.0
repartition(t, 1)   # ok, norm = 0.0
repartition(t, 2)   # ok, norm = 0.0
repartition(t, 3)   # ArgumentError: invalid fusion channel
repartition(t, 4)   # ArgumentError: invalid fusion channel
repartition(t, 5)   # ok, norm = 0.0

The issue seems to be that blocksectors calls corresponding to an empty set sometimes return and empty set and sometimes throw, depening on the specific arguments:

codom = Vect[IsingBimodule](C0 => 1)  Vect[IsingBimodule](C0 => 1)
blocksectors(codom  Vect[IsingBimodule](D0 => 1))   # ArgumentError: invalid fusion channel
blocksectors(codom  Vect[IsingBimodule](C1 => 1))   # IsingBimodule[]

I'm not sure whether it's better to always throw or never throw. @lkdvos, @borisdevos.

Metadata

Metadata

Assignees

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