Skip to content

Commit 184f4e9

Browse files
committed
extend braidingtensor tests
1 parent 70c5321 commit 184f4e9

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎test/tensors/braidingtensor.jl‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ for V_tuple in spacelist
1515
println("BraidingTensor planar contractions with symmetry: $Istr")
1616
println("---------------------------------------")
1717
@timedtestset "BraidingTensor planar contractions with symmetry: $Istr" verbose = true begin
18+
@timedtestset "planaradd! with BraidingTensor" begin
19+
b = BraidingTensor(V, V')
20+
bb = TensorMap(b)
21+
# Cyclic rotations of the planar leg cycle (cod1, cod2, dom2, dom1).
22+
# Use transpose (F-symbols only) as reference, since permute requires SymmetricBraiding.
23+
# rotation 0 (identity)
24+
@planar t1[-1 -2; -3 -4] := b[-1 -2; -3 -4]
25+
@test t1 ≈ bb
26+
# rotation 1: single-tree cycle (4,1,2,3) → (p1=(2,4), p2=(1,3))
27+
@planar t2[-1 -2; -3 -4] := b[-3 -1; -4 -2]
28+
@test t2 ≈ transpose(bb, ((2, 4), (1, 3)))
29+
# rotation 2: single-tree cycle (3,4,1,2) → (p1=(4,3), p2=(2,1))
30+
@planar t3[-1 -2; -3 -4] := b[-4 -3; -2 -1]
31+
@test t3 ≈ transpose(bb, ((4, 3), (2, 1)))
32+
# rotation 3: single-tree cycle (2,3,4,1) → (p1=(3,1), p2=(4,2))
33+
@planar t4[-1 -2; -3 -4] := b[-2 -4; -1 -3]
34+
@test t4 ≈ transpose(bb, ((3, 1), (4, 2)))
35+
# adjoint BraidingTensor (rotation 0)
36+
ba = b'
37+
@planar t5[-1 -2; -3 -4] := ba[-1 -2; -3 -4]
38+
@test t5 ≈ TensorMap(ba)
39+
end
40+
1841
@timedtestset "τ as left factor, all legs contracted" begin
1942
# BraidingTensor(V, V') on leading codomain indices
2043
ττ = TensorMap(BraidingTensor(V, V'))
@@ -196,6 +219,17 @@ for V_tuple in spacelist
196219
@test t1 ≈ t3
197220
@test t1 ≈ t4
198221
end
222+
223+
@timedtestset "BraidingTensor × BraidingTensor" begin
224+
# b1 domain == b2 codomain == V⊗V', straight-through (planar) contraction
225+
b1 = BraidingTensor(V, V') # space: V'⊗V ← V⊗V'
226+
b2 = BraidingTensor(V', V) # space: V⊗V' ← V'⊗V
227+
bb1 = TensorMap(b1)
228+
bb2 = TensorMap(b2)
229+
@planar t1[-1 -2; -3 -4] := b1[-1 -2; 1 2] * b2[1 2; -3 -4]
230+
@planar t2[-1 -2; -3 -4] := bb1[-1 -2; 1 2] * bb2[1 2; -3 -4]
231+
@test t1 ≈ t2
232+
end
199233
end
200234
TensorKit.empty_globalcaches!()
201235
end

0 commit comments

Comments
 (0)