pprop.gates package¶
Submodules¶
Module contents¶
This module defines gate classes compatible with PennyLane
- In submodules:
- Single-qubit Clifford gates (clifford.py):
H: Hadamard
S: Phase gate
- Single-qubit non-clifford gates (nonclifford.py):
T: T gate
- Single-qubit parametrized gates (rotation.py):
RX, RY, RZ: Parametrized rotation gates
- Controlled 2-Qubit gates (controlled.py):
CNOT, CY, CZ: Standard two-qubit gates
- class pprop.gates.CNOT(wires, parameter=None)[source]¶
Bases:
ControlledGateThe Controlled-NOT (CX) gate.
\[\begin{split}\text{CNOT} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix}\end{split}\]The Heisenberg evolution maps each two-qubit Pauli string
control ⊗ targetaccording to the rule dict. All other combinations commute with the gate.- Parameters:
wires (list[int]) –
[control, target]qubit indices.parameter (float, int, optional) – Unused. Defaults to
None.
- class pprop.gates.CRX(wires, parameter)[source]¶
Bases:
ControlledRotationGateThe controlled-\(R_x\) gate.
\[\begin{split}CR_x(\theta) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \cos(\theta) & -i\sin(\theta) \\ 0 & 0 & -i\sin(\theta) & \cos(\theta) \end{bmatrix}\end{split}\]Note
The parameter
θhere corresponds toθ/2in PennyLane’s convention. Passparams[i] / 2toqml.CRXto match.- Parameters:
wires (list[int]) –
[control, target]qubit indices.parameter (int) – Index of \(\\theta\) in the global parameter vector.
- class pprop.gates.CRY(wires, parameter)[source]¶
Bases:
ControlledRotationGateThe controlled-\(R_y\) gate.
\[\begin{split}CR_y(\theta) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \cos(\theta) & -\sin(\theta) \\ 0 & 0 & \sin(\theta) & \cos(\theta) \end{bmatrix}\end{split}\]Note
The parameter
θhere corresponds toθ/2in PennyLane’s convention. Passparams[i] / 2toqml.CRYto match.- Parameters:
wires (list[int]) –
[control, target]qubit indices.parameter (int) – Index of \(\\theta\) in the global parameter vector.
- class pprop.gates.CRZ(wires, parameter)[source]¶
Bases:
ControlledRotationGateThe controlled-\(R_z\) gate.
\[\begin{split}CR_z(\theta) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & e^{-i\theta} & 0 \\ 0 & 0 & 0 & e^{i\theta} \end{bmatrix}\end{split}\]Note
The parameter
θhere corresponds toθ/2in PennyLane’s convention. Passparams[i] / 2toqml.CRZto match.- Parameters:
wires (list[int]) –
[control, target]qubit indices.parameter (int) – Index of \(\\theta\) in the global parameter vector.
- class pprop.gates.CY(wires, parameter=None)[source]¶
Bases:
ControlledGateThe Controlled-Y gate.
\[\begin{split}\text{CY} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & -i \\ 0 & 0 & i & 0 \end{bmatrix}\end{split}\]- Parameters:
wires (list[int]) –
[control, target]qubit indices.parameter (float, int, optional) – Unused. Defaults to
None.
- class pprop.gates.CZ(wires, parameter=None)[source]¶
Bases:
ControlledGateThe Controlled-Z gate.
\[\begin{split}\text{CZ} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix}\end{split}\]- Parameters:
wires (list[int]) –
[control, target]qubit indices.parameter (float, int, optional) – Unused. Defaults to
None.
- class pprop.gates.H(wires, parameter=None)[source]¶
Bases:
SimpleCliffordThe single-qubit Hadamard gate.
\[\begin{split}H = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1\\ 1 & -1\end{bmatrix}\end{split}\]Heisenberg evolution rules:
\[X \mapsto Z, \quad Y \mapsto -Y, \quad Z \mapsto X\]- Parameters:
wires (list[int]) – Qubit on which the gate acts.
parameter (float, int, optional) – Unused. Defaults to
None.
- class pprop.gates.RX(wires, parameter)[source]¶
Bases:
RotationGateThe single-qubit parametrised X rotation gate.
\[R_x(\phi) = e^{-i\phi\,\sigma_x/2}\]Heisenberg evolution rules:
\[Y \mapsto -\sin(\phi)\,Z + \cos(\phi)\,Y, \quad Z \mapsto +\sin(\phi)\,Y + \cos(\phi)\,Z, \quad X \mapsto X\]- Parameters:
wires (list[int]) – Qubit on which the gate acts.
parameter (int) – Index of \(\phi\) in the global parameter vector.
- class pprop.gates.RY(wires, parameter)[source]¶
Bases:
RotationGateThe single-qubit parametrised Y rotation gate.
\[R_y(\phi) = e^{-i\phi\,\sigma_y/2}\]Heisenberg evolution rules:
\[X \mapsto +\sin(\phi)\,Z + \cos(\phi)\,X, \quad Z \mapsto -\sin(\phi)\,X + \cos(\phi)\,Z, \quad Y \mapsto Y\]- Parameters:
wires (list[int]) – Qubit on which the gate acts.
parameter (int) – Index of \(\phi\) in the global parameter vector.
- class pprop.gates.RZ(wires, parameter)[source]¶
Bases:
RotationGateThe single-qubit parametrised Z rotation gate.
\[R_z(\phi) = e^{-i\phi\,\sigma_z/2}\]Heisenberg evolution rules:
\[X \mapsto -\sin(\phi)\,Y + \cos(\phi)\,X, \quad Y \mapsto +\sin(\phi)\,X + \cos(\phi)\,Y, \quad Z \mapsto Z\]- Parameters:
wires (list[int]) – Qubit on which the gate acts.
parameter (int) – Index of \(\phi\) in the global parameter vector.
- class pprop.gates.S(wires, parameter=None)[source]¶
Bases:
SimpleCliffordThe single-qubit phase gate.
\[\begin{split}S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix}\end{split}\]Heisenberg evolution rules:
\[X \mapsto -Y, \quad Y \mapsto X, \quad Z \mapsto Z\]- Parameters:
wires (list[int]) – Qubit on which the gate acts.
parameter (float, int, optional) – Unused. Defaults to
None.
- class pprop.gates.T(wires, parameter=None)[source]¶
Bases:
SimpleNonCliffordThe single-qubit T gate.
\[\begin{split}T = \begin{bmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{bmatrix}\end{split}\]The Heisenberg evolution rules are:
\[ \begin{align}\begin{aligned}X \;\mapsto\; \tfrac{1}{\sqrt{2}} X - \tfrac{1}{\sqrt{2}} Y\\Y \;\mapsto\; \tfrac{1}{\sqrt{2}} Y + \tfrac{1}{\sqrt{2}} X\\Z \;\mapsto\; Z\end{aligned}\end{align} \]- Parameters:
wires (list[int]) – Qubit on which the gate acts.
parameter (float, int, optional) – Unused for non-parametrised gates. Defaults to
None.