-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate the condition attribute and related functionality #13223
Merged
Merged
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9259102
Deprecate the condition attribute and related functionality
mtreinish 3669504
Add missing assertWarns
mtreinish 0ce9f3f
Merge branch 'main' into deprecate-condition_cif
mtreinish ecd2976
Handle deprecation warnings in visual tests too
mtreinish 576b523
Apply suggestions from code review
mtreinish 5edf528
Merge remote-tracking branch 'origin/main' into deprecate-condition_cif
mtreinish d4c868a
Use private attribute in py->rust conversion
mtreinish 86914e8
Avoid deprecation warning in non-deprecated code
mtreinish 099b610
Add missing test updates
mtreinish 1987fb2
Merge branch 'main' into deprecate-condition_cif
ElePT 4bf68ea
Merge remote-tracking branch 'origin/main' into deprecate-condition_cif
mtreinish 706d24d
Add filter for aer's condition usage and dag drawer
mtreinish 5a77b3e
Fix lint
mtreinish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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` attribute and the | ||
:meth:`.Instruction.c_if` method. They will be removed | ||
in Qiskit 2.0, along with any uses in the Qiskit data | ||
model. This functionality has been superseded by the :class:`.IfElseOp` class | ||
which can be used to describe a classical condition in a circuit. For | ||
example, a circuit using :meth:`.Instruction.c_if` 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 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just started addressing this deprecation warning and noticed some issues here. I think it should be
qc.z(1)
(missing parenthesis). Also, I thinkexpected
should beqc
?