When converting a PyQuil program to a Cirq circuit using the cirq_rigetti.circuit_from_quil function the output differs between cirq versions 1.4.1 and 1.3.0. Specifically, in cirq==1.4.1, the CPHASE00 gate is converted into a custom USERGATE gate with complex matrix elements, while in cirq==1.3.0, the gate is correctly recognized and output as CPHASE00.
How to reproduce the issue
Create a file pyquil_conv.py with the following script.
from cirq_rigetti import circuit_from_quil
from cirq_rigetti.quil_output import QuilOutput
from pyquil import Program
QUIL_PROGRAM = """
RZ(pi/2) 0
CPHASE00(pi/2) 0 1
"""
p = Program(QUIL_PROGRAM)
circ = circuit_from_quil(p.out())
print(QuilOutput(circ.all_operations(), circ.all_qubits()))
Description of the issue
When converting a PyQuil program to a Cirq circuit using the
cirq_rigetti.circuit_from_quil
function the output differs betweencirq
versions 1.4.1 and 1.3.0. Specifically, incirq==1.4.1
, theCPHASE00
gate is converted into a customUSERGATE
gate with complex matrix elements, while incirq==1.3.0
, the gate is correctly recognized and output asCPHASE00
.How to reproduce the issue
Create a file
pyquil_conv.py
with the following script.Run the script with
cirq==1.4.1
Run the script with
cirq==1.3.0
Related
When adding support for pyquil v4 a similar example was found in https://github.com/quantumlib/Cirq/pull/6281#issuecomment-2075385259.