-
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.
Add support for QuantumCircuit.layout to qpy (#10148)
* Add support for QuantumCircuit.layout to qpy This commit adds the missing support for QuantumCircuit.layout to the qpy format. This necessitates bumping the QPY format version to 8 to accomodate the extra data needed for representing the details of the layout. The tricky piece with representing the 3 TranspileLayout attributes is representing the virtual bits in the initial layout because there is no guarantee that the input circuit's registers are in the output circuit (typically they are not when transpile() is used). Fixes #10112 * Fix handling of empty layout * Expand test coverage * Fix lint * Add qpy compat tests * Fix compat tests * Add release notes * Adjust layout creation to be register independent * Finish docs * Only check layout in compat tests with circuits * Fix typos * Fix doc typo in qiskit/qpy/__init__.py Co-authored-by: John Lapeyre <[email protected]> * Adjust introduction version for layout qpy compat tests * Unify qpy compat test version filter style * Add new line to layout error message * Simplify serialization logic Co-authored-by: Jake Lishman <[email protected]> * Doc fixes * Improve test coverage * Don't reuse bits between initial layout and circuit in qpy compat tests. * Update qiskit/qpy/__init__.py * Fix test typo * Use a register in compat tests for consistent equality * Update test/python/qpy/test_circuit_load_from_qpy.py --------- Co-authored-by: John Lapeyre <[email protected]> Co-authored-by: Jake Lishman <[email protected]>
- Loading branch information
1 parent
a945502
commit dbf1230
Showing
7 changed files
with
352 additions
and
6 deletions.
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
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
from qiskit.qpy import formats | ||
|
||
QPY_VERSION = 7 | ||
QPY_VERSION = 8 | ||
ENCODE = "utf8" | ||
|
||
|
||
|
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,12 @@ | ||
--- | ||
upgrade: | ||
- | | ||
The QPY format version emitted by :class:`~.qpy.dump` has increased to 8. | ||
This new format version adds support for serializing the | ||
:attr:`.QuantumCircuit.layout` attribute. | ||
fixes: | ||
- | | ||
Fixed the :mod:`~qiskit.qpy` serialization of :attr:`.QuantumCircuit.layout` | ||
attribue. Previously, the :attr:`~.QuantumCircuit.layout` attribute would | ||
have been dropped when serializing a circuit to QPY. | ||
Fixed `#10112 <https://github.com/Qiskit/qiskit-terra/issues/10112>`__ |
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
Oops, something went wrong.