{ }
View source on GitHub |
Initialize a Scipy sparse matrix in a specific symmetry sector.
openfermion.linalg.get_number_preserving_sparse_operator(
fermion_op,
num_qubits,
num_electrons,
spin_preserving=False,
reference_determinant=None,
excitation_level=None
)
This method initializes a Scipy sparse matrix from a FermionOperator, explicitly working in a particular particle number sector. Optionally, it can also restrict the space to contain only states with a particular Sz.
Finally, the Hilbert space can also be restricted to only those states which are reachable by excitations up to a fixed rank from an initial reference determinant.
Returns | |
---|---|
sparse_op
|
scipy.sparse.csc_matrix
A sparse matrix representation of fermion_op in the basis set by the arguments. |