Skip to content

Commit 8e8029a

Browse files
leburgelclaude
authored andcommitted
Only try coupled sectors whose units match the ends of the other side
For several units, a coupled sector of a block must be compatible with the units at both ends of either side; otherwise the fusion tree iterator throws instead of being empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 994eab4 commit 8e8029a

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎src/fusiontrees/fusiontrees.jl‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,20 @@ function FusionTreeBlock{I}(
143143
# a superset of the coupled sectors suffices, as there are no fusion trees for the others:
144144
# the unit of the other side, or the fusion product of the shorter side, which avoids that of
145145
# the longer side (`vec`: products of `ProductSector`s have a shape)
146-
cs = if N₁ == 0
147-
[leftunit(first(uncoupled[2]))]
148-
elseif N₂ == 0
149-
[leftunit(first(uncoupled[1]))]
146+
cs = if N₁ == 0 || N₂ == 0
147+
# the only unit that can couple: on the left of the first and on the right of the last sector
148+
us = N₁ == 0 ? uncoupled[2] : uncoupled[1]
149+
leftunit(first(us)) == rightunit(last(us)) ? [leftunit(first(us))] : I[]
150150
else
151151
sort!(vec(collect(⊗(uncoupled[N₁ <= N₂ ? 1 : 2]...))))
152152
end
153153

154154
for c in cs
155155
# the shorter side has fusion trees for every candidate, the longer side not necessarily
156+
# (with several units, `c` must also have the units at the ends of the longer side)
157+
us = N₁ <= N₂ ? uncoupled[2] : uncoupled[1]
158+
UnitStyle(I) isa SimpleUnit || N₁ == 0 || N₂ == 0 ||
159+
(leftunit(c) == leftunit(first(us)) && rightunit(c) == rightunit(last(us))) || continue
156160
longer = N₁ <= N₂ ? fusiontrees(uncoupled[2], c, isdual[2]) : fusiontrees(uncoupled[1], c, isdual[1])
157161
isempty(longer) && continue
158162
for f₂ in fusiontrees(uncoupled[2], c, isdual[2]),

0 commit comments

Comments
 (0)