ham_bqm_to_ham_operator#
- iqm.qaoa.transforming_functions.ham_bqm_to_ham_operator(ham_bqm)[source]#
A function to transform Hamiltonian represented as a BQM into a
SparsePauliOp.A Hamiltonian as
SparsePauliOpmay be used byqiskitfunctions that e.g., calculate expectation values.- Parameters:
ham_bqm (BinaryQuadraticModel) – A
BinaryQuadraticModelwithvartype=SPIN, i.e., the linear and quadratic terms correspond to the coefficients before the corresponding Z and ZZ operators in the problem Hamiltonian.- Returns:
The Hamiltonian as
SparsePauliOpto be used byqiskit.- Return type: