mqt.qudits.visualisation.mini_quantum_information¶
Module Contents¶
- get_density_matrix_from_counts(results: list[int] | numpy.typing.NDArray[int_], circuit: QuantumCircuit) numpy.typing.NDArray[numpy.complex128][source]¶
- partial_trace(rho: numpy.typing.NDArray[numpy.complex128], qudits2keep: list[int], dims: list[int], optimize: bool = False) numpy.typing.NDArray[numpy.complex128][source]¶
Calculate the partial trace.
p_a = Tr_b(p)
- Parameters:
rho – Matrix to trace
qudits2keep – 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 instance, if the space is A x B x C x D, dims = [dim_A, dim_B, dim_C, dim_D]
optimize – Whether to optimize the einsum operation. Defaults to False.
- Returns:
The traced matrix