IsingToQuadraticProgram.encode¶
- IsingToQuadraticProgram.encode(qubit_op, offset=0.0)[source]¶
Convert a qubit operator and a shift value into a quadratic program
- Parameters
qubit_op (
WeightedPauliOperator
) – The qubit operator to be converted into aQuadraticProgram
offset (
float
) – The shift value of the qubit operator
- Return type
- Returns
QuadraticProgram converted from the input qubit operator and the shift value
- Raises
QiskitOptimizationError – If there are Pauli Xs in any Pauli term
QiskitOptimizationError – If there are more than 2 Pauli Zs in any Pauli term