Skip to content

Commit 87c3c85

Browse files
borisdevoslkdvos
andauthored
Introduce leftone and rightone to support multi-fusion categories (#9)
* define leftone and rightone * export leftone, rightone * have Bsymbol evaluate rightone * have Asymbol evaluate leftone * have dim evaluate leftone and rightone * have frobeniusschur use leftone/rightone * format * move leftone/rightone + add docstring * Apply suggestion for leftone/rightone docstring Co-authored-by: Lukas Devos <[email protected]> --------- Co-authored-by: Lukas Devos <[email protected]>
1 parent 4ca9089 commit 87c3c85

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

src/TensorKitSectors.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export FusionStyle, UniqueFusion, MultipleFusion, SimpleFusion, GenericFusion,
1717
MultiplicityFreeFusion
1818
export BraidingStyle, NoBraiding, SymmetricBraiding, Bosonic, Fermionic, Anyonic
1919
export SectorSet, SectorValues, findindex
20+
export rightone, leftone
2021

2122
export pentagon_equation, hexagon_equation
2223

src/sectors.jl

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ Return the unit element within this type of sector.
9292
"""
9393
Base.one(a::Sector) = one(typeof(a))
9494

95+
"""
96+
leftone(a::Sector) -> Sector
97+
98+
Return the left unit element within this type of sector.
99+
See also [`rightone`](@ref) and [`Base.one`](@ref).
100+
"""
101+
leftone(a::Sector) = one(a)
102+
103+
"""
104+
rightone(a::Sector) -> Sector
105+
106+
Return the right unit element within this type of sector.
107+
See also [`leftone`](@ref) and [`Base.one`](@ref).
108+
"""
109+
rightone(a::Sector) = one(a)
110+
95111
"""
96112
dual(a::Sector) -> Sector
97113
@@ -235,9 +251,9 @@ function dim(a::Sector)
235251
if FusionStyle(a) isa UniqueFusion
236252
1
237253
elseif FusionStyle(a) isa SimpleFusion
238-
abs(1 / Fsymbol(a, conj(a), a, a, one(a), one(a)))
254+
abs(1 / Fsymbol(a, conj(a), a, a, leftone(a), rightone(a)))
239255
else
240-
abs(1 / Fsymbol(a, conj(a), a, a, one(a), one(a))[1])
256+
abs(1 / Fsymbol(a, conj(a), a, a, leftone(a), rightone(a))[1])
241257
end
242258
end
243259
sqrtdim(a::Sector) = (FusionStyle(a) isa UniqueFusion) ? 1 : sqrt(dim(a))
@@ -250,20 +266,20 @@ Return the Frobenius-Schur indicator of a sector `a`.
250266
"""
251267
function frobeniusschur(a::Sector)
252268
if FusionStyle(a) isa UniqueFusion || FusionStyle(a) isa SimpleFusion
253-
sign(Fsymbol(a, conj(a), a, a, one(a), one(a)))
269+
sign(Fsymbol(a, conj(a), a, a, leftone(a), rightone(a)))
254270
else
255-
sign(Fsymbol(a, conj(a), a, a, one(a), one(a))[1])
271+
sign(Fsymbol(a, conj(a), a, a, leftone(a), rightone(a))[1])
256272
end
257273
end
258274

259275
# Not necessary
260276
function Asymbol(a::I, b::I, c::I) where {I<:Sector}
261277
if FusionStyle(I) isa UniqueFusion || FusionStyle(I) isa SimpleFusion
262278
(sqrtdim(a) * sqrtdim(b) * invsqrtdim(c)) *
263-
conj(frobeniusschur(a) * Fsymbol(dual(a), a, b, b, one(a), c))
279+
conj(frobeniusschur(a) * Fsymbol(dual(a), a, b, b, leftone(a), c))
264280
else
265281
reshape((sqrtdim(a) * sqrtdim(b) * invsqrtdim(c)) *
266-
conj(frobeniusschur(a) * Fsymbol(dual(a), a, b, b, one(a), c)),
282+
conj(frobeniusschur(a) * Fsymbol(dual(a), a, b, b, leftone(a), c)),
267283
(Nsymbol(a, b, c), Nsymbol(dual(a), c, b)))
268284
end
269285
end
@@ -284,10 +300,11 @@ number. Otherwise it is a square matrix with row and column size
284300
"""
285301
function Bsymbol(a::I, b::I, c::I) where {I<:Sector}
286302
if FusionStyle(I) isa UniqueFusion || FusionStyle(I) isa SimpleFusion
287-
(sqrtdim(a) * sqrtdim(b) * invsqrtdim(c)) * Fsymbol(a, b, dual(b), a, c, one(a))
303+
(sqrtdim(a) * sqrtdim(b) * invsqrtdim(c)) *
304+
Fsymbol(a, b, dual(b), a, c, rightone(a))
288305
else
289306
reshape((sqrtdim(a) * sqrtdim(b) * invsqrtdim(c)) *
290-
Fsymbol(a, b, dual(b), a, c, one(a)),
307+
Fsymbol(a, b, dual(b), a, c, rightone(a)),
291308
(Nsymbol(a, b, c), Nsymbol(c, dual(b), a)))
292309
end
293310
end

0 commit comments

Comments
 (0)