Skip to content

Commit 6993e67

Browse files
lkdvosclaude
andcommitted
Fill the vectors of the fusion tree blocks directly
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3929e81 commit 6993e67

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

‎src/spaces/homspace.jl‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,19 @@ function fusionblocks(W::HomSpace)
211211
I = sectortype(W)
212212
N₁, N₂ = numout(W), numin(W)
213213
F = fusiontreetype(I, N₁, N₂)
214-
# group the (cached) fusion trees of `W` by their uncoupled sectors, in the order in which
215-
# these first occur
216-
groups = Vector{F}[]
217-
group_of = Dict{Tuple{NTuple{N₁, I}, NTuple{N₂, I}}, Vector{F}}()
214+
# group the (cached) fusion trees of `W` by their uncoupled sectors,
215+
# in the order in which these first occur
216+
blocks = FusionTreeBlock{I, N₁, N₂, F}[]
217+
trees_of = Dict{Tuple{NTuple{N₁, I}, NTuple{N₂, I}}, Vector{F}}()
218218
for (f₁, f₂) in fusiontrees(W)
219-
group = get!(() -> push!(groups, F[])[end], group_of, (f₁.uncoupled, f₂.uncoupled))
220-
push!(group, (f₁, f₂))
219+
trees = get!(trees_of, (f₁.uncoupled, f₂.uncoupled)) do
220+
newtrees = F[]
221+
push!(blocks, FusionTreeBlock(newtrees))
222+
return newtrees
223+
end
224+
push!(trees, (f₁, f₂))
221225
end
222-
return map(FusionTreeBlock, groups)
226+
return blocks
223227
end
224228

225229
function diagonalblockstructure(W::HomSpace)

0 commit comments

Comments
 (0)