quri_parts.circuit.gates module#

class IdentityFactory#

Bases: object

name: Literal['Identity'] = 'Identity'#
Identity = <quri_parts.circuit.gates.IdentityFactory object>#

Identity gate represented by matrix \(\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class XFactory#

Bases: object

name: Literal['X'] = 'X'#
X = <quri_parts.circuit.gates.XFactory object>#

Pauli X gate represented by matrix \(\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class YFactory#

Bases: object

name: Literal['Y'] = 'Y'#
Y = <quri_parts.circuit.gates.YFactory object>#

Pauli Y gate represented by matrix \(\begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class ZFactory#

Bases: object

name: Literal['Z'] = 'Z'#
Z = <quri_parts.circuit.gates.ZFactory object>#

Pauli Z gate represented by matrix \(\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class HFactory#

Bases: object

name: Literal['H'] = 'H'#
H = <quri_parts.circuit.gates.HFactory object>#

Hadamard gate represented by matrix \(\frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class SFactory#

Bases: object

name: Literal['S'] = 'S'#
S = <quri_parts.circuit.gates.SFactory object>#

S Gate, or sqrt(Z) gate represented by matrix \(\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class SdagFactory#

Bases: object

name: Literal['Sdag'] = 'Sdag'#
Sdag = <quri_parts.circuit.gates.SdagFactory object>#

Sdag Gate, conjugate of S gate represented by matrix \(\begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class SqrtXFactory#

Bases: object

name: Literal['SqrtX'] = 'SqrtX'#
SqrtX = <quri_parts.circuit.gates.SqrtXFactory object>#

Square root of X gate represented by matrix \(\frac{1}{2}\begin{pmatrix} 1+i & 1-i \\ 1-i & 1+i \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class SqrtXdagFactory#

Bases: object

name: Literal['SqrtXdag'] = 'SqrtXdag'#
SqrtXdag = <quri_parts.circuit.gates.SqrtXdagFactory object>#

Conjugate of the quare root of X gate represented by matrix \(\frac{1}{2}\begin{pmatrix} 1-i & 1+i \\ 1+i & 1-i \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class SqrtYFactory#

Bases: object

name: Literal['SqrtY'] = 'SqrtY'#
SqrtY = <quri_parts.circuit.gates.SqrtYFactory object>#

Square root of Y gate represented by matrix \(\frac{1+i}{2}\begin{pmatrix} 1 & -1 \\ 1 & 1 \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class SqrtYdagFactory#

Bases: object

name: Literal['SqrtYdag'] = 'SqrtYdag'#
SqrtYdag = <quri_parts.circuit.gates.SqrtYdagFactory object>#

Conjugate of the quare root of Y gate represented by matrix \(\frac{1-i}{2}\begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class TFactory#

Bases: object

name: Literal['T'] = 'T'#
T = <quri_parts.circuit.gates.TFactory object>#

T gate, or sqrt(S) gate represented by matrix \(\begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class TdagFactory#

Bases: object

name: Literal['Tdag'] = 'Tdag'#
Tdag = <quri_parts.circuit.gates.TdagFactory object>#

Conjugate of the T gate represented by matrix \(\begin{pmatrix} 1 & 0 \\ 0 & e^{-i\pi/4} \end{pmatrix}\)

Parameters:

target_index (int) –

Return type:

QuantumGate

class RXFactory#

Bases: object

name: Literal['RX'] = 'RX'#
RX = <quri_parts.circuit.gates.RXFactory object>#

RX gate equivalant to \(\exp(-i\theta X/2)\) represented by matrix \(\begin{pmatrix} \cos\frac{\theta}{2} & -i\sin\frac{\theta}{2} \\ -i\sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}\)

Parameters:
  • target_index (int) –

  • angle (float) –

Return type:

QuantumGate

class RYFactory#

Bases: object

name: Literal['RY'] = 'RY'#
RY = <quri_parts.circuit.gates.RYFactory object>#

RY gate equivalant to \(\exp(-i\theta Y/2)\) represented by matrix \(\begin{pmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}\)

Parameters:
  • target_index (int) –

  • angle (float) –

Return type:

QuantumGate

class RZFactory#

Bases: object

name: Literal['RZ'] = 'RZ'#
RZ = <quri_parts.circuit.gates.RZFactory object>#

RZ gate equivalant to \(\exp(-i\theta Z/2)\) represented by matrix \(\begin{pmatrix} e^{-i\theta/2} & 0 \\ 0 & e^{i\theta/2} \end{pmatrix}\)

Parameters:
  • target_index (int) –

  • angle (float) –

Return type:

QuantumGate

class U1Factory#

Bases: object

name: Literal['U1'] = 'U1'#
U1 = <quri_parts.circuit.gates.U1Factory object>#

U1 gate is a single-qubit rotation about the Z axis:

\(U_1(\lambda) = e^{i\lambda/2} R_Z(\lambda)\). Represented by matrix \(\begin{pmatrix} 1 & 0 \\ 0 & e^{i\lambda} \end{pmatrix}\)

Parameters:
  • target_index (int) –

  • lmd (float) –

Return type:

QuantumGate

class U2Factory#

Bases: object

name: Literal['U2'] = 'U2'#
U2 = <quri_parts.circuit.gates.U2Factory object>#

U2 gate is a single-qubit rotation about X + Z axis:

\(U_2(\phi, \lambda) = R_Z(\phi)R_Y(\pi/2)R_Z(\lambda)\). Represented by matrix \(\frac{1}{\sqrt{2}}\begin{pmatrix} 1 & -e^{i\lambda} \\ e^{i\phi} & e^{i(\phi+\lambda)} \end{pmatrix}\)

Parameters:
  • target_index (int) –

  • phi (float) –

  • lmd (float) –

Return type:

QuantumGate

class U3Factory#

Bases: object

name: Literal['U3'] = 'U3'#
U3 = <quri_parts.circuit.gates.U3Factory object>#

U3 gate is a generic single-qubit rotation gate with 3 Euler angles.

Represented by matrix \(\begin{pmatrix} \cos\frac{\theta}{2} & -e^{i\lambda}\sin\frac{\theta}{2} \\ e^{i\phi}\sin\frac{\theta}{2} & e^{i(\phi+\lambda)}\cos\frac{\theta}{2} \end{pmatrix}\)

Parameters:
  • target_index (int) –

  • theta (float) –

  • phi (float) –

  • lmd (float) –

Return type:

QuantumGate

class CNOTFactory#

Bases: object

name: Literal['CNOT'] = 'CNOT'#
CNOT = <quri_parts.circuit.gates.CNOTFactory object>#

CNOT gate, also called controlled-X gate, or CX gate CNOT(control, target) = \(I \otimes |0\rangle\langle0| + X \otimes |1\rangle\langle1|\)

Parameters:
  • control_index (int) –

  • target_index (int) –

Return type:

QuantumGate

class CZFactory#

Bases: object

name: Literal['CZ'] = 'CZ'#
CZ = <quri_parts.circuit.gates.CZFactory object>#

CZ gate, also called controlled-Z gate CZ(control, target) = \(I \otimes |0\rangle\langle0| + Z \otimes |1\rangle\langle1|\)

Parameters:
  • control_index (int) –

  • target_index (int) –

Return type:

QuantumGate

class SWAPFactory#

Bases: object

name: Literal['SWAP'] = 'SWAP'#
SWAP = <quri_parts.circuit.gates.SWAPFactory object>#

SWAP gate.

Parameters:
  • target_index1 (int) –

  • target_index2 (int) –

Return type:

QuantumGate

class TOFFOLIFactory#

Bases: object

name: Literal['TOFFOLI'] = 'TOFFOLI'#
TOFFOLI = <quri_parts.circuit.gates.TOFFOLIFactory object>#

TOFFOLI gate.

Parameters:
  • control_index1 (int) –

  • control_index2 (int) –

  • target_index (int) –

Return type:

QuantumGate

class UnitaryMatrixFactory#

Bases: object

name: Literal['UnitaryMatrix'] = 'UnitaryMatrix'#
UnitaryMatrix = <quri_parts.circuit.gates.UnitaryMatrixFactory object>#

UnitaryMatrix gate represented by an arbitrary unitary matrix.

Parameters:
  • target_indices (Sequence[int]) –

  • unitary_matrix (Sequence[Sequence[complex]]) –

Return type:

QuantumGate

class SingleQubitUnitaryMatrixFactory#

Bases: object

name: Literal['UnitaryMatrix'] = 'UnitaryMatrix'#
SingleQubitUnitaryMatrix = <quri_parts.circuit.gates.SingleQubitUnitaryMatrixFactory object>#

Single qubit UnitaryMatrix gate.

Parameters:
  • target_index (int) –

  • unitary_matrix (Sequence[Sequence[complex]]) –

Return type:

QuantumGate

class TwoQubitUnitaryMatrixFactory#

Bases: object

name: Literal['UnitaryMatrix'] = 'UnitaryMatrix'#
TwoQubitUnitaryMatrix = <quri_parts.circuit.gates.TwoQubitUnitaryMatrixFactory object>#

Two qubit UnitaryMatrix gate.

Parameters:
  • target_index1 (int) –

  • target_index2 (int) –

  • unitary_matrix (Sequence[Sequence[complex]]) –

Return type:

QuantumGate

class PauliFactory#

Bases: object

name: Literal['Pauli'] = 'Pauli'#
Pauli = <quri_parts.circuit.gates.PauliFactory object>#

Multi-qubit Pauli gate, consists of Pauli X, Y, or Z gates.

Parameters:
  • target_indices (Sequence[int]) –

  • pauli_ids (Sequence[int]) –

Return type:

QuantumGate

class PauliRotationFactory#

Bases: object

name: Literal['PauliRotation'] = 'PauliRotation'#
PauliRotation = <quri_parts.circuit.gates.PauliRotationFactory object>#

Multi-qubit Pauli rotation gate such as \(e^{-iX_0Y_1 \phi / 2}\).

Parameters:
  • target_indices (Sequence[int]) –

  • pauli_ids (Sequence[int]) –

  • angle (float) –

Return type:

QuantumGate

class ParametricRXFactory#

Bases: object

name: Literal['ParametricRX'] = 'ParametricRX'#
ParametricRX = <quri_parts.circuit.gates.ParametricRXFactory object>#

Parametric RX gate.

Note that the instance of this class doesn’t contain parameter values. Every parametric gate is carried with it’s parameter (Parameter) such as (ParametricRX, Parameter).

Parameters:

target_index (int) –

Return type:

ParametricQuantumGate

class ParametricRYFactory#

Bases: object

name: Literal['ParametricRY'] = 'ParametricRY'#
ParametricRY = <quri_parts.circuit.gates.ParametricRYFactory object>#

Parametric RY gate.

Note that the instance of this class doesn’t contain parameter values. Every parametric gate is carried with it’s parameter (Parameter) such as (ParametricRY, Parameter).

Parameters:

target_index (int) –

Return type:

ParametricQuantumGate

class ParametricRZFactory#

Bases: object

name: Literal['ParametricRZ'] = 'ParametricRZ'#
ParametricRZ = <quri_parts.circuit.gates.ParametricRZFactory object>#

Parametric RZ gate.

Note that the instance of this class doesn’t contain parameter values. Every parametric gate is carried with it’s parameter (Parameter) such as (ParametricRZ, Parameter).

Parameters:

target_index (int) –

Return type:

ParametricQuantumGate

class ParametricPauliRotationFactory#

Bases: object

name: Literal['ParametricPauliRotation'] = 'ParametricPauliRotation'#
ParametricPauliRotation = <quri_parts.circuit.gates.ParametricPauliRotationFactory object>#

Parametric Pauli rotation gate.

Note that the instance of this class doesn’t contain parameter values. Every parametric gate is carried with it’s parameter (Parameter) such as (ParametricPauliRotation, Parameter).

Parameters:
  • target_indics (Sequence[int]) –

  • pauli_ids (Sequence[int]) –

Return type:

ParametricQuantumGate

class MeasurementFactory#

Bases: object

name: Literal['Measurement'] = 'Measurement'#
Measurement = <quri_parts.circuit.gates.MeasurementFactory object>#

Measurement gate that transfers the measurement result to a classical bit.

Parameters:
  • target_indices (Sequence[int]) –

  • classical_indices (Sequence[int]) –

Return type:

QuantumGate