Skip to content

Commit ab95c82

Browse files
authored
Define sector_type (#2)
1 parent 2126c98 commit ab95c82

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/abstractsector.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function label_fusion_rule(sector_type::Type{<:AbstractSector}, l1, l2)
6969
end
7070

7171
# ================================ GradedUnitRanges interface ==================================
72+
GradedUnitRanges.sector_type(S::Type{<:AbstractSector}) = S
73+
7274
# tensor_product interface
7375
function GradedUnitRanges.fuse_blocklengths(
7476
l1::LabelledInteger{<:Integer,<:AbstractSector},

test/test_simple_sectors.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@eval module $(gensym())
2-
using GradedUnitRanges: dual
2+
using GradedUnitRanges: dual, sector_type
33
using SymmetrySectors:
44
Fib,
55
Ising,
@@ -18,6 +18,8 @@ using Test: @inferred, @test, @testset, @test_throws
1818
@testset "TrivialSector" begin
1919
q = TrivialSector()
2020

21+
@test sector_type(q) === TrivialSector
22+
@test sector_type(typeof(q)) === TrivialSector
2123
@test (@inferred quantum_dimension(q)) == 1
2224
@test q == q
2325
@test trivial(q) == q
@@ -32,6 +34,8 @@ using Test: @inferred, @test, @testset, @test_throws
3234
q2 = U1(2)
3335
q3 = U1(3)
3436

37+
@test sector_type(q1) === U1{Int}
38+
@test sector_type(typeof(q1)) === U1{Int}
3539
@test quantum_dimension(q1) == 1
3640
@test quantum_dimension(q2) == 1
3741
@test (@inferred quantum_dimension(q1)) == 1

0 commit comments

Comments
 (0)