@@ -2,10 +2,13 @@ using Test
2
2
3
3
import FastMPOContractions as FMPOC
4
4
using ITensors
5
+ using Random
5
6
7
+ algs = [" densitymatrix" , " fit" , " zipup" ]
6
8
9
+ @testset " MPO-MPO contraction (x-y-z)" for alg in algs
10
+ Random. seed! (1234 )
7
11
8
- @testset " densitymatrix (x-y-z)" begin
9
12
R = 3
10
13
sitesx = [Index (2 , " Qubit,x=$n " ) for n = 1 : R]
11
14
sitesy = [Index (2 , " Qubit,y=$n " ) for n = 1 : R]
@@ -16,11 +19,11 @@ using ITensors
16
19
a = _random_mpo (sitesa)
17
20
b = _random_mpo (sitesb)
18
21
ab_ref = contract (a, b; alg = " naive" )
19
- ab = FMPOC. contract_densitymatrix (a, b)
22
+ ab = FMPOC. contract_mpo_mpo (a, b; alg = alg )
20
23
@test ab_ref ≈ ab
21
24
end
22
25
23
- @testset " densitymatrix (xk-y-z)" begin
26
+ @testset " MPO-MPO contraction (xk-y-z)" for alg in algs
24
27
R = 3
25
28
sitesx = [Index (2 , " Qubit,x=$n " ) for n = 1 : R]
26
29
sitesk = [Index (2 , " Qubit,k=$n " ) for n = 1 : R]
32
35
a = _random_mpo (sitesa)
33
36
b = _random_mpo (sitesb)
34
37
ab_ref = contract (a, b; alg = " naive" )
35
- ab = FMPOC. contract_densitymatrix (a, b)
38
+ ab = FMPOC. contract_mpo_mpo (a, b; alg = alg )
36
39
@test ab_ref ≈ ab
37
40
end
38
41
39
- @testset " densitymatrix (xk-y-zl)" begin
42
+ @testset " MPO-MPO contraction (xk-y-zl)" for alg in algs
40
43
R = 3
41
44
sitesx = [Index (2 , " Qubit,x=$n " ) for n = 1 : R]
42
45
sitesk = [Index (2 , " Qubit,k=$n " ) for n = 1 : R]
49
52
a = _random_mpo (sitesa)
50
53
b = _random_mpo (sitesb)
51
54
ab_ref = contract (a, b; alg = " naive" )
52
- ab = FMPOC. contract_densitymatrix (a, b)
55
+ ab = FMPOC. contract_mpo_mpo (a, b; alg = alg )
53
56
@test ab_ref ≈ ab
54
57
end
55
58
56
- @testset " densitymatrix (xk-ym-zl)" begin
59
+ @testset " MPO-MPO contraction (xk-ym-zl)" for alg in algs
57
60
R = 3
58
61
sitesx = [Index (2 , " Qubit,x=$n " ) for n = 1 : R]
59
62
sitesk = [Index (2 , " Qubit,k=$n " ) for n = 1 : R]
67
70
a = _random_mpo (sitesa)
68
71
b = _random_mpo (sitesb)
69
72
ab_ref = contract (a, b; alg = " naive" )
70
- ab = FMPOC. contract_densitymatrix (a, b)
73
+ ab = FMPOC. contract_mpo_mpo (a, b; alg = alg )
71
74
@test ab_ref ≈ ab
72
75
end
0 commit comments