Skip to main content

partial_trace

Function partial_trace 

Source
pub fn partial_trace(
    dm: &DensityMatrix,
    keep_qubits: &[usize],
    n_total: usize,
) -> QuantumResult<DensityMatrix>
Expand description

Compute the reduced density matrix by tracing out all qubits not in keep_qubits.

n_total is the total number of qubits; keep_qubits is sorted in ascending order. The output density matrix has dimension 2^|keep_qubits|.