wavefunction_partial_trace_as_mixture(wavefunction: numpy.ndarray, keep_indices: List[int], *, atol: Union[int, float] = 1e-08) → Tuple[Tuple[float, numpy.ndarray], …]¶
Returns a mixture representing a wavefunction with only some qubits kept.The input wavefunction must have shape
(2,) * nor
(2 ** n)where
wavefunctionis expressed over n qubits. States in the output mixture willretain the same type of shape as the input wavefunction, either
(2 ** k)or
(2,) * kwhere k is the number of qubits kept.If the wavefunction cannot be factored into a pure state over
keep_indicesthen eigendecomposition is used and the output mixture will not be unique.
wavefunction – A wavefunction to express over a qubit subset.
keep_indices – Which indices to express the wavefunction on.
atol – The tolerance for determining that a factored state is pure.
A single-component mixture in which the factored wavefunction has probability ‘1’ if the factored state is pure, or else a mixture of the default eigendecomposition of the mixed state’s partial trace.
ValueError – if the input wavefunction is not an array of length
(2 ** n) or a tensor with a shape of (2,) * n –