QuantumChannel -- Chi, Choi, SuperOp, PTM, Kraus
Quantum channels describe the most general physical evolution of a quantum state. In pyqpanda3, a quantum channel can be represented in five mathematically equivalent forms. Each representation class can be freely converted to any other representation via its constructor.
All channel representations share a common base class QuantumChannel and provide methods for evolving quantum states and querying dimensions.
QuantumChannel
Abstract base class for all quantum channel representations. QuantumChannel cannot be constructed directly — use one of its concrete subclasses (Kraus, Chi, Choi, SuperOp, PTM) instead.
Signature
QuantumChannel(*args, **kwargs)Note: The constructor accepts
*args, **kwargsfor internal use only. Create specific channel types via their named constructors (e.g.,Kraus(),Choi()).
All channel subclasses inherit the following common methods from QuantumChannel:
| Method | Return Type | Description |
|---|---|---|
evolve(state) | DensityMatrix | Apply the channel to a quantum state |
get_input_dim() | int | Return the input Hilbert-space dimension |
get_output_dim() | int | Return the output Hilbert-space dimension |
StateSystemType
Enumeration for qubit ordering conventions used in quantum state representations. Specifies how bit strings in state labels map to qubit indices.
Values
| Value | Description |
|---|---|
Q2Q1Q0 | Standard ordering: in state label '10', qubit 1 is '1' and qubit 0 is '0' |
Example
from pyqpanda3.quantum_info import StateSystemType
ordering = StateSystemType.Q2Q1Q0
print(ordering) # StateSystemType.Q2Q1Q0Mathematical Background
A quantum channel
| Representation | Matrix dimension | Description |
|---|---|---|
| Kraus | -- | Set of operators |
| SuperOp | The superoperator matrix | |
| Choi | The Choi matrix | |
| Chi | The Chi matrix in the Pauli basis | |
| PTM | The Pauli Transfer Matrix |
Kraus
The Kraus representation of a quantum channel. A channel in Kraus form is defined by a set of operators
with the trace-preservation condition
The Kraus class also supports a two-sided (generalized) form with separate left and right operator lists:
Constructors
Default
Kraus()Constructs an empty Kraus object with no operators.
From a single operator (Eigen matrix)
Kraus(matrix: numpy.ndarray)Construct a Kraus object from a single 2-D matrix. The left operator list contains the given matrix; the right operator list is empty.
| Parameter | Type | Description |
|---|---|---|
| matrix | numpy.ndarray | A single operator matrix. |
From a single operator (Matrix)
Kraus(matrix: Matrix)Same as above but accepts a Matrix object.
| Parameter | Type | Description |
|---|---|---|
| matrix | Matrix | A single operator as a Matrix. |
From a list of operators (left only)
Kraus(left: list[numpy.ndarray])Construct a Kraus object from a list of 2-D matrices. The left operator list is populated; the right operator list is empty.
| Parameter | Type | Description |
|---|---|---|
| left | list[numpy.ndarray] | A list of Kraus operator matrices. |
From two lists of operators (left and right)
Kraus(left: list[numpy.ndarray], right: list[numpy.ndarray])Construct a two-sided Kraus object from separate left and right operator lists.
| Parameter | Type | Description |
|---|---|---|
| left | list[numpy.ndarray] | The left operator list. |
| right | list[numpy.ndarray] | The right operator list. |
From another channel representation
Kraus(other: Choi)
Kraus(other: Chi)
Kraus(other: SuperOp)
Kraus(other: PTM)
Kraus(other: Kraus)Convert another channel representation to the Kraus form.
Methods
evolve
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrixApply the channel to a quantum state and return the result as a DensityMatrix.
get_input_dim
get_input_dim() -> intReturn the input Hilbert-space dimension of the channel.
get_output_dim
get_output_dim() -> intReturn the output Hilbert-space dimension of the channel.
left
left() -> listReturn the list of left operators.
right
right() -> listReturn the list of right operators.
append
append(other: Kraus)Append the operators from another Kraus object to the end of this one.
| Parameter | Type | Description |
|---|---|---|
| other | Kraus | Another Kraus object whose operators will be appended. |
left_push_back
left_push_back(val: Matrix)
left_push_back(val: numpy.ndarray)Append a single matrix to the left operator list.
right_push_back
right_push_back(val: Matrix)
right_push_back(val: numpy.ndarray)Append a single matrix to the right operator list.
clear
clear()Remove all operators from both the left and right lists.
Operators
Equality
k_a == k_b -> boolReturn True if the two Kraus objects have identical internal data.
Chi
The Chi (process) matrix representation in the Pauli basis. For a channel
where
Constructors
Chi(other: Chi)
Chi(other: Choi)
Chi(other: PTM)
Chi(other: SuperOp)
Chi(other: Kraus)Construct a Chi object by converting from any other channel representation.
Methods
evolve
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrixApply the channel to a quantum state and return the result.
get_input_dim
get_input_dim() -> intReturn the input Hilbert-space dimension.
get_output_dim
get_output_dim() -> intReturn the output Hilbert-space dimension.
ndarray
ndarray() -> numpy.ndarrayReturn the internal Chi matrix as a numpy.ndarray.
Operators
Equality
chi_a == chi_b -> boolChoi
The Choi matrix representation (also known as the Choi-Jamiolkowski isomorphism). For a channel
The resulting matrix has dimension
Constructors
Choi(other: Kraus)
Choi(other: Choi)
Choi(other: PTM)
Choi(other: Chi)
Choi(other: SuperOp)Construct a Choi object by converting from any other channel representation.
Methods
evolve
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrixApply the channel to a quantum state and return the result.
get_input_dim
get_input_dim() -> intReturn the input Hilbert-space dimension.
get_output_dim
get_output_dim() -> intReturn the output Hilbert-space dimension.
Operators
Equality
choi_a == choi_b -> boolSuperOp
The superoperator (Pauli-basis) matrix representation. The superoperator
The resulting matrix has dimension
Constructors
SuperOp(other: Choi)
SuperOp(other: SuperOp)
SuperOp(other: Chi)
SuperOp(other: PTM)
SuperOp(other: Kraus)Construct a SuperOp object by converting from any other channel representation.
Methods
evolve
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrixApply the channel to a quantum state and return the result.
get_input_dim
get_input_dim() -> intReturn the input Hilbert-space dimension.
get_output_dim
get_output_dim() -> intReturn the output Hilbert-space dimension.
Operators
Equality
s_a == s_b -> boolPTM
The Pauli Transfer Matrix representation. The PTM
where
Constructors
PTM(other: Choi)
PTM(other: PTM)
PTM(other: Chi)
PTM(other: SuperOp)
PTM(other: Kraus)Construct a PTM object by converting from any other channel representation.
Methods
evolve
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrixApply the channel to a quantum state and return the result.
get_input_dim
get_input_dim() -> intReturn the input Hilbert-space dimension.
get_output_dim
get_output_dim() -> intReturn the output Hilbert-space dimension.
Operators
Equality
ptm_a == ptm_b -> boolExamples
import numpy as np
from pyqpanda3.quantum_info import Kraus, Chi, Choi, SuperOp, PTM, DensityMatrix
# Define a depolarizing channel for a single qubit
# E(rho) = (1-p)*rho + (p/3)*(X*rho*X + Y*rho*Y + Z*rho*Z)
p = 0.1
I = np.eye(2, dtype=complex)
X = np.array([[0, 1], [1, 0]], dtype=complex)
Y = np.array([[0, -1j], [1j, 0]], dtype=complex)
Z = np.array([[1, 0], [0, -1]], dtype=complex)
K0 = np.sqrt(1 - p) * I
K1 = np.sqrt(p / 3) * X
K2 = np.sqrt(p / 3) * Y
K3 = np.sqrt(p / 3) * Z
kraus = Kraus([K0, K1, K2, K3])
# Convert to other representations
choi = Choi(kraus)
chi = Chi(kraus)
superop = SuperOp(kraus)
ptm = PTM(kraus)
# Evolve a density matrix
rho = DensityMatrix([[1, 0], [0, 0]])
rho_out = kraus.evolve(rho)
# Query dimensions
print(kraus.get_input_dim()) # 2
print(kraus.get_output_dim()) # 2