-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix QPY deserialization of UCRX, UCRY, and UCRZ gates (#7933)
This commit fixes the deserialization of the UCRX, UCRY, and UCRZ gates. These gates aren't constructed in the standard way as other gate objects where the parameters are passed directly as args to the class constructor. Instead they behave the same as Initialize and the params are passed as a list to the constructor to make a new gate object. This commit fixes the handling in deserialization to treat these gates the same as Initialize so that it can be properly deserialized by qpy.load(). Fixes #7847 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
36a3d96
commit 2f182f6
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed an issue with QPY deserialization via the :func:`.qpy.load` function | ||
of the :class:`~.UCRXGate`, :class:`~.UCRYGate`, and :class:`~.UCRZGate`. | ||
Previously, a QPY file that contained any of these gates would error | ||
when trying to load the file. | ||
Fixed `#7847 <https://github.com/Qiskit/qiskit-terra/issues/7847>`__ | ||
issues: | ||
- | | ||
QPY deserialization with the :func:`.qpy.load` function of a directly | ||
instantiated :class:`~.UCPauliRotGate` object in a circuit will fail | ||
because the rotation axis argument to the class isn't stored in a standard | ||
place. To workaround this you can instead use the subclasses: | ||
:class:`~.UCRXGate`, :class:`~.UCRYGate`, or :class:`~.UCRZGate` (based on | ||
whether you're using a rotation axis of ``"X"``, ``"Y"``, or ``"Z"`` | ||
respectively) which embeds the rotation axis in the class constructor and | ||
will work correctly in QPY. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters