@@ -326,22 +326,33 @@ for V in spacelist
326326 @test HrA12array ≈ convert (Array, HrA12)
327327 end
328328 end
329- if BraidingStyle (I) isa Bosonic # TODO : add fermionic tests by including parity tensors
330- @timedtestset " Index flipping: test via contraction" begin
331- t1 = rand (ComplexF64, V1 ⊗ V2 ⊗ V3 ← V4)
332- t2 = rand (ComplexF64, V2' ⊗ V5 ← V4' ⊗ V1)
333- @tensor ta[a, b] := t1[x, y, a, z] * t2[y, b, z, x]
334- @tensor tb[a, b] := flip (t1, 1 )[x, y, a, z] * flip (t2, 4 )[y, b, z, x]
335- @test ta ≈ tb
336- @tensor tb[a, b] := flip (t1, (2 , 4 ))[x, y, a, z] *
337- flip (t2, (1 , 3 ))[y, b, z, x]
338- @test ta ≈ tb
339- @tensor tb[a, b] := flip (t1, (1 , 2 , 4 ))[x, y, a, z] *
340- flip (t2, (1 , 3 , 4 ))[y, b, z, x]
341- @tensor tb[a, b] := flip (t1, (1 , 3 ))[x, y, a, z] *
342- flip (t2, (2 , 4 ))[y, b, z, x]
343- @test flip (ta, (1 , 2 )) ≈ tb
344- end
329+ @timedtestset " Index flipping: test via explicit flip" begin
330+ t = rand (ComplexF64, V1 ⊗ V1' ← V1' ⊗ V1)
331+ F1 = unitary (flip (V1), V1)
332+
333+ @tensor tf[a, b; c, d] := F1[a, a' ] * t[a' , b; c, d]
334+ @test flip (t, 1 ) ≈ tf
335+ @tensor tf[a, b; c, d] := conj (F1[b, b' ]) * t[a, b' ; c, d]
336+ @test twist! (flip (t, 2 ), 2 ) ≈ tf
337+ @tensor tf[a, b; c, d] := F1[c, c' ] * t[a, b; c' , d]
338+ @test flip (t, 3 ) ≈ tf
339+ @tensor tf[a, b; c, d] := conj (F1[d, d' ]) * t[a, b; c, d' ]
340+ @test twist! (flip (t, 4 ), 4 ) ≈ tf
341+ end
342+ @timedtestset " Index flipping: test via contraction" begin
343+ t1 = rand (ComplexF64, V1 ⊗ V2 ⊗ V3 ← V4)
344+ t2 = rand (ComplexF64, V2' ⊗ V5 ← V4' ⊗ V1)
345+ @tensor ta[a, b] := t1[x, y, a, z] * t2[y, b, z, x]
346+ @tensor tb[a, b] := flip (t1, 1 )[x, y, a, z] * flip (t2, 4 )[y, b, z, x]
347+ @test ta ≈ tb
348+ @tensor tb[a, b] := flip (t1, (2 , 4 ))[x, y, a, z] *
349+ flip (t2, (1 , 3 ))[y, b, z, x]
350+ @test ta ≈ tb
351+ @tensor tb[a, b] := flip (t1, (1 , 2 , 4 ))[x, y, a, z] *
352+ flip (t2, (1 , 3 , 4 ))[y, b, z, x]
353+ @tensor tb[a, b] := flip (t1, (1 , 3 ))[x, y, a, z] *
354+ flip (t2, (2 , 4 ))[y, b, z, x]
355+ @test flip (ta, (1 , 2 )) ≈ tb
345356 end
346357 @timedtestset " Multiplication of isometries: test properties" begin
347358 W2 = V4 ⊗ V5
0 commit comments