positions_to_pauli_string#
- iqm.qaoa.transforming_functions.positions_to_pauli_string(positions, num_qubits)[source]#
Create a string with the character “Z” on the specified positions and the character “I” elsewhere.
The string is intended to be used to construct a
PauliListand from it aSparsePauliOp.- Parameters:
- Returns:
The Pauli string.
- Raises:
ValueError – If any of the qubit indices is negative or too large (more than
num_qubits-1).- Return type: