-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathnew_export_cirq.js
97 lines (93 loc) · 2.02 KB
/
new_export_cirq.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var QuantumCircuit = require("../../lib/quantum-circuit.js");
var circuit = new QuantumCircuit();
circuit.addGate("id", -1, 0);
circuit.addGate("x", -1, 0);
circuit.addGate("y", -1, 0);
circuit.addGate("z", -1, 0);
circuit.addGate("h", -1, 0);
circuit.addGate("srn", -1, 0);
circuit.addGate("r2", -1, 0);
circuit.addGate("r4", -1, 0);
circuit.addGate("r8", -1, 0);
circuit.addGate("rx", -1, 0, {
params: {
theta: "pi/2"
}
});
circuit.addGate("ry", -1, 0, {
params: {
theta: "pi/2"
}
});
circuit.addGate("rz", -1, 0, {
params: {
phi: "pi/2"
}
});
circuit.addGate("u1", -1, 0, {
params: {
lambda: "pi/2"
}
});
circuit.addGate("u2", -1, 0, {
params: {
phi: "pi/2",
lambda: "pi/2"
}
});
circuit.addGate("u3", -1, 0, {
params: {
theta: "pi/2",
phi: "pi/2",
lambda: "pi/2"
}
});
circuit.addGate("s", -1, 0);
circuit.addGate("t", -1, 0);
circuit.addGate("sdg", -1, 0);
circuit.addGate("tdg", -1, 0);
circuit.addGate("swap", -1, [0, 1]);
circuit.addGate("srswap", -1, [0, 1]);
circuit.addGate("cx", -1, [0, 1]);
circuit.addGate("cz", -1, [0, 1]);
circuit.addGate("ms", -1, [0, 1], {
params: {
theta: "pi/2"
}
});
circuit.addGate("cr2", -1, [0, 1]);
circuit.addGate("cr4", -1, [0, 1]);
circuit.addGate("cr8", -1, [0, 1]);
circuit.addGate("crz", -1, [0, 1], {
params: {
phi: "pi/2"
}
});
circuit.addGate("cu1", -1, [0, 1], {
params: {
lambda: "pi/2"
}
});
circuit.addGate("cu2", -1, [0, 1], {
params: {
phi: "pi/2",
lambda: "pi/2"
}
});
circuit.addGate("cu3", -1, [0, 1], {
params: {
theta: "pi/2",
phi: "pi/2",
lambda: "pi/2"
}
});
circuit.addGate("cs", -1, [0, 1]);
circuit.addGate("ct", -1, [0, 1]);
circuit.addGate("csdg", -1, [0, 1]);
circuit.addGate("ctdg", -1, [0, 1]);
circuit.addGate("ccx", -1, [0, 1, 2]);
circuit.addGate("cswap", -1, [0, 1, 2]);
circuit.addMeasure(0, "c", 3);
circuit.run();
console.log("");
console.log(circuit.exportCirq());