Skip to content

Commit 941044b

Browse files
lkdvosclaude
andcommitted
Braid a single tree pair through the tree manipulations themselves
`bendright` and `bendleft` of a tree pair no longer assert `UniqueFusion`, but rely on `only` to throw if the bent vertex has a multiplicity, which replaces their `_single` variants. The shortcut of `braid` for a symmetric braiding is restricted to `UniqueFusion`, where the `Fsymbol`s are trivial, such that a block with a single tree is braided as its tree pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5f60bb7 commit 941044b

2 files changed

Lines changed: 20 additions & 43 deletions

File tree

‎src/fusiontrees/braiding_manipulations.jl‎

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,8 @@ braid(f::FusionTree{I, N}, p::IndexTuple{N}, levels::IndexTuple{N}) where {I, N}
235235
braid(f, (p, ()), (levels, ()))
236236
function braid(f::FusionTree{I, N}, (p, _)::Index2Tuple{N, 0}, (levels, _)::Index2Tuple{N, 0}) where {I, N}
237237
TupleTools.isperm(p) || throw(ArgumentError(lazy"not a valid permutation: $p"))
238-
@assert FusionStyle(I) isa UniqueFusion
239238
braid_style = BraidingStyle(I)
240-
if braid_style isa SymmetricBraiding # this assumes Fsymbols are 1!
239+
if FusionStyle(I) isa UniqueFusion && braid_style isa SymmetricBraiding # Fsymbols are 1
241240
coeff = one(sectorscalartype(I))
242241
for i in 1:N
243242
for j in 1:(i - 1)
@@ -322,35 +321,20 @@ end
322321

323322
@cached function fsbraid(key::K)::_fsdicttype(K) where {I, N₁, N₂, K <: Union{FSPBraidKey{I, N₁, N₂}, FSBBraidKey{I, N₁, N₂}}}
324323
if K <: FSPBraidKey
325-
((f₁, f₂), (p1, p2), (l1, l2)) = key
326-
p = linearizepermutation(p1, p2, length(f₁), length(f₂))
327-
levels = (l1..., reverse(l2)...)
328-
(f, f0), coeff1 = repartition((f₁, f₂), N₁ + N₂)
329-
f′, coeff2 = braid(f, p, levels)
330-
(f₁′, f₂′), coeff3 = repartition((f′, f0), N₁)
331-
return (f₁′, f₂′) => coeff1 * coeff2 * coeff3
324+
f, p, levels = key
325+
return _braid_single(f::FusionTreePair{I}, p, levels)
332326
else
333327
src, (p1, p2), (l1, l2) = key
334328
src = src::FusionTreeBlock{I}
335329

336-
p = linearizepermutation(p1, p2, numout(src), numin(src))
337-
levels = (l1..., reverse(l2)...)
338-
339330
if length(src) == 1 # then so is every intermediate block: the braid is a product of scalars
340-
(f, f₀), coeff = _bend_single(_bendleft_single, only(fusiontrees(src)), Val(numin(src)))
341-
for s in permutation2swaps(p)
342-
_check_levels(BraidingStyle(I), levels, s)
343-
inv = levels[s] > levels[s + 1]
344-
f, c = artin_braid(f, s; inv)
345-
coeff *= c
346-
l = levels[s]
347-
levels = TupleTools.setindex(levels, levels[s + 1], s)
348-
levels = TupleTools.setindex(levels, l, s + 1)
349-
end
350-
(f₁′, f₂′), c = _bend_single(_bendright_single, (f, f₀), Val(N₂))
351-
return FusionTreeBlock([(f₁′, f₂′)]) => fill(coeff * c, 1, 1)
331+
f′, coeff = _braid_single(only(fusiontrees(src)), (p1, p2), (l1, l2))
332+
return FusionTreeBlock([f′]) => fill(coeff, 1, 1)
352333
end
353334

335+
p = linearizepermutation(p1, p2, numout(src), numin(src))
336+
levels = (l1..., reverse(l2)...)
337+
354338
# the intermediate blocks keep their trees in the order in which they are produced,
355339
# and only the result is brought into canonical order
356340
dst, U = repartition_noncanonical(src, Val(numind(src)))
@@ -383,6 +367,16 @@ end
383367
end
384368
end
385369

370+
# also for a tree pair that is the only one with its uncoupled sectors (`only` throws otherwise)
371+
function _braid_single((f₁, f₂)::FusionTreePair, (p1, p2)::Index2Tuple{N₁, N₂}, (l1, l2)::Index2Tuple) where {N₁, N₂}
372+
p = linearizepermutation(p1, p2, length(f₁), length(f₂))
373+
levels = (l1..., reverse(l2)...)
374+
(f, f0), coeff1 = repartition((f₁, f₂), N₁ + N₂)
375+
f′, coeff2 = braid(f, p, levels)
376+
(f₁′, f₂′), coeff3 = repartition((f′, f0), N₁)
377+
return (f₁′, f₂′) => coeff1 * coeff2 * coeff3
378+
end
379+
386380
CacheStyle(::typeof(fsbraid), k::Union{FSPBraidKey{I}, FSBBraidKey{I}}) where {I} =
387381
FusionStyle(I) isa UniqueFusion ? NoCache() : GlobalLRUCache()
388382

‎src/fusiontrees/duality_manipulations.jl‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,8 @@ function _bendright_treepair((f₁, f₂)::FusionTreePair)
5353
return (a, b, c), (f₁′, f₂′)
5454
end
5555

56+
# also for a final splitting vertex without multiplicity (`only` throws otherwise)
5657
function bendright((f₁, f₂)::FusionTreePair)
57-
@assert FusionStyle((f₁, f₂)) === UniqueFusion()
58-
return _bendright_single((f₁, f₂))
59-
end
60-
# also for a final fusion vertex without multiplicity (`only` throws otherwise)
61-
function _bendright_single((f₁, f₂)::FusionTreePair)
6258
N₁ = numout((f₁, f₂))
6359
(a, b, c), (f₁′, f₂′) = _bendright_treepair((f₁, f₂))
6460

@@ -142,22 +138,9 @@ See also [`bendright`](@ref).
142138
""" bendleft
143139

144140
function bendleft((f₁, f₂)::FusionTreePair)
145-
@assert FusionStyle((f₁, f₂)) === UniqueFusion()
146141
(f₂′, f₁′), coeff = bendright((f₂, f₁))
147142
return (f₁′, f₂′) => conj(coeff)
148143
end
149-
function _bendleft_single((f₁, f₂)::FusionTreePair)
150-
(f₂′, f₁′), coeff = _bendright_single((f₂, f₁))
151-
return (f₁′, f₂′) => conj(coeff)
152-
end
153-
154-
# `n` bends of a tree pair that stays a single tree pair, and the product of their coefficients
155-
_bend_single(bend, f, ::Val{0}) = f => one(sectorscalartype(sectortype(f)))
156-
function _bend_single(bend, f, ::Val{n}) where {n}
157-
f′, c′ = bend(f)
158-
f″, c″ = _bend_single(bend, f′, Val(n - 1))
159-
return f″ => c′ * c″
160-
end
161144

162145
# !! note that this is more or less a copy of bendright through
163146
# (f1, f2) => conj(coeff) for ((f2, f1), coeff) in bendleft(src)
@@ -499,7 +482,7 @@ function _repartition_body(N, canonical = true)
499482
if N == 0
500483
ex = quote
501484
T = fusionscalartype(sectortype(src))
502-
if FusionStyle(src) === UniqueFusion()
485+
if src isa FusionTreePair
503486
return src => one(T)
504487
else
505488
U = copyto!(zeros(T, length(src), length(src)), LinearAlgebra.I)

0 commit comments

Comments
 (0)