forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
Instruction.repeat
with conditionals (Qiskit#11940)
* Fix `Instruction.repeat` with conditionals We can't put register conditionals within an `Instruction.definition` field; the data model of `QuantumCircuit` doesn't permit closing over registers from within definitions. This commit moves a condition to the outer `Instruction` that's returned. * Avoid 'to_mutable' if not needed * Add proviso on repeated conditionals in documentation * Update wording in release note Co-authored-by: Luciano Bello <[email protected]> --------- Co-authored-by: Luciano Bello <[email protected]>
- Loading branch information
1 parent
f35cfd5
commit c126b45
Showing
3 changed files
with
64 additions
and
13 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
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/fix-instruction-repeat-conditional-dfe4d7ced54a7bb6.yaml
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,8 @@ | ||
--- | ||
fixes: | ||
- | | ||
The method :meth:`.Instruction.repeat` now moves a set :attr:`~.Instruction.condition` to the | ||
outer returned :class:`~.circuit.Instruction` and leave the inner gates of its definition | ||
unconditional. Previously, the method would leave :class:`.ClassicalRegister` instances within | ||
the inner definition, which was an invalid state, and would manifest itself as seemingly unrelated | ||
bugs later, such as during transpilation or export. Fixed `#11935 <https://github.com/Qiskit/qiskit/issues/11935>`__. |
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