Base Class¶
-
class
arline_quantum.gates.gate.Gate(*args)¶ Bases:
objectAn abstract quantum gate class
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= None¶ List of pseudo graph symbols
-
is_discrete= None¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= None¶ The number of qubits the gate acts on
-
to_qasm(*args)¶ Describes how the gate will be shown in OPENQASM format.
-
static
to_qiskit_name()¶ Convert to Qiskit gate name.
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
-
Identity Gate¶

-
class
arline_quantum.gates.identity.I(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- Identity Gate
Description:
- Other names:
- \(I\), Idle
Matrix:
\[\begin{split}\begin{bmatrix} 1 & 0\\ 0 & 1 \end{bmatrix}\end{split}\]- Inverse:
- \(I^\dagger = I\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['I']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
U Gates¶

-
class
arline_quantum.gates.u1.U1(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(U_{1}\left(\lambda\right)\) Gate
Description:
The \(U_{1}\left(\lambda\right)\) gate is a single-qubit rotation over \(\lambda\) (radians) angle
Matrix:
\[\begin{split}\begin{bmatrix} 1 & 0 \\ 0 & \exp(i\lambda) \end{bmatrix}\end{split}\]Parameters: lambda (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['U1']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.u2.U2(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(U_{2}\left(\phi, \lambda\right)\) Gate
Description:
The \(U_{2}\left(\phi, \lambda\right)\) gate is a single-qubit rotation through \(\phi\) (radians) around \(\lambda\) (radians) around
Matrix:
\[\begin{split}\begin{bmatrix} 1 / \sqrt(2) & -\exp(i * \lambda) * 1 / \sqrt(2) \\ \exp(i * \phi) * 1 / \sqrt(2) & \exp(i * (\phi + \lambda)) * 1 / \sqrt(2) \end{bmatrix}\end{split}\]Parameters: -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['U2']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.u3.U3(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(U_{3}\left(\theta, \phi, \lambda\right)\) Gate
Description:
The \(U_{3}\left(\theta, \phi, \lambda\right)\) gate is a single-qubit rotation through \(\theta\) (radians) around \(\phi\) (radians) around \(\lambda\) (radians) around
Matrix:
\[\begin{split}\begin{bmatrix} \cos(\theta / 2) & -exp(i * \lambda) * \sin(\theta / 2) \\ \exp(i * \phi) * \sin(\theta / 2) & \exp(i * (\phi + \lambda)) * \cos(\theta / 2) \end{bmatrix}\end{split}\]Parameters: -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['U3']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
Standard Rotation¶

-
class
arline_quantum.gates.rx.Rx(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(R_X\left(\theta\right)\) Gate
Description:
The \(R_X(\theta)\) gate is a single-qubit rotation through angle \(\theta\) (radians) around the x-axis
Matrix:
\[\begin{split}\begin{bmatrix} \cos(\theta/2) & -i \sin(\theta/2) \\ -i \sin(\theta/2) & \cos(\theta/2) \end{bmatrix}\end{split}\]Parameters: theta (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['RX']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.ry.Ry(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(R_Y\left(\theta\right)\) Gate
Description:
The \(R_Y(\theta)\) gate is a single-qubit rotation through angle \(\theta\) (radians) around the y-axis
Matrix:
\[\begin{split}\begin{bmatrix} \cos(\theta/2) & -\sin(\theta/2) \\ \sin(\theta/2) & \cos(\theta/2) \end{bmatrix}\end{split}\]Parameters: theta (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['RY']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
is_qasm_composite= False¶
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.rz.Rz(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(R_Z\left(\phi\right)\) Gate
Description:
The \(R_Z(\phi)\) gate is a single-qubit rotation through angle \(\phi\) (radians) around the z-axis
Matrix:
\[\begin{split}\begin{bmatrix} 1 & 0 \\ 0 & \exp\left(i \cdot \phi \right) \end{bmatrix}\end{split}\]Parameters: phi (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['RZ']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.r.R(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(R\left(\theta, \phi\right)\) Gate
Description:
\[R(\theta, 0) = R_X(\theta), R(\theta, \pi/2) = R_Y(\theta)\]Matrix:
\[\begin{split}\begin{bmatrix} \cos(\theta/2) & -i \cdot e^{-i \phi} \cdot \sin(\theta/2)\\ -i \cdot e^{i \phi} \cdot \sin(\theta/2) & \cos(\theta/2) \end{bmatrix}\end{split}\]Parameters: -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['R']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
Clifford and T¶

-
class
arline_quantum.gates.cnot.Cnot(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CNOT\) Gate
Description:
Controlled discrete two-qubit gate
- Other names:
- \(CX\), Controlled \(X\)
Matrix:
This matrix representation corresponds to [target_qubit, control_qubit]\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0 \end{bmatrix}\end{split}\]- Inverse:
- \(CNOT^\dagger = CNOT\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'X']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.s.S(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(S\) Gate
Description:
- Other names:
- Phase, \(pi/4\)
Matrix:
\[\begin{split}\begin{bmatrix} 1 & 0\\ 0 & i \end{bmatrix}\end{split}\]-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['S']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format.
-
static
to_qiskit_name()¶ Convert to Qiskit gate name.
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
-
class
arline_quantum.gates.s.Sd(*args)¶ Bases:
arline_quantum.gates.s.S\(S^\dagger\) gate
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['Sd']¶ List of pseudo graph symbols
-
is_discrete= True¶
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
-

-
class
arline_quantum.gates.h.H(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(H\) Gate
Description:
- Other names:
- Hadamard
Matrix:
\[\begin{split}1/ \sqrt(2) \cdot \begin{bmatrix} 1 & 1\\ 1 & -1 \end{bmatrix}\end{split}\]- Inverse:
- \(H^\dagger = H\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['H']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.t.T(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(T\) Gate
Description:
The \(T\) gate is related to the \(S\) gate by the relationship \(S = T^2\)
Matrix:
\[\begin{split}\begin{bmatrix} 1 & 0\\ 0 & \exp\left(\frac{i \pi}{4}\right) \end{bmatrix}\end{split}\]-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['T']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format.
-
static
to_qiskit_name()¶ Convert to Qiskit gate name.
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
-
class
arline_quantum.gates.t.Td(*args)¶ Bases:
arline_quantum.gates.t.T\(T^\dagger\) gate
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['Td']¶ List of pseudo graph symbols
-
is_discrete= True¶
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
-
Control Gates¶

-
class
arline_quantum.gates.cy.Cy(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CY\) Gate
Description:
Controlled discrete two-qubit gate
- Other names:
- Controlled \(Y\)
Matrix:
This matrix representation corresponds to [target_qubit, control_qubit]
\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & -i\\ 0 & 0 & i & 0 \end{bmatrix}\end{split}\]- Inverse:
- \(CY^\dagger = CY\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'Y']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.cz.Cz(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CZ\) Gate
Description:
Controlled discrete two-qubit gate
- Other names:
- Controlled \(Z\)
Matrix:
his matrix representation corresponds to [target_qubit, control_qubit]
\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & -1 \end{bmatrix}\end{split}\]- Inverse:
- \(CZ^\dagger = CZ\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'Z']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.ch.Ch(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CH\) Gate
Description:
Controlled discrete two-qubit gate
- Other names:
- Controlled \(H\)
Matrix:
This matrix representation corresponds to [target_qubit, control_qubit]\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1/ \sqrt(2) & 1/ \sqrt(2)\\ 0 & 0 & 1/ \sqrt(2) & -1/ \sqrt(2) \end{bmatrix}\end{split}\]- Inverse:
- \(СH^\dagger = СH\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'H']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.cu1.Cu1(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CU_{1}\left(\lambda\right)\) Gate
Description:
The \(CU_{1}\left(\lambda\right)\) gate is a controlled \(U_1\) rotation with 1 angle \(\lambda\) (radians)
- Other names:
- Controlled \(U_1\) gate
Matrix:
This matrix representation corresponds to [target_qubit, control_qubit]
\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & \exp(i\lambda) \end{bmatrix}\end{split}\]Parameters: lambda (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'U1']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.cu3.Cu3(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CU_{3}\left(\theta, \phi, \lambda\right)\) Gate
Description:
Controlled continuous two-qubit gate
The \(CU_{3}\left(\theta, \phi, \lambda\right)\) gate is a controlled \(U_3\) rotation with 3 Euler angles \(\theta, \phi, \lambda\) (radians)
- Other names:
- Controlled \(U_3\) gate
Matrix:
This matrix representation corresponds to [target_qubit, control_qubit]
\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & \cos(\theta/2) & - \exp(i \lambda) \sin(\theta/2) \\ 0 & 0 & \exp(i \phi) \sin(\theta/2) & \exp(i(\phi+\lambda)) \cos(\theta/2) \end{bmatrix}\end{split}\]Parameters: -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'U3']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.crx.Crx(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CR_X\left(\theta\right)\) Gate
Description:
Controlled continuous two-qubit gate
The \(CR_X(\theta)\) gate is a controlled \(R_X\) rotation with angle \(\theta\) (radians)
- Other names:
- Controlled \(R_X\)
Matrix:
This matrix representation corresponds to [target_qubit, control_qubit]\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & \cos(\theta/2) & -i \sin(\theta/2) \\ 0 & 0 & -i \sin(\theta/2) & \cos(\theta/2) \end{bmatrix}\end{split}\]Parameters: theta (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'RX']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.cry.Cry(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CR_Y\left(\theta\right)\) Gate
Description:
Controlled continuous two-qubit gate
The \(CR_Y(\theta)\) gate is a controlled \(R_Y\) rotation with angle \(\theta\) (radians)
- Other names:
- Controlled \(R_Y\) gate
Matrix:
This matrix representation corresponds to [target_qubit, control_qubit]\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & \cos(\theta/2) & -\sin(\theta/2) \\ 0 & 0 & \sin(\theta/2) & \cos(\theta/2) \end{bmatrix}\end{split}\]Parameters: theta (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'RY']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.crz.Crz(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CR_Z\left(\phi\right)\) Gate
Description:
Controlled continuous two-qubit gate The \(CR_Z(\theta)\) gate is a controlled \(R_Z\) rotation with angle \(\phi\) (radians)
- Other names:
- Controlled \(R_Y\) gate
Matrix:
This matrix representation corresponds to [target_qubit, control_qubit]\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & \exp\left(\frac{-i \cdot \phi}{2}\right) & 0 \\ 0 & 0 & 0 & \exp\left(\frac{i \cdot \phi}{2}\right) \end{bmatrix}\end{split}\]Parameters: theta (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'RZ']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
Three-Qubit Gates¶

-
class
arline_quantum.gates.ccnot.Ccnot(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CCNOT\) Gate
Description:
Controlled discrete three-qubit gate
- Other names:
- Toffoli, Controlled-Controlled \(NOT\), \(CCX\)
Matrix:
\[\begin{split}\begin{bmatrix} 1& 0& 0& 0& 0& 0& 0& 0\\ 0& 1& 0& 0& 0& 0& 0& 0\\ 0& 0& 1& 0& 0& 0& 0& 0\\ 0& 0& 0& 1& 0& 0& 0& 0\\ 0& 0& 0& 0& 1& 0& 0& 0\\ 0& 0& 0& 0& 0& 1& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 1\\ 0& 0& 0& 0& 0& 0& 1& 0 \end{bmatrix}\end{split}\]- Inverse:
- \(CCNOT^\dagger = CCNOT\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', '.', 'X']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 3¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.cswap.Cswap(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(CSWAP\) Gate
Description:
- Other names:
- Fredkin gate
Matrix:
\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \end{bmatrix}\end{split}\]- Inverse:
- \(CSWAP^\dagger = CSWAP\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['.', 'X', 'X']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 3¶ The number of qubits the gate acts on
-
to_qasm(*args)¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
Pauli Gates¶

-
class
arline_quantum.gates.x.X(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(X\) Gate
Description:
- Other names:
- Pauli \(X\), \(NOT\), Bit Flip, Sigma \(X\)
Matrix:
\[\begin{split}\begin{bmatrix} 0 & 1\\ 1 & 0 \end{bmatrix}\end{split}\]- Inverse:
- \(X^\dagger = X\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['X']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.y.Y(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(Y\) gate
Description:
- Other names:
- Pauli \(Y\), Sigma \(Y\)
Matrix:
\[\begin{split}\begin{bmatrix} 0 & -i\\ i & 0 \end{bmatrix}\end{split}\]- Inverse:
- \(Y^\dagger = Y\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['Y']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 1¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

Ising Gates¶

-
class
arline_quantum.gates.xx.Xx(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(XX\left(phi\right)\) gate
Description:
Matrix:
\[\begin{split}\frac{1}{\sqrt{2}} \cdot \begin{bmatrix} 1 & 0 & 0 & -i e^{i \phi}\\ 0 & 1 & -i & 0\\ 0 & -i & 1 & 0\\ -i e^{i \phi} & 0 & 0 & 1 \end{bmatrix}\end{split}\]Parameters: phi (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['IX', 'IX']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.yy.Yy(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(YY\left(\phi\right)\) gate
Description:
Matrix:
\[\begin{split}\begin{bmatrix} \cos(\phi) & 0 & 0 & i \sin(\phi)\\ 0 & \cos(\phi) & -i \sin(\phi) & 0\\ 0 & -i \sin(\phi) & \cos(\phi) & 0\\ i \sin(\phi)& 0 & 0 & \cos(\phi) \end{bmatrix}\end{split}\]Parameters: phi (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['IY', 'IY']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array

-
class
arline_quantum.gates.zz.Zz(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(ZZ\left(\phi\right)\) Gate
Description:
Matrix:
\[\begin{split}\begin{bmatrix} \exp\left(\frac{i \phi}{2} \right) & 0 & 0 & 0\\ 0 & \exp\left(\frac{-i \phi}{2} \right) & 0 & 0\\ 0 & 0 & \exp\left(\frac{-i \phi}{2} \right) & 0\\ 0 & 0 & 0 & \exp\left(\frac{i \phi}{2} \right) \end{bmatrix}\end{split}\]Parameters: phi (float) – angle in radians -
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['IZ', 'IZ']¶ List of pseudo graph symbols
-
is_discrete= False¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm()¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array
Other Gates¶

-
class
arline_quantum.gates.swap.Swap(*args)¶ Bases:
arline_quantum.gates.gate.Gate- Name:
- \(SWAP\) Gate
Description:
Expressed in basis states, the \(SWAP\) gate swaps the state of the two qubits involved in the operation
Matrix:
\[\begin{split}\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1 \end{bmatrix}\end{split}\]- Inverse:
- \(SWAPˆ\dagger = SWAP\)
-
angles(representation='rational')¶ Convert args into list of strings.
-
static
args_to_str(*args)¶ Describes how the gate paramaters will be shown.
-
calculate_u(args)¶ Calculate matrix
-
static
format_args(*args, representation='rational')¶ Convert args into list of strings.
-
graph_symbols= ['X', 'X']¶ List of pseudo graph symbols
-
is_discrete= True¶ Flag for discrete or continuous
-
classmethod
make_discrete(*args, class_name=None)¶
-
num_qubits= 2¶ The number of qubits the gate acts on
-
to_qasm(*args)¶ Describes how the gate will be shown in OPENQASM format
-
static
to_qiskit_name()¶ Convert to Qiskit gate name
-
u¶ Get gate unitary matrix
Returns: gate unitary matrix Return type: np.array