forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate the condition attribute and related functionality
This commit deprecates the Instruction.condition and c_if() method for removal in 2.0. This functionality has been superseded by the more sophisiticated `IfElseOp` for some time now. Removing the condition property will simplify the Qiskit data model as it is implemented in a kind of ad-hoc manner that adds additional overhead to manually check it in many places. For the unittest modifications the deprecation warning for the .condtion getter is suppressed for the entire suite because this gets triggered internally by the transpiler and a lot of other places, including from rust code as until it is removed we need to use it to check that piece of the data model. Fixes Qiskit#9556
- Loading branch information
Showing
83 changed files
with
1,799 additions
and
882 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
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
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
38 changes: 38 additions & 0 deletions
38
releasenotes/notes/deprecate-condition_c_if-9548e5522814fe9c.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,38 @@ | ||
--- | ||
deprecations_circuits: | ||
- | | ||
Deprecated the :attr:`.Instruction.condition` and the | ||
:meth:`.Instruction.c_if` method. This attribute and method will be removed | ||
in Qiskit 2.0 and along with any other uses of this in the Qiskit data | ||
model. This functionality has been superseded by the :class:`.IfElseOp` | ||
which can be used to describe a classically condition in a circuit. For | ||
example, a circuit using :attr:`.Instruction.condition` like:: | ||
from qiskit.circuit import QuantumCircuit | ||
qc = QuantumCircuit(2, 2) | ||
qc.h(0) | ||
qc.x(0).c_if(0, 1) | ||
qc.z(1.c_if(1, 0) | ||
qc.measure(0, 0) | ||
qc.measure(1, 1) | ||
can be rewritten using as:: | ||
qc = QuantumCircuit(2, 2) | ||
qc.h(0) | ||
with expected.if_test((expected.clbits[0], True)): | ||
qc.x(0) | ||
with expected.if_test((expected.clbits[1], False)): | ||
qc.z(1) | ||
qc.measure(0, 0) | ||
qc.measure(1, 1) | ||
The now deprecated :class:`.ConvertConditionsToIfOps` transpiler pass can | ||
be used to automate this conversion for existing circuits. | ||
deprecations_transpiler: | ||
- | | ||
The transpiler pass :class:`.ConvertConditionsToIfOps` has been deprecated | ||
and will be removed in Qiskit 2.0.0. This class is now deprecated because | ||
the underlying data model for :attr:`.Instruction.condition` which this | ||
pass is converting from has been deprecated and will be removed in 2.0.0. |
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
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.