qics.quantum.p_tr¶
- qics.quantum.p_tr(mat, dims, sys)[source]¶
Performs the partial trace on a multipartite state, e.g., for a bipartite state with
dims=(n0, n1), this is the unique linear map satisfying\[X \otimes Y \mapsto \text{tr}[X] Y,\]if
sys=0, or\[X \otimes Y \mapsto \text{tr}[Y] X,\]if
sys=1, for all \(X,Y\in\mathbb{H}^n\).- Parameters:
- mat
ndarray Array of size
(n0*n1*...*nk-1, n0*n1*...*nk-1)represnting a matrix defined on \(k\) subsystems which we want to take the partial trace of.- dims
tupleofint The dimensions
(n0, n1, ..., nk-1)of the \(k\) subsystems.- sys
intortupleofint Which of the \(k\) subsystems to trace out. Can define multiple subsystems to trace out.
- mat
- Returns:
ndarrayThe resulting matrix after taking the partial trace. Has dimension
(n0*n1*...*nk-1 / nx, n0*n1*...*nk-1 / nx)wherenxis the product of the dimensions of the subsystems that have been traced out.
See also
i_krThe Kronecker product with the identity matrix
Notes
This is the adjoint operator of the Kronecker product with the identity matrix.