-
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 registerless bit conditions in circuit_to_instruction (#7395)
* Fix registerless bit conditions in circuit_to_instruction This version of the change is stable for backports, but a more thorough refactor of `circuit_to_instruction` is in order to support multiple registers, overlapping registers and remove the creation of unnecessary registers. * Fix ambiguous cross-reference * Be consistent in writing conditions Co-authored-by: Kevin Krsulich <kevin@krsulich.net> Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
- Loading branch information
1 parent
309bfb1
commit 3562e26
Showing
3 changed files
with
33 additions
and
9 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
14 changes: 14 additions & 0 deletions
14
releasenotes/notes/fix-circuit_to_instruction_single-bit-condition-db75291ce921001a.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,14 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed conversion of :class:`.QuantumCircuit`\ s with classical conditions on | ||
single, registerless :class:`.Clbit` \s to :class:`~.circuit.Instruction`\ s when | ||
using the :func:`.circuit_to_instruction` function or the | ||
:meth:`.QuantumCircuit.to_instruction` method. For example, the following | ||
will now work:: | ||
from qiskit.circuit import QuantumCircuit, Qubit, Clbit | ||
qc = QuantumCircuit([Qubit(), Clbit()]) | ||
qc.h(0).c_if(qc.clbits[0], 0) | ||
qc.to_instruction() |
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