@@ -165,8 +165,9 @@ operation is the inverse of `insertat` in the sense that if
165165 f₂ = FusionTree {I} (f. uncoupled, f. coupled, isdual2, f. innerlines, f. vertices)
166166 return f₁, f₂
167167 elseif M === 0
168- f₁ = FusionTree {I} ((), one (I), (), ())
169- uncoupled2 = (one (I), f. uncoupled... )
168+ u = leftone (f. uncoupled[1 ])
169+ f₁ = FusionTree {I} ((), u, (), ())
170+ uncoupled2 = (u, f. uncoupled... )
170171 coupled2 = f. coupled
171172 isdual2 = (false , f. isdual... )
172173 innerlines2 = N >= 2 ? (f. uncoupled[1 ], f. innerlines... ) : ()
@@ -230,7 +231,7 @@ function merge(f₁::FusionTree{I,N₁}, f₂::FusionTree{I,N₂},
230231 return insertat (f, N₁ + 1 , f₂)
231232end
232233function merge (f₁:: FusionTree{I,0} , f₂:: FusionTree{I,0} , c:: I , μ) where {I}
233- isone (c) ||
234+ Nsymbol (f₁ . coupled, f₂ . coupled, c) == μ == 1 ||
234235 throw (SectorMismatch (" cannot fuse sectors $(f₁. coupled) and $(f₂. coupled) to $c " ))
235236 return fusiontreedict (I)(f₁ => Fsymbol (c, c, c, c, c, c)[1 , 1 , 1 , 1 ])
236237end
@@ -289,7 +290,8 @@ function bendright(f₁::FusionTree{I,N₁}, f₂::FusionTree{I,N₂}) where {I<
289290 # map final splitting vertex (a, b)<-c to fusion vertex a<-(c, dual(b))
290291 @assert N₁ > 0
291292 c = f₁. coupled
292- a = N₁ == 1 ? one (I) : (N₁ == 2 ? f₁. uncoupled[1 ] : f₁. innerlines[end ])
293+ a = N₁ == 1 ? leftone (f₁. uncoupled[1 ]) :
294+ (N₁ == 2 ? f₁. uncoupled[1 ] : f₁. innerlines[end ])
293295 b = f₁. uncoupled[N₁]
294296
295297 uncoupled1 = TupleTools. front (f₁. uncoupled)
@@ -360,7 +362,7 @@ function foldright(f₁::FusionTree{I,N₁}, f₂::FusionTree{I,N₂}) where {I<
360362 hasmultiplicities = FusionStyle (a) isa GenericFusion
361363 local newtrees
362364 if N₁ == 1
363- cset = (one (c1),)
365+ cset = (leftone (c1),) # or rightone(a )
364366 elseif N₁ == 2
365367 cset = (f₁. uncoupled[2 ],)
366368 else
@@ -729,7 +731,8 @@ function elementary_trace(f::FusionTree{I,N}, i) where {I<:Sector,N}
729731 # if trace is zero, return empty dict
730732 (b == dual (b′) && f. isdual[i] != f. isdual[j]) || return newtrees
731733 if i < N
732- inner_extended = (one (I), f. uncoupled[1 ], f. innerlines... , f. coupled)
734+ inner_extended = (leftone (f. uncoupled[1 ]), f. uncoupled[1 ], f. innerlines... ,
735+ f. coupled)
733736 a = inner_extended[i]
734737 d = inner_extended[i + 2 ]
735738 a == d || return newtrees
@@ -753,11 +756,11 @@ function elementary_trace(f::FusionTree{I,N}, i) where {I<:Sector,N}
753756 if i > 1
754757 c = f. innerlines[i - 1 ]
755758 if FusionStyle (I) isa MultiplicityFreeFusion
756- coeff *= Fsymbol (a, b, dual (b), a, c, one (I ))
759+ coeff *= Fsymbol (a, b, dual (b), a, c, rightone (a ))
757760 else
758761 μ = f. vertices[i - 1 ]
759762 ν = f. vertices[i]
760- coeff *= Fsymbol (a, b, dual (b), a, c, one (I ))[μ, ν, 1 , 1 ]
763+ coeff *= Fsymbol (a, b, dual (b), a, c, rightone (a ))[μ, ν, 1 , 1 ]
761764 end
762765 end
763766 if f. isdual[i]
@@ -766,8 +769,9 @@ function elementary_trace(f::FusionTree{I,N}, i) where {I<:Sector,N}
766769 push! (newtrees, f′ => coeff)
767770 return newtrees
768771 else # i == N
772+ unit = leftone (b)
769773 if N == 2
770- f′ = FusionTree {I} ((), one (I) , (), (), ())
774+ f′ = FusionTree {I} ((), unit , (), (), ())
771775 coeff = sqrtdim (b)
772776 if ! (f. isdual[N])
773777 coeff *= conj (frobeniusschur (b))
@@ -778,18 +782,17 @@ function elementary_trace(f::FusionTree{I,N}, i) where {I<:Sector,N}
778782 uncoupled_ = TupleTools. front (f. uncoupled)
779783 inner_ = TupleTools. front (f. innerlines)
780784 coupled_ = f. innerlines[end ]
781- @assert coupled_ == dual (b)
782785 isdual_ = TupleTools. front (f. isdual)
783786 vertices_ = TupleTools. front (f. vertices)
784787 f_ = FusionTree (uncoupled_, coupled_, isdual_, inner_, vertices_)
785788 fs = FusionTree ((b,), b, (! f. isdual[1 ],), (), ())
786- for (f_′, coeff) in merge (fs, f_, one (I) , 1 )
787- f_′. innerlines[1 ] == one (I) || continue
789+ for (f_′, coeff) in merge (fs, f_, unit , 1 ) # coloring gets reversed here, should be the other unit
790+ f_′. innerlines[1 ] == unit || continue
788791 uncoupled′ = Base. tail (Base. tail (f_′. uncoupled))
789792 isdual′ = Base. tail (Base. tail (f_′. isdual))
790793 inner′ = N <= 4 ? () : Base. tail (Base. tail (f_′. innerlines))
791794 vertices′ = N <= 3 ? () : Base. tail (Base. tail (f_′. vertices))
792- f′ = FusionTree (uncoupled′, one (I) , isdual′, inner′, vertices′)
795+ f′ = FusionTree (uncoupled′, unit , isdual′, inner′, vertices′) # and this one?
793796 coeff *= sqrtdim (b)
794797 if ! (f. isdual[N])
795798 coeff *= conj (frobeniusschur (b))
0 commit comments