Open
Description
There is a bug transpiling Cirq circuits containing the XXPowGate
, YYPowGate
or ZZPowGate
to pyQuil. Below is a self-contained example showing the bug for the XXPowGate
:
import cirq
from qbraid.transpiler import transpile
from qbraid.interface import circuits_allclose
# Create a quantum circuit with two qubits
q0, q1 = cirq.LineQubit.range(2)
cirq_in = cirq.Circuit()
# Add XX, YY, and ZZ gates to the circuit
exponents = [0.5, 1]
for theta in exponents:
cirq_in.append(cirq.XXPowGate(exponent=theta).on(q0, q1))
pyquil_program = transpile(cirq_in, "pyquil")
cirq_out = transpile(pyquil_program, "cirq")
cirq_roundtrip_equal = circuits_allclose(cirq_in, cirq_out)
print(f"Cirq input:\n{cirq_in}\n")
print(f"Cirq -> pyQuil:\n{pyquil_program}\n")
print(f"pyQuil -> Cirq:\n{cirq_out}\n")
print(f"Cirq expected output:\n{cirq_in}\n")
print(f"Cirq roundtrip unitaries equal: {cirq_roundtrip_equal}")
Cirq input:
0: ───XX───────XX───
│ │
1: ───XX^0.5───XX───
Cirq -> pyQuil:
RX(pi/2) 0
RX(pi/2) 1
X 0
X 1
pyQuil -> Cirq:
0: ───Rx(0.5π)───X───
1: ───Rx(0.5π)───X───
Cirq expected output:
0: ───XX───────XX───
│ │
1: ───XX^0.5───XX───
Cirq roundtrip unitaries equal: False
Activity