Skip to content

Commit 591bcbc

Browse files
committed
fix sector_type
1 parent aaac06a commit 591bcbc

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/fusiontensor/fusiontensor.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,19 @@ function charge_block_size(ft::FusionTensor, f1::SectorFusionTree, f2::SectorFus
6565
end
6666

6767
# GradedUnitRanges interface
68-
GradedUnitRanges.sector_type(ft::FusionTensor) = sector_type(matrix_row_axis(ft))
68+
function GradedUnitRanges.sector_type(
69+
::Type{<:FusionTensor{<:Any,<:Any,CoDomainAxes}}
70+
) where {CoDomainAxes}
71+
return sector_type(fieldtype(CoDomainAxes, 1))
72+
end
73+
function GradedUnitRanges.sector_type(
74+
::Type{<:FusionTensor{<:Any,<:Any,Tuple{},DomainAxes}}
75+
) where {DomainAxes}
76+
return sector_type(fieldtype(DomainAxes, 1))
77+
end
78+
function GradedUnitRanges.sector_type(::Type{<:FusionTensor{<:Any,0}})
79+
return TrivialSector
80+
end
6981

7082
# BlockArrays interface
7183
function BlockArrays.findblock(ft::FusionTensor, f1::SectorFusionTree, f2::SectorFusionTree)

test/basics/test_basics.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using FusionTensors:
1616
ndims_codomain
1717
using GradedUnitRanges:
1818
blockmergesort, dual, flip, fusion_product, gradedrange, sector_type, space_isequal
19-
using SymmetrySectors: U1, SU2, SectorProduct, Z
19+
using SymmetrySectors: U1, SU2, SectorProduct, TrivialSector, Z
2020

2121
include("setup.jl")
2222

@@ -129,6 +129,7 @@ end
129129
@test size(ft1) == (6,)
130130
@test size(data_matrix(ft1)) == (6, 1)
131131
@test isnothing(check_sanity(ft1))
132+
@test sector_type(ft1) === sector_type(g1)
132133

133134
# one column axis
134135
ft2 = FusionTensor(Float64, (), (g1,))
@@ -138,6 +139,7 @@ end
138139
@test size(ft2) == (6,)
139140
@test size(data_matrix(ft2)) == (1, 6)
140141
@test isnothing(check_sanity(ft2))
142+
@test sector_type(ft2) === sector_type(g1)
141143

142144
# zero axis
143145
ft3 = FusionTensor(Float64, (), ())
@@ -147,6 +149,7 @@ end
147149
@test size(ft3) == ()
148150
@test size(data_matrix(ft3)) == (1, 1)
149151
@test isnothing(check_sanity(ft3))
152+
@test sector_type(ft3) === TrivialSector
150153
end
151154

152155
@testset "Base operations" begin

0 commit comments

Comments
 (0)