Interaction.operator_to_mat¶
- static Interaction.operator_to_mat(generator, num_species, basis=None)¶
Compute the matrix representation of the fermion operator.
- Parameters:
generator (
FermionicOp
) – fermion operator of which to compute the matrix representation.num_species (
int
) – Number of fermion species which defaults to 1.basis (
Optional
[FermionicBasis
]) – The basis in which to return the matrix. If None is given then the matrix will be returned in the full basis.
- Return type:
csc_matrix
- Returns:
scipy.sparse matrix of the Hamiltonian.
- Raises:
QiskitColdAtomError – If the type of the generator is not a FermionicOp.
QiskitColdAtomError – If the fermion operator does not match the expected shape.