Skip to content

Commit 98294e7

Browse files
committed
use contract for outer product
1 parent 20d5ff5 commit 98294e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/fusiontensor/array_cast.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ function contract_fusion_trees(ft::FusionTensor, f1::SectorFusionTree, f2::Secto
183183
charge_block = view(ft, f1, f2)
184184
p = contract_singlet_projector(f1, f2)
185185

186-
# TODO use contract once it supports outer product
187-
swapped = reshape(charge_block, :, 1) * reshape(p, 1, :)
188-
block_shape = (size(charge_block)..., size(p)...)
186+
# outer product of charge block and fusion tree
187+
labels1 = ntuple(identity, N)
188+
labels2 = ntuple(i -> i + N, N)
189189
perm = braid_tuples(ntuple(identity, N), ntuple(i -> i + N, N))
190-
split_array_block = permutedims(reshape(swapped, block_shape), perm)
190+
split_array_block = contract(perm, charge_block, labels1, p, labels2)
191191

192192
return merge_degen_dims(split_array_block)
193193
end

0 commit comments

Comments
 (0)