# quantify_scheduler.operations.gate_library

Standard gateset for use with the quantify_scheduler.

## Module Contents

### Classes

 Rxy A single qubit rotation around an axis in the equator of the Bloch sphere. X A single qubit rotation of 180 degrees around the X-axis. X90 A single qubit rotation of 90 degrees around the X-axis. Y A single qubit rotation of 180 degrees around the Y-axis. Y90 A single qubit rotation of 90 degrees around the Y-axis. CNOT Conditional-NOT gate, a common entangling gate. CZ Conditional-phase gate, a common entangling gate. Reset Reset a qubit to the $$|0\rangle$$ state. Measure A projective measurement in the Z-basis.
class Rxy(theta: float, phi: float, qubit: str, data: Optional[dict] = None)[source]

A single qubit rotation around an axis in the equator of the Bloch sphere.

This operation can be represented by the following unitary as defined in https://doi.org/10.1109/TQE.2020.2965810:

$\begin{split}\mathsf {R}_{xy} \left(\theta, \varphi\right) = \begin{bmatrix} \textrm {cos}(\theta /2) & -ie^{-i\varphi }\textrm {sin}(\theta /2) \\ -ie^{i\varphi }\textrm {sin}(\theta /2) & \textrm {cos}(\theta /2) \end{bmatrix}\end{split}$

A single qubit rotation around an axis in the equator of the Bloch sphere.

Parameters:
• theta – rotation angle in degrees, will be casted to the [-180, 180) domain.

• phi – phase of the rotation axis, will be casted to the [0, 360) domain.

• qubit – the target qubit

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.

class X(qubit: str, data: Optional[dict] = None)[source]

Bases: Rxy

A single qubit rotation of 180 degrees around the X-axis.

This operation can be represented by the following unitary:

$\begin{split}X180 = R_{X180} = \begin{bmatrix} 0 & -i \\ -i & 0 \\ \end{bmatrix}\end{split}$
Parameters:
• qubit – the target qubit

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.

class X90(qubit: str, data: Optional[dict] = None)[source]

Bases: Rxy

A single qubit rotation of 90 degrees around the X-axis.

It is identical to the Rxy gate with theta=90 and phi=0

Defined by the unitary:

$\begin{split}X90 = R_{X90} = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & -i \\ -i & 1 \\ \end{bmatrix}\end{split}$

Create a new instance of X90.

Parameters:
• qubit – The target qubit.

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.

class Y(qubit: str, data: Optional[dict] = None)[source]

Bases: Rxy

A single qubit rotation of 180 degrees around the Y-axis.

It is identical to the Rxy gate with theta=180 and phi=90

Defined by the unitary:

$\begin{split}Y180 = R_{Y180} = \begin{bmatrix} 0 & -1 \\ 1 & 0 \\ \end{bmatrix}\end{split}$

Create a new instance of Y.

The Y gate corresponds to a rotation of 180 degrees around the y-axis in the single-qubit Bloch sphere.

Parameters:
• qubit – The target qubit.

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.

class Y90(qubit: str, data: Optional[dict] = None)[source]

Bases: Rxy

A single qubit rotation of 90 degrees around the Y-axis.

It is identical to the Rxy gate with theta=90 and phi=90

Defined by the unitary:

$\begin{split}Y90 = R_{Y90} = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & -1 \\ 1 & 1 \\ \end{bmatrix}\end{split}$

Create a new instance of Y90.

The Y gate corresponds to a rotation of 90 degrees around the y-axis in the single-qubit Bloch sphere.

Parameters:
• qubit – The target qubit.

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.

class CNOT(qC: str, qT: str, data: Optional[dict] = None)[source]

Conditional-NOT gate, a common entangling gate.

Performs an X gate on the target qubit qT conditional on the state of the control qubit qC.

This operation can be represented by the following unitary:

$\begin{split}\mathrm{CNOT} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{bmatrix}\end{split}$

Create a new instance of the two-qubit CNOT or Controlled-NOT gate.

The CNOT gate performs an X gate on the target qubit(qT) conditional on the state of the control qubit(qC).

Parameters:
• qC – The control qubit.

• qT – The target qubit

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.

class CZ(qC: str, qT: str, data: Optional[dict] = None)[source]

Conditional-phase gate, a common entangling gate.

Performs a Z gate on the target qubit qT conditional on the state of the control qubit qC.

This operation can be represented by the following unitary:

$\begin{split}\mathrm{CZ} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \\ \end{bmatrix}\end{split}$

Create a new instance of the two-qubit CZ or conditional-phase gate.

The CZ gate performs an Z gate on the target qubit(qT) conditional on the state of the control qubit(qC).

Parameters:
• qC – The control qubit.

• qT – The target qubit

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.

class Reset(*qubits: str, data: Optional[dict] = None)[source]

Reset a qubit to the $$|0\rangle$$ state.

The Reset gate is an idle operation that is used to initialize one or more qubits.

Note

Strictly speaking this is not a gate as it can not be described by a unitary.

Examples

The operation can be used in several ways:

from quantify_scheduler.operations.gate_library import Reset

reset_1 = Reset("q0")
reset_2 = Reset("q1", "q2")
reset_3 = Reset(*[f"q{i}" for i in range(3, 6)])


Create a new instance of Reset operation that is used to initialize one or more qubits.

Parameters:
• qubits – The qubit(s) to reset. NB one or more qubits can be specified, e.g., Reset("q0"), Reset("q0", "q1", "q2"), etc..

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.

class Measure(*qubits: str, acq_channel: Union[Tuple[int, Ellipsis], int] = None, acq_index: Union[Tuple[int, Ellipsis], int] = None, acq_protocol: Literal[SSBIntegrationComplex, Trace, TriggerCount, None] = None, bin_mode: quantify_scheduler.enums.BinMode = None, data: Optional[dict] = None)[source]

A projective measurement in the Z-basis.

Note

Strictly speaking this is not a gate as it can not be described by a unitary.

Gate level description for a measurement.

The measurement is compiled according to the type of acquisition specified in the device configuration.

Parameters:
• qubits – The qubits you want to measure

• acq_channel – Acquisition channel on which the measurement is performed

• acq_index – Index of the register where the measurement is stored. If None specified, it will default if a tuple(0

• acq_protocol – Acquisition protocol (currently "SSBIntegrationComplex" and "Trace") are supported. If None is specified, the default protocol is chosen based on the device and backend configuration.

• bin_mode – The binning mode that is to be used. If not None, it will overwrite the binning mode used for Measurements in the quantum-circuit to quantum-device compilation step.

• data

The operation’s dictionary, by default None

Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.