qiskit_addon_sqd.qubit.project_operator_to_subspace¶
- project_operator_to_subspace(bitstring_matrix, hamiltonian, *, verbose=False)[source]¶
Projects a Pauli operator into a subspace.
The subspace is defined by a collection of computational basis states, which are specified by the bitstrings (rows) in
bitstring_matrix
.- Parameters:
bitstring_matrix (ndarray) – A 2D array of
bool
representations of bit values such that each row represents a single bitstring. This set of bitstrings specifies the subspace into which thehamiltonian
will be projected and diagonalized.hamiltonian (SparsePauliOp) – A Hamiltonian specified as a Pauli operator.
verbose (bool) – whether to print the stage of the subroutine.
- Returns:
A scipy.sparse.coo_matrix representing the operator projected in the subspace.
- Raises:
ValueError – Bitstrings (rows) in
bitstring_matrix
must have length <64
.- Return type:
spmatrix