Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ParameterVector handling in QPY serialization (#7381)
* Add ParameterVector handling to QPY serialisation This adds special handling for `ParameterVectorElement` instances within circuits on serialisation to QPY. These needed to be recreated into the correct class (as opposed to a raw `Parameter`) so that their sort order in `QuantumCircuit.parameters` would remain the same after a QPY round trip. Without special handling, once there were 10 or more elements in the vector, the naming (suffixed numbers with no leading zeros) would cause the sort order to be wrong. Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * Add parameter vector support to PauliEvolutionGate qpy * Add release note * Fix docs typo * Rename PARAMETER_VECTOR -> PARAMETER_VECTOR_ELEMENT * Support ParameterVectorElements in ParameterExpressions * Add compat tests for parameter vector in parameter expression * Fix lint * Update releasenotes/notes/fix-paramater-vector-qpy-52b16ccefecf8b2e.yaml Co-authored-by: Jake Lishman <jakelishman@gmail.com> * Emit warning in deserialization if a parameter vector isn't fully serialized in a qpy file * Serialize a ParameterVectorElement global phase correctly * Update test/python/circuit/test_circuit_load_from_qpy.py Co-authored-by: Julien Gacon <gaconju@gmail.com> * Improve docs * Apply suggestions from code review Co-authored-by: Jake Lishman <jakelishman@gmail.com> Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Julien Gacon <gaconju@gmail.com>
- Loading branch information