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]

Bases: quantify_scheduler.operations.operation.Operation

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}\]
__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.

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}X = \sigma_x = \begin{bmatrix} 0 & 1 \\ 1 & 0 \\ \end{bmatrix}\end{split}\]
__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.

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

Bases: Rxy

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

__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.

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

Bases: Rxy

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

\[\begin{split}\mathsf Y = \sigma_y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}\end{split}\]
__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.

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

Bases: Rxy

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

__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.

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

Bases: quantify_scheduler.operations.operation.Operation

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}\]
__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.

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

Bases: quantify_scheduler.operations.operation.Operation

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}\]
__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.

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

Bases: quantify_scheduler.operations.operation.Operation

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)])
__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.

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, None] = None, bin_mode: quantify_scheduler.enums.BinMode = None, data: Optional[dict] = None)[source]

Bases: quantify_scheduler.operations.operation.Operation

A projective measurement in the Z-basis.

Note

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

__str__() str[source]

Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.

This representation is guaranteed to be unique.