CY gate
The controlled-Y gate: matrix, truth table, the cy() call in Python and JS, and what it becomes on IonQ hardware.
The CY gate applies a Y gate to the target qubit when the control qubit is and leaves it unchanged when the control is . It acts on two qubits and takes no parameters. The Circuit panel draws a dot on the control wire joined to a Y box on the target wire. Measured straight away it flips the target exactly as a CX does; the phases show only once the qubits meet other gates.
Kets such as name the basis states and rotations are described on the Bloch sphere; the qubits lesson introduces both.
Call
| Where | Call |
|---|---|
| Python | qc.cy(control, target) |
| JS | circuit.cy(control, target) |
| Qiskit class | CYGate |
Matrix
The matrix uses the basis order , that is .
Qiskit numbers basis states with qubit 0 as the least significant bit, so Operator(CYGate()) prints the same gate in a different row and column order.
Effect on basis states
| Input | Output |
|---|---|
Measured straight away, CY flips the target exactly as CX does; the phases only matter once the qubits meet other gates. With the control in and the target in , CY produces the entangled state .
Inverse
CY is its own inverse. Two CY gates in a row on the same control and target cancel.
Usage
from qiskit import QuantumCircuit
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cy(0, 1)
qc.measure([0, 1], [0, 1])
import { QuantumCircuit } from 'qiskit';
const circuit = QuantumCircuit(2, 2);
circuit.h(0);
circuit.cy(0, 1);
circuit.measure([0, 1], [0, 1]);
On a noiseless simulator every shot reads 00 or 11, in close to equal numbers.
On IonQ hardware
CY is not a native gate. It is a CX with an Sdg before it and an S after it on the target, and those two are virtual Z rotations, so CY costs the same as CX: one entangling gate (MS on Aria, ZZ on Forte) plus single-qubit pulses, before IonQ's optimiser runs. See How your circuit is compiled.
Related
Stay in the loop.
Get the latest tutorials, demos, and project showcases straight to your inbox. No noise, just the good stuff.
Gates