partial_trace¶
-
forest.benchmarking.operator_tools.calculational.
partial_trace
(rho, keep, dims, optimize=False)¶ Calculate the partial trace.
Consider a joint state ρ on the Hilbert space \(H_a \otimes H_b\). We wish to trace out \(H_b\)
\[ρ_a = Tr_b(ρ)\]Parameters: - rho – 2D array, the matrix to trace.
- keep – An array of indices of the spaces to keep after being traced. For instance, if the space is A x B x C x D and we want to trace out B and D, keep = [0, 2].
- dims – An array of the dimensions of each space. For example, if the space is A x B x C x D, dims = [dim_A, dim_B, dim_C, dim_D].
- optimize – optimize argument in einsum
Returns: ρ_a, a 2D array i.e. the traced matrix