You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PassManager in Step 2 "Apply Swap strategies" from the "how_to_build_qaoa_swap_circuit.ipynb" notebook raises an error message for "linear" Pauli Strings in the SparsePauliOp (e.g. 'ZIIIIIIIII'; containing only a single Z Pauli and Identities otherwise instead of the exemplary used two Z Pauli strings, e.g. 'ZZIIIIIIII') . These linear terms can be relevant for optimization problems.
Reproduce the code example:
Initializing the Sparse Pauli Operator in the notebook with an additional Pauli String and coeeficient of the form ['ZIIIIIIIII', 1.] and running the notebook reproduces the error.
E.g. Insert the following code instead of the second cell of the notebook and continue all steps including calling swapped_cost_layer = pm_pre.run(cost_layer).
280 """Run all the passes on a ``circuit``.
281
282 Args:
(...)
...
110 if len(edge) != 2:
--> 111 raise QiskitError(f"{pauli} does not have length two.")
113 return edge
QiskitError: 'ZIIIIIIIII does not have length two.'
The text was updated successfully, but these errors were encountered:
I would handle terms with a single Z by filtering them out and creating a layer of Rz gates (applied on qubits that should have one). This layer of Rz gates must then be applied before the layers of Rzz's of the quadratic term when p is odd and after the layers of Rzz's when p is even.
Describe the issue:
The PassManager in Step 2 "Apply Swap strategies" from the "how_to_build_qaoa_swap_circuit.ipynb" notebook raises an error message for "linear" Pauli Strings in the SparsePauliOp (e.g. 'ZIIIIIIIII'; containing only a single Z Pauli and Identities otherwise instead of the exemplary used two Z Pauli strings, e.g. 'ZZIIIIIIII') . These linear terms can be relevant for optimization problems.
Reproduce the code example:
Initializing the Sparse Pauli Operator in the notebook with an additional Pauli String and coeeficient of the form ['ZIIIIIIIII', 1.] and running the notebook reproduces the error.
E.g. Insert the following code instead of the second cell of the notebook and continue all steps including calling swapped_cost_layer = pm_pre.run(cost_layer).
Error message:
The text was updated successfully, but these errors were encountered: