@@ -397,40 +397,34 @@ for V in spacelist
397397 @timedtestset " Index flipping: test flipping inverse" begin
398398 t = CUDA. rand (ComplexF64, V1 ⊗ V1' ← V1' ⊗ V1)
399399 for i in 1 : 4
400- CUDA. @allowscalar begin
401- @test t ≈ flip (flip (t, i), i; inv = true )
402- @test t ≈ flip (flip (t, i; inv = true ), i)
403- end
400+ @test t ≈ flip (flip (t, i), i; inv = true )
401+ @test t ≈ flip (flip (t, i; inv = true ), i)
404402 end
405403 end
406404 @timedtestset " Index flipping: test via explicit flip" begin
407405 t = CUDA. rand (ComplexF64, V1 ⊗ V1' ← V1' ⊗ V1)
408- F1 = adapt (CuArray, unitary (flip (V1), V1))
406+ F1 = adapt (CuArray{ComplexF64} , unitary (flip (V1), V1))
409407
410- CUDA. @allowscalar begin
411- @tensor tf[a, b; c, d] := F1[a, a' ] * t[a' , b; c, d]
412- @test flip (t, 1 ) ≈ tf
413- @tensor tf[a, b; c, d] := conj (F1[b, b' ]) * t[a, b' ; c, d]
414- @test twist! (flip (t, 2 ), 2 ) ≈ tf
415- @tensor tf[a, b; c, d] := F1[c, c' ] * t[a, b; c' , d]
416- @test flip (t, 3 ) ≈ tf
417- @tensor tf[a, b; c, d] := conj (F1[d, d' ]) * t[a, b; c, d' ]
418- @test twist! (flip (t, 4 ), 4 ) ≈ tf
419- end
408+ @tensor tf[a, b; c, d] := F1[a, a' ] * t[a' , b; c, d]
409+ @test flip (t, 1 ) ≈ tf
410+ @tensor tf[a, b; c, d] := conj (F1[b, b' ]) * t[a, b' ; c, d]
411+ @test twist! (flip (t, 2 ), 2 ) ≈ tf
412+ @tensor tf[a, b; c, d] := F1[c, c' ] * t[a, b; c' , d]
413+ @test flip (t, 3 ) ≈ tf
414+ @tensor tf[a, b; c, d] := conj (F1[d, d' ]) * t[a, b; c, d' ]
415+ @test twist! (flip (t, 4 ), 4 ) ≈ tf
420416 end
421417 @timedtestset " Index flipping: test via contraction" begin
422418 t1 = CUDA. rand (ComplexF64, V1 ⊗ V2 ⊗ V3 ← V4)
423419 t2 = CUDA. rand (ComplexF64, V2' ⊗ V5 ← V4' ⊗ V1)
424- CUDA. @allowscalar begin
425- @tensor ta[a, b] := t1[x, y, a, z] * t2[y, b, z, x]
426- @tensor tb[a, b] := flip (t1, 1 )[x, y, a, z] * flip (t2, 4 )[y, b, z, x]
427- @test ta ≈ tb
428- @tensor tb[a, b] := flip (t1, (2 , 4 ))[x, y, a, z] * flip (t2, (1 , 3 ))[y, b, z, x]
429- @test ta ≈ tb
430- @tensor tb[a, b] := flip (t1, (1 , 2 , 4 ))[x, y, a, z] * flip (t2, (1 , 3 , 4 ))[y, b, z, x]
431- @tensor tb[a, b] := flip (t1, (1 , 3 ))[x, y, a, z] * flip (t2, (2 , 4 ))[y, b, z, x]
432- @test flip (ta, (1 , 2 )) ≈ tb
433- end
420+ @tensor ta[a, b] := t1[x, y, a, z] * t2[y, b, z, x]
421+ @tensor tb[a, b] := flip (t1, 1 )[x, y, a, z] * flip (t2, 4 )[y, b, z, x]
422+ @test ta ≈ tb
423+ @tensor tb[a, b] := flip (t1, (2 , 4 ))[x, y, a, z] * flip (t2, (1 , 3 ))[y, b, z, x]
424+ @test ta ≈ tb
425+ @tensor tb[a, b] := flip (t1, (1 , 2 , 4 ))[x, y, a, z] * flip (t2, (1 , 3 , 4 ))[y, b, z, x]
426+ @tensor tb[a, b] := flip (t1, (1 , 3 ))[x, y, a, z] * flip (t2, (2 , 4 ))[y, b, z, x]
427+ @test flip (ta, (1 , 2 )) ≈ tb
434428 end
435429 @timedtestset " Multiplication of isometries: test properties" begin
436430 W2 = V4 ⊗ V5
0 commit comments