Skip to content

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 ​

Marker class for all quantum channel representations. QuantumChannel cannot be constructed directly — use one of its concrete subclasses (Kraus, Chi, Choi, SuperOp, PTM) instead.

Signature ​

python
QuantumChannel(*args, **kwargs)

Note: The constructor accepts *args, **kwargs for internal use only. Create specific channel types via their named constructors (e.g., Kraus(), Choi()).

All channel subclasses implement the following methods:

MethodReturn TypeDescription
evolve(state)DensityMatrixApply the channel to a quantum state
get_input_dim()intReturn the input Hilbert-space dimension
get_output_dim()intReturn 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 ​

ValueDescription
Q2Q1Q0Standard ordering: in state label '10', qubit 1 is '1' and qubit 0 is '0'

Example ​

python
from pyqpanda3.quantum_info import StateSystemType

ordering = StateSystemType.Q2Q1Q0
print(ordering)

Output:

StateSystemType.Q2Q1Q0

Mathematical Background ​

A quantum channel E is a completely positive trace-preserving (CPTP) map. The five representations are:

RepresentationMatrix dimensionDescription
Kraus--Set of operators {Ki} such that E(ρ)=∑iKiρKi†
SuperOpd2×d2The superoperator matrix S in the column-stacking basis
Choid2×d2The Choi matrix Λ=∑ij|i⟩⟨j|⊗E(|i⟩⟨j|)
Chid2×d2The Chi matrix in the Pauli basis
PTMd2×d2The Pauli Transfer Matrix

Kraus ​

The Kraus representation of a quantum channel. A channel in Kraus form is defined by a set of operators {Ki} such that:

E(ρ)=∑iKiρKi†

with the trace-preservation condition ∑iKi†Ki=I.

The Kraus class also supports a two-sided (generalized) form with separate left and right operator lists:

E(ρ)=∑iLiρRi†

Constructors ​

Default ​

python
Kraus()

Constructs an empty Kraus object with no operators.

From a single operator (Eigen matrix) ​

python
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.

Warning: When passing a single numpy.ndarray, the call may dispatch to the list overload Kraus(left: list[numpy.ndarray]) instead of the single-matrix constructor. To ensure correct single-matrix construction, wrap the array in a list: Kraus([matrix]).

ParameterTypeDescription
matrixnumpy.ndarrayA single operator matrix.

From a single operator (Matrix) ​

python
Kraus(matrix: Matrix)

Same as above but accepts a Matrix object.

ParameterTypeDescription
matrixMatrixA single operator as a Matrix.

From a list of operators (left only) ​

python
Kraus(left: list[numpy.ndarray])
Kraus(left: list[Matrix])

Construct a Kraus object from a list of 2-D matrices. The left operator list is populated; the right operator list is empty.

ParameterTypeDescription
leftlist[numpy.ndarray] or list[Matrix]A list of Kraus operator matrices.

From two lists of operators (left and right) ​

python
Kraus(left: list[numpy.ndarray], right: list[numpy.ndarray])
Kraus(left: list[Matrix], right: list[Matrix])

Construct a two-sided Kraus object from separate left and right operator lists.

ParameterTypeDescription
leftlist[numpy.ndarray] or list[Matrix]The left operator list.
rightlist[numpy.ndarray] or list[Matrix]The right operator list.

From another channel representation ​

python
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 ​

python
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrix

Apply the channel to a quantum state and return the result as a DensityMatrix.

get_input_dim ​

python
get_input_dim() -> int

Return the input Hilbert-space dimension of the channel.

get_output_dim ​

python
get_output_dim() -> int

Return the output Hilbert-space dimension of the channel.

left ​

python
left() -> list[Matrix]

Return the list of left operators.

python
right() -> list[Matrix]

Return the list of right operators.

append ​

python
append(other: Kraus) -> bool

Append the operators from another Kraus object to the end of this one.

ParameterTypeDescription
otherKrausAnother Kraus object whose operators will be appended.

Note: append() requires that the Kraus object already contains at least one operator. Calling append() on an empty Kraus object will raise an error.

left_push_back ​

python
left_push_back(val: Matrix)
left_push_back(val: numpy.ndarray)

Append a single matrix to the left operator list.

right_push_back ​

python
right_push_back(val: Matrix)
right_push_back(val: numpy.ndarray)

Append a single matrix to the right operator list.

clear ​

python
clear()

Remove all operators from both the left and right lists.

Operators ​

Equality ​

python
k_a == k_b -> bool

Return True if the two Kraus objects have identical internal data.


Chi ​

The Chi (process) matrix representation in the Pauli basis. For a channel E, the Chi matrix χ is defined by:

E(ρ)=∑m,nχmnPmρPn

where {Pm} is the set of Pauli operators.

Constructors ​

python
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 ​

python
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrix

Apply the channel to a quantum state and return the result.

get_input_dim ​

python
get_input_dim() -> int

Return the input Hilbert-space dimension.

get_output_dim ​

python
get_output_dim() -> int

Return the output Hilbert-space dimension.

ndarray ​

python
ndarray() -> numpy.ndarray[numpy.complex128]

Return the internal Chi matrix as a numpy.ndarray.

Operators ​

Equality ​

python
chi_a == chi_b -> bool

Choi ​

The Choi matrix representation (also known as the Choi-Jamiolkowski isomorphism). For a channel E acting on a d-dimensional system, the Choi matrix is:

Λ=∑i,j=0d−1|i⟩⟨j|⊗E(|i⟩⟨j|)

The resulting matrix has dimension d2×d2.

Constructors ​

python
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 ​

python
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrix

Apply the channel to a quantum state and return the result.

get_input_dim ​

python
get_input_dim() -> int

Return the input Hilbert-space dimension.

get_output_dim ​

python
get_output_dim() -> int

Return the output Hilbert-space dimension.

ndarray ​

python
ndarray() -> numpy.ndarray[numpy.complex128]

Return the internal Choi matrix as a numpy.ndarray of shape d2×d2.

Operators ​

Equality ​

python
choi_a == choi_b -> bool

SuperOp ​

The superoperator (column-stacking-basis) matrix representation. The superoperator S acts on the vectorized density matrix:

vec(E(ρ))=Svec(ρ)

The resulting matrix has dimension d2×d2.

Constructors ​

python
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 ​

python
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrix

Apply the channel to a quantum state and return the result.

get_input_dim ​

python
get_input_dim() -> int

Return the input Hilbert-space dimension.

get_output_dim ​

python
get_output_dim() -> int

Return the output Hilbert-space dimension.

ndarray ​

python
ndarray() -> numpy.ndarray[numpy.complex128]

Return the internal superoperator matrix as a numpy.ndarray of shape d2×d2 in the column-stacking basis.

Operators ​

Equality ​

python
s_a == s_b -> bool

PTM ​

The Pauli Transfer Matrix representation. The PTM R encodes the channel in the Pauli basis:

Rmn=1dTr[PmE(Pn)]

where {Pm} is the normalized Pauli basis. The PTM is a real-valued d2×d2 matrix.

Constructors ​

python
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 ​

python
evolve(state: DensityMatrix) -> DensityMatrix
evolve(state: StateVector) -> DensityMatrix

Apply the channel to a quantum state and return the result.

get_input_dim ​

python
get_input_dim() -> int

Return the input Hilbert-space dimension.

get_output_dim ​

python
get_output_dim() -> int

Return the output Hilbert-space dimension.

ndarray ​

python
ndarray() -> numpy.ndarray[numpy.complex128]

Return the internal Pauli transfer matrix as a numpy.ndarray of shape d2×d2 in the Pauli basis.

Operators ​

Equality ​

python
ptm_a == ptm_b -> bool

Examples ​

python
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())
print(kraus.get_output_dim())

Output:

2
2

See Also ​

Released under the MIT License.