Returns a mixture representing a state vector with only some qubits kept.

The input state vector must have shape (2,) * n or (2 ** n) where state_vector is expressed over n qubits. States in the output mixture will retain the same type of shape as the input state vector, either (2 ** k) or (2,) * k where k is the number of qubits kept.

If the state vector cannot be factored into a pure state over keep_indices then eigendecomposition is used and the output mixture will not be unique.

state_vector The state vector to take the partial trace over.
keep_indices Which indices to take the partial trace of the state_vector on.
atol The tolerance for determining that a factored state is pure.

A single-component mixture in which the factored state vector has probability '1' if the partially traced state is pure, or else a mixture of the default eigendecomposition of the mixed state's partial trace.

ValueError if the input state_vector is not an array of length (2 ** n) or a tensor with a shape of (2,) * n