I am interested in using the QASM2Cirq methods to make this gate: u2(0, np.pi, q[0]).
How can I build that object using Cirq rather than QASM string value passed onto cirq.
Quantum Computing Stack Exchange is a question and answer site for engineers, scientists, programmers, and computing professionals interested in quantum computing. It only takes a minute to sign up.
Sign up to join this communityI am interested in using the QASM2Cirq methods to make this gate: u2(0, np.pi, q[0]).
How can I build that object using Cirq rather than QASM string value passed onto cirq.
From the spec, $U_2(\phi, \lambda) = U ( \frac{\pi}{2}, \phi, \lambda)$. We can use Cirq's QasmUGate.
import cirq
from cirq.circuits.qasm_output import QasmUGate
q0 = cirq.NamedQubit('q[0]')
u2_gate = QasmUGate(0.5, 0, 1) # The angles are normalized to the range [0, 2) half_turns
circuit = cirq.Circuit(u2_gate(q0))