@@ -3,11 +3,11 @@ struct FusionTreeBlock{I,N₁,N₂,F<:FusionTreePair{I,N₁,N₂}}
3
3
end
4
4
5
5
function FusionTreeBlock {I} (uncoupled:: Tuple{NTuple{N₁,I},NTuple{N₂,I}} ,
6
- isdual:: Tuple{NTuple{N₁,Bool},NTuple{N₂,Bool}} ) where {I <: Sector ,
7
- N₁,N₂}
8
- F₁ = fusiontreetype (I, N₁)
9
- F₂ = fusiontreetype (I, N₂ )
10
- trees = Vector {Tuple{F₁,F₂}} (undef, 0 )
6
+ isdual:: Tuple{NTuple{N₁,Bool},NTuple{N₂,Bool}} ;
7
+ sizehint :: Int = 0 ) where {I <: Sector , N₁,N₂}
8
+ F = fusiontreetype (I, N₁, N₂ )
9
+ trees = Vector {F} (undef, 0 )
10
+ sizehint > 0 && sizehint! (trees, sizehint )
11
11
12
12
if N₁ == N₂ == 0
13
13
return FusionTreeBlock (trees)
@@ -97,7 +97,7 @@ function bendright(src::FusionTreeBlock)
97
97
N₂ = numin (src)
98
98
@assert N₁ > 0
99
99
100
- dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst)
100
+ dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst; sizehint = length (src) )
101
101
indexmap = treeindex_map (dst)
102
102
U = zeros (sectorscalartype (I), length (dst), length (src))
103
103
@@ -156,7 +156,7 @@ function bendleft(src::FusionTreeBlock)
156
156
N₂ = numout (src)
157
157
@assert N₁ > 0
158
158
159
- dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst)
159
+ dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst; sizehint = length (src) )
160
160
indexmap = treeindex_map (dst)
161
161
U = zeros (sectorscalartype (I), length (dst), length (src))
162
162
@@ -211,9 +211,8 @@ function foldright(src::FusionTreeBlock)
211
211
N₁ = numout (src)
212
212
N₂ = numin (src)
213
213
@assert N₁ > 0
214
- dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst)
215
214
216
- dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst)
215
+ dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst; sizehint = length (src) )
217
216
indexmap = treeindex_map (dst)
218
217
U = zeros (sectorscalartype (I), length (dst), length (src))
219
218
@@ -282,7 +281,7 @@ function foldleft(src::FusionTreeBlock)
282
281
N₂ = numout (src)
283
282
@assert N₁ > 0
284
283
285
- dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst)
284
+ dst = FusionTreeBlock {I} (uncoupled_dst, isdual_dst; sizehint = length (src) )
286
285
indexmap = treeindex_map (dst)
287
286
U = zeros (sectorscalartype (I), length (dst), length (src))
288
287
@@ -464,7 +463,7 @@ function artin_braid(src::FusionTreeBlock{I,N,0}, i; inv::Bool=false) where {I,N
464
463
isdual = src. isdual[1 ]
465
464
isdual′ = TupleTools. setindex (isdual, isdual[i], i + 1 )
466
465
isdual′ = TupleTools. setindex (isdual′, isdual[i + 1 ], i)
467
- dst = FusionTreeBlock {I} ((uncoupled′, ()), (isdual′, ()))
466
+ dst = FusionTreeBlock {I} ((uncoupled′, ()), (isdual′, ()); sizehint = length (src) )
468
467
469
468
oneT = one (sectorscalartype (I))
470
469
@@ -596,7 +595,7 @@ function braid(src::FusionTreeBlock{I,N,0}, p::NTuple{N,Int},
596
595
if FusionStyle (I) isa UniqueFusion && BraidingStyle (I) isa SymmetricBraiding
597
596
uncoupled′ = TupleTools. _permute (src. uncoupled[1 ], p)
598
597
isdual′ = TupleTools. _permute (src. isdual[1 ], p)
599
- dst = FusionTreeBlock {I} (uncoupled′, isdual′)
598
+ dst = FusionTreeBlock {I} (uncoupled′, isdual′; sizehint = length (src) )
600
599
U = transformation_matrix (dst, src) do (f₁, f₂)
601
600
return ((f₁′, f₂) => c for (f₁′, c) in braid (f₁, p, levels))
602
601
end
0 commit comments