12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ from inspect import signature
16
+
15
17
import numpy as np
16
18
import pytest
17
- from inspect import signature
19
+
18
20
from pyquil .quil import Program
19
21
from pyquil .simulation import matrices
20
22
from pyquil .simulation .tools import program_unitary
47
49
def test_gate_conversion ():
48
50
"""Check that the gates all convert with matching unitaries."""
49
51
for quil_gate , cirq_gate in SUPPORTED_GATES .items ():
50
- # pyquil has an error in the RYY defintion
51
- if quil_gate == "RYY" :
52
- continue
53
52
if quil_gate in PARAMETRIC_TRANSFORMERS :
54
53
pyquil_def = getattr (matrices , quil_gate )
55
54
sig = signature (pyquil_def )
@@ -93,6 +92,7 @@ def test_gate_conversion():
93
92
XY(pi/2) 1 2
94
93
RZZ(pi/2) 0 1
95
94
RXX(pi/2) 1 2
95
+ RYY(pi/2) 0 2
96
96
FSIM(pi/4, pi/8) 1 2
97
97
PHASEDFSIM(pi/4, -pi/6, pi/2, pi/3, pi/8) 0 1
98
98
CCNOT 0 1 2
@@ -135,6 +135,7 @@ def test_circuit_from_quil():
135
135
ISwapPowGate (exponent = 1 / 2 , global_shift = 0.0 )(q1 , q2 ),
136
136
ZZPowGate (exponent = 1 / 2 , global_shift = - 0.5 )(q0 , q1 ),
137
137
XXPowGate (exponent = 1 / 2 , global_shift = - 0.5 )(q1 , q2 ),
138
+ YYPowGate (exponent = 1 / 2 , global_shift = - 0.5 )(q0 , q2 ),
138
139
FSimGate (theta = - np .pi / 8 , phi = - np .pi / 8 )(q1 , q2 ),
139
140
PhasedFSimGate (
140
141
theta = - np .pi / 8 , zeta = - np .pi / 6 , chi = np .pi / 2 , gamma = np .pi / 3 , phi = - np .pi / 8
@@ -149,8 +150,6 @@ def test_circuit_from_quil():
149
150
# build the same Circuit, using Quil
150
151
quil_circuit = circuit_from_quil (Program (QUIL_PROGRAM ))
151
152
# test Circuit equivalence
152
- print (cirq_circuit )
153
- print (quil_circuit )
154
153
assert cirq_circuit == quil_circuit
155
154
156
155
pyquil_circuit = Program (QUIL_PROGRAM )
0 commit comments