|
1 | 1 | include("benchtools.jl")
|
2 | 2 | module ITensorsTimers
|
3 |
| - using ITensors |
4 |
| - import ..Timers |
| 3 | +using ITensors |
| 4 | +using ..Timers: Timers |
5 | 5 |
|
6 |
| - function add_indexlabels_as_tags(tensor, labels) |
7 |
| - new_inds = map(x -> settags(x[2], "l$(x[1])"), zip(labels, tensor.inds)) |
8 |
| - return ITensor(tensor.store, new_inds) |
9 |
| - end |
| 6 | +function add_indexlabels_as_tags(tensor, labels) |
| 7 | + new_inds = map(x -> settags(x[2], "l$(x[1])"), zip(labels, tensor.inds)) |
| 8 | + return ITensor(tensor.store, new_inds) |
| 9 | +end |
10 | 10 |
|
11 |
| - function mpo_timer(T = Float64; Vmpo, Vmps, Vphys) |
12 |
| - A = randomITensor(T, Vmps, Vphys, dag(Vmps)) |
13 |
| - M = randomITensor(T, Vmpo, Vphys, dag(Vphys), dag(Vmpo)) |
14 |
| - FL = randomITensor(T, Vmps, dag(Vmpo), dag(Vmps)) |
15 |
| - FR = randomITensor(T, Vmps, Vmpo, dag(Vmps)) |
| 11 | +function mpo_timer(T=Float64; Vmpo, Vmps, Vphys) |
| 12 | + A = randomITensor(T, Vmps, Vphys, dag(Vmps)) |
| 13 | + M = randomITensor(T, Vmpo, Vphys, dag(Vphys), dag(Vmpo)) |
| 14 | + FL = randomITensor(T, Vmps, dag(Vmpo), dag(Vmps)) |
| 15 | + FR = randomITensor(T, Vmps, Vmpo, dag(Vmps)) |
16 | 16 |
|
17 |
| - FL1 = add_indexlabels_as_tags(FL, (4, 2, 1)) |
18 |
| - A1 = add_indexlabels_as_tags(A, (1, 3, 6)) |
19 |
| - M1 = add_indexlabels_as_tags(M, (2, 5, 3, 7)) |
20 |
| - A2 = add_indexlabels_as_tags(A, (4, 5, 8)) |
21 |
| - FR1 = add_indexlabels_as_tags(FR, (6, 7, 8)) |
| 17 | + FL1 = add_indexlabels_as_tags(FL, (4, 2, 1)) |
| 18 | + A1 = add_indexlabels_as_tags(A, (1, 3, 6)) |
| 19 | + M1 = add_indexlabels_as_tags(M, (2, 5, 3, 7)) |
| 20 | + A2 = add_indexlabels_as_tags(A, (4, 5, 8)) |
| 21 | + FR1 = add_indexlabels_as_tags(FR, (6, 7, 8)) |
22 | 22 |
|
23 |
| - return Timers.Timer(A1, A2, M1, FL1, FR1) do A1, A2, M1, FL1, FR1 |
24 |
| - C = ((((FL1*A1)*M1)*dag(A2))*FR1) |
25 |
| - return C[] |
26 |
| - end |
| 23 | + return Timers.Timer(A1, A2, M1, FL1, FR1) do A1, A2, M1, FL1, FR1 |
| 24 | + C = ((((FL1 * A1) * M1) * dag(A2)) * FR1) |
| 25 | + return C[] |
27 | 26 | end
|
| 27 | +end |
28 | 28 |
|
29 |
| - function pepo_timer(T = Float64; Vpepo, Vpeps, Venv, Vphys) |
30 |
| - Vpeps′ = dag(Vpeps) |
31 |
| - Vpepo′ = dag(Vpepo) |
32 |
| - Venv′ = dag(Venv) |
33 |
| - Vphys′ = dag(Vphys) |
| 29 | +function pepo_timer(T=Float64; Vpepo, Vpeps, Venv, Vphys) |
| 30 | + Vpeps′ = dag(Vpeps) |
| 31 | + Vpepo′ = dag(Vpepo) |
| 32 | + Venv′ = dag(Venv) |
| 33 | + Vphys′ = dag(Vphys) |
34 | 34 |
|
35 |
| - A = randomITensor(T, Vpeps, Vpeps, Vphys, Vpeps′, Vpeps′) |
36 |
| - P = randomITensor(T, Vpepo, Vpepo, Vphys, Vphys′, Vpepo′, Vpepo′) |
37 |
| - FL = randomITensor(T, Venv, Vpeps, Vpepo′, Vpeps′, Venv′) |
38 |
| - FD = randomITensor(T, Venv, Vpeps, Vpepo′, Vpeps′, Venv′) |
39 |
| - FR = randomITensor(T, Venv, Vpeps, Vpepo, Vpeps′, Venv′) |
40 |
| - FU = randomITensor(T, Venv, Vpeps, Vpepo, Vpeps′, Venv′) |
| 35 | + A = randomITensor(T, Vpeps, Vpeps, Vphys, Vpeps′, Vpeps′) |
| 36 | + P = randomITensor(T, Vpepo, Vpepo, Vphys, Vphys′, Vpepo′, Vpepo′) |
| 37 | + FL = randomITensor(T, Venv, Vpeps, Vpepo′, Vpeps′, Venv′) |
| 38 | + FD = randomITensor(T, Venv, Vpeps, Vpepo′, Vpeps′, Venv′) |
| 39 | + FR = randomITensor(T, Venv, Vpeps, Vpepo, Vpeps′, Venv′) |
| 40 | + FU = randomITensor(T, Venv, Vpeps, Vpepo, Vpeps′, Venv′) |
41 | 41 |
|
42 |
| - FL1 = add_indexlabels_as_tags(FL, (18, 7, 4, 2, 1)) |
43 |
| - FU1 = add_indexlabels_as_tags(FU, (1, 3, 6, 9, 10)) |
44 |
| - A1 = add_indexlabels_as_tags(A, (2, 17, 5, 3, 11)) |
45 |
| - P1 = add_indexlabels_as_tags(P, (4, 16, 8, 5, 6, 12)) |
46 |
| - A2 = add_indexlabels_as_tags(A, (7, 15, 8, 9, 13)) |
47 |
| - FR1 = add_indexlabels_as_tags(FR, (10, 11, 12, 13, 14)) |
48 |
| - FD1 = add_indexlabels_as_tags(FD, (14, 15, 16, 17, 18)) |
| 42 | + FL1 = add_indexlabels_as_tags(FL, (18, 7, 4, 2, 1)) |
| 43 | + FU1 = add_indexlabels_as_tags(FU, (1, 3, 6, 9, 10)) |
| 44 | + A1 = add_indexlabels_as_tags(A, (2, 17, 5, 3, 11)) |
| 45 | + P1 = add_indexlabels_as_tags(P, (4, 16, 8, 5, 6, 12)) |
| 46 | + A2 = add_indexlabels_as_tags(A, (7, 15, 8, 9, 13)) |
| 47 | + FR1 = add_indexlabels_as_tags(FR, (10, 11, 12, 13, 14)) |
| 48 | + FD1 = add_indexlabels_as_tags(FD, (14, 15, 16, 17, 18)) |
49 | 49 |
|
50 |
| - return Timers.Timer(A1, A2, P1, FL1, FD1, FR1, FU1) do A1, A2, P1, FL1, FD1, FR1, FU1 |
51 |
| - C = (((((FL1*FU1)*A1)*P1)*dag(A2))*FR1)*FD1 |
52 |
| - return C[] |
53 |
| - end |
| 50 | + return Timers.Timer(A1, A2, P1, FL1, FD1, FR1, FU1) do A1, A2, P1, FL1, FD1, FR1, FU1 |
| 51 | + C = (((((FL1 * FU1) * A1) * P1) * dag(A2)) * FR1) * FD1 |
| 52 | + return C[] |
54 | 53 | end
|
| 54 | +end |
55 | 55 |
|
56 |
| - function mera_timer(T = Float64; Vmera) |
57 |
| - Vmera′ = dag(Vmera); |
| 56 | +function mera_timer(T=Float64; Vmera) |
| 57 | + Vmera′ = dag(Vmera) |
58 | 58 |
|
59 |
| - u = randomITensor(T, Vmera, Vmera, Vmera′, Vmera′) |
60 |
| - w = randomITensor(T, Vmera, Vmera, Vmera′) |
61 |
| - ρ = randomITensor(T, Vmera, Vmera, Vmera, Vmera′, Vmera′, Vmera′) |
62 |
| - h = randomITensor(T, Vmera, Vmera, Vmera, Vmera′, Vmera′, Vmera′) |
| 59 | + u = randomITensor(T, Vmera, Vmera, Vmera′, Vmera′) |
| 60 | + w = randomITensor(T, Vmera, Vmera, Vmera′) |
| 61 | + ρ = randomITensor(T, Vmera, Vmera, Vmera, Vmera′, Vmera′, Vmera′) |
| 62 | + h = randomITensor(T, Vmera, Vmera, Vmera, Vmera′, Vmera′, Vmera′) |
63 | 63 |
|
64 |
| - h1 = add_indexlabels_as_tags(h, (9, 3, 4, 5, 1, 2)) |
65 |
| - u1 = add_indexlabels_as_tags(u, (1, 2, 7, 12)) |
66 |
| - u2 = add_indexlabels_as_tags(u, (3, 4, 11, 13)) |
67 |
| - u3 = add_indexlabels_as_tags(u, (8, 5, 15, 6)) |
68 |
| - w1 = add_indexlabels_as_tags(w, (6, 7, 19)) |
69 |
| - u4 = add_indexlabels_as_tags(u, (8, 9, 17, 10)) |
70 |
| - w2 = add_indexlabels_as_tags(w, (10, 11, 22)) |
71 |
| - w3 = add_indexlabels_as_tags(w, (12, 14, 20)) |
72 |
| - w4 = add_indexlabels_as_tags(w, (13, 14, 23)) |
73 |
| - ρ1 = add_indexlabels_as_tags(ρ, (18, 19, 20, 21, 22, 23)) |
74 |
| - w5 = add_indexlabels_as_tags(w, (16, 15, 18)) |
75 |
| - w6 = add_indexlabels_as_tags(w, (16, 17, 21)) |
| 64 | + h1 = add_indexlabels_as_tags(h, (9, 3, 4, 5, 1, 2)) |
| 65 | + u1 = add_indexlabels_as_tags(u, (1, 2, 7, 12)) |
| 66 | + u2 = add_indexlabels_as_tags(u, (3, 4, 11, 13)) |
| 67 | + u3 = add_indexlabels_as_tags(u, (8, 5, 15, 6)) |
| 68 | + w1 = add_indexlabels_as_tags(w, (6, 7, 19)) |
| 69 | + u4 = add_indexlabels_as_tags(u, (8, 9, 17, 10)) |
| 70 | + w2 = add_indexlabels_as_tags(w, (10, 11, 22)) |
| 71 | + w3 = add_indexlabels_as_tags(w, (12, 14, 20)) |
| 72 | + w4 = add_indexlabels_as_tags(w, (13, 14, 23)) |
| 73 | + ρ1 = add_indexlabels_as_tags(ρ, (18, 19, 20, 21, 22, 23)) |
| 74 | + w5 = add_indexlabels_as_tags(w, (16, 15, 18)) |
| 75 | + w6 = add_indexlabels_as_tags(w, (16, 17, 21)) |
76 | 76 |
|
77 |
| - return Timers.Timer(u1, u2, u3, u4, w1, w2, w3, w4, w5, w6, ρ1, h1) do u1, u2, u3, u4, w1, w2, w3, w4, w5, w6, ρ1, h1 |
78 |
| - C = (((((( (h1*u1) * dag(u2) ) * |
79 |
| - (u3*w1) ) * |
80 |
| - (dag(u4)*dag(w2)) ) * |
81 |
| - ( (w3 * dag(w4)) * ρ1)) * w5) * dag(w6)) |
82 |
| - return C |
83 |
| - end |
| 77 | + return Timers.Timer(u1, u2, u3, u4, w1, w2, w3, w4, w5, w6, ρ1, |
| 78 | + h1) do u1, u2, u3, u4, w1, w2, w3, w4, w5, w6, ρ1, h1 |
| 79 | + C = (((((((h1 * u1) * dag(u2)) * |
| 80 | + (u3 * w1)) * |
| 81 | + (dag(u4) * dag(w2))) * |
| 82 | + ((w3 * dag(w4)) * ρ1)) * w5) * dag(w6)) |
| 83 | + return C |
84 | 84 | end
|
85 | 85 | end
|
| 86 | +end |
0 commit comments