File tree Expand file tree Collapse file tree 6 files changed +20
-4
lines changed Expand file tree Collapse file tree 6 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 11name = " TensorKitSectors"
22uuid = " 13a9c161-d5da-41f0-bcbd-e1a08ae0647f"
33authors = [" Lukas Devos" , " Jutho Haegeman" ]
4- version = " 0.3.2 "
4+ version = " 0.3.3 "
55
66[deps ]
77HalfIntegers = " f0d1745a-41c9-11e9-1dd9-e5d34d218721"
Original file line number Diff line number Diff line change @@ -69,6 +69,12 @@ function allunits(::Type{ProductSector{T}}) where {T}
6969 iterators = map (allunits, _sectors (T))
7070 return SectorSet {ProductSector{T}} (Base. Iterators. product (iterators... ))
7171end
72+ function leftunit (a:: P ) where {P <: ProductSector }
73+ return P (map (leftunit, a. sectors))
74+ end
75+ function rightunit (a:: P ) where {P <: ProductSector }
76+ return P (map (rightunit, a. sectors))
77+ end
7278
7379dual (p:: ProductSector ) = ProductSector (map (dual, p. sectors))
7480function ⊗ (p1:: P , p2:: P ) where {P <: ProductSector }
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ function isunit(a::Sector)
128128 return if UnitStyle (a) === SimpleUnit ()
129129 a == unit (a)
130130 else
131- leftunit (a) == a == rightunit (a )
131+ a in allunits ( typeof (a) )
132132 end
133133end
134134Base. isone (a:: Sector ) = isunit (a)
@@ -328,7 +328,7 @@ This can be either
328328* `SimpleUnit()`: the unit is simple (e.g. fusion categories);
329329* `GenericUnit()`: the unit is semisimple.
330330"""
331- abstract type UnitStyle end # TODO : rename
331+ abstract type UnitStyle end
332332UnitStyle (a:: Sector ) = UnitStyle (typeof (a))
333333
334334struct SimpleUnit <: UnitStyle end
Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ Istr = TensorKitSectors.type_repr(I)
3636 @test length (allunits (I)) == 2
3737 @test allunits (I) == (C0, D0)
3838
39+ @test ! isunit (C0 ⊠ C1)
40+ @test ! isunit (C0 ⊠ D1)
41+ @test isunit (C0 ⊠ C0)
42+ @test isunit (D0 ⊠ D0)
43+ @test isunit (C0 ⊠ D0)
44+ @test length (allunits (I ⊠ I)) == 4
45+
46+ @test leftunit (M ⊠ Mop) == C0 ⊠ D0 == rightunit (Mop ⊠ M)
47+
3948 @test eval (Meta. parse (sprint (show, s))) == s
4049 @test @constinferred (hash (s)) == hash (deepcopy (s))
4150 @constinferred dual (s)
Original file line number Diff line number Diff line change 6363 @test typeof (a ⊠ b) == I1 ⊠ I2
6464
6565 @test @constinferred (length (allunits (I1 ⊠ I2))) == 1
66+ @test @constinferred (unit (I1 ⊠ I2)) == leftunit (a ⊠ b) == rightunit (a ⊠ b)
6667 end
6768 @test @constinferred (Tuple (SU2Irrep (1 ) ⊠ U1Irrep (0 ))) == (SU2Irrep (1 ), U1Irrep (0 ))
6869 @test @constinferred (length (FermionParity (1 ) ⊠ SU2Irrep (1 // 2 ) ⊠ U1Irrep (1 ))) == 3
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ function randsector(::Type{I}) where {I <: Sector}
3030 end
3131 return a
3232end
33- randsector (:: Type{I} ) where {I <: Union{Trivial, PlanarTrivial} } = one (I)
33+ randsector (:: Type{I} ) where {I <: Union{Trivial, PlanarTrivial} } = unit (I)
3434
3535function hasfusiontensor (I:: Type{<:Sector} )
3636 try
You can’t perform that action at this time.
0 commit comments