qpd#
Quasiprobability-decomposition gates
Classes
|
A base class for two-qubit QPD gates. |
|
QPD representation of the move operation. |
|
A base class for single-qubit QPD gates. |
- class DoubleGateQPD(bases: nn.ModuleList[nn.ModuleList[nn.Sequential]], coeffs: list[float], label: int | None = None, name: str | None = None, nqubit: int = 2, wires: list[int] | None = None, den_mat: bool = False, tsr_mode: bool = False)[source]#
Bases:
GateQPDA base class for two-qubit QPD gates.
- Parameters:
bases (nn.ModuleList[nn.ModuleList[nn.Sequential]]) – The probabilistic basis operations for the decomposition. A nested structure where: - bases[i] is the i-th term of the QPD (corresponding to coeffs[i]). - bases[i][j] is the nn.Sequential operations applied to the j-th qubit.
coeffs (list[float]) – The coefficients for quasiprobability representation.
label (int | None) – The label of the gate. Default:
Nonename (str | None) – The name of the quantum operation. Default:
Nonenqubit (int) – The number of qubits that the quantum operation acts on. Default: 2
wires (list[int] | None) – The indices of the qubits that the quantum operation acts on. Default:
Noneden_mat (bool) – Whether the quantum operation acts on density matrices or state vectors. Default:
False(which means state vectors)tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default:
False
- decompose() tuple[SingleGateQPD, SingleGateQPD][source]#
Decompose the gate into two single-qubit QPD gates.
- class MoveQPD(nqubit: int = 2, wires: list[int] | None = None, label: int | None = None, den_mat: bool = False, tsr_mode: bool = False)[source]#
Bases:
DoubleGateQPDQPD representation of the move operation.
- Parameters:
nqubit (int) – The number of qubits that the quantum operation acts on. Default: 2
wires (list[int] | None) – The indices of the qubits that the quantum operation acts on. Default:
Nonelabel (int | None) – The label of the gate. Default:
Noneden_mat (bool) – Whether the quantum operation acts on density matrices or state vectors. Default:
False(which means state vectors)tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default:
False
- class SingleGateQPD(bases: nn.ModuleList[nn.ModuleList[nn.Sequential]], coeffs: list[float], label: int | None = None, name: str | None = None, nqubit: int = 1, wires: list[int] | None = None, den_mat: bool = False, tsr_mode: bool = False)[source]#
Bases:
GateQPDA base class for single-qubit QPD gates.
- Parameters:
bases (nn.ModuleList[nn.ModuleList[nn.Sequential]]) – The probabilistic basis operations for the decomposition. A nested structure where: - bases[i] is the i-th term of the QPD (corresponding to coeffs[i]). - bases[i][j] is the nn.Sequential operations applied to the j-th qubit.
coeffs (list[float]) – The coefficients for quasiprobability representation.
label (int | None) – The label of the gate. Default:
Nonename (str | None) – The name of the quantum operation. Default:
Nonenqubit (int) – The number of qubits that the quantum operation acts on. Default: 1
wires (list[int] | None) – The indices of the qubits that the quantum operation acts on. Default:
Noneden_mat (bool) – Whether the quantum operation acts on density matrices or state vectors. Default:
False(which means state vectors)tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default:
False