Restrict a Jordan-Wigner encoded state to a given particle number

state ndarray or sparse

Numpy vector in the space of n_qubits.

n_electrons int

Number of particles to restrict the state to

n_qubits int

Number of qubits defining the total state

new_operator ndarray or sparse

Numpy vector restricted to states with the same particle number. May not be normalized.