-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Deprecate duplicate circuit gate method #10797
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
Conversation
One or more of the the following people are requested to review this:
|
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.
Is there a reason we shouldn't just make this a full deprecation now? It seems to me there isn't anything really to wait on before deprecating the aliases.
Also, the only one I'm questioning here is QuantumCircuit.id
, tbh I don't think I've ever used the i
method for an identity gate. It's a bit different too because wasn't it the proper method in the past?
True, the new path exists and we can just deprecate them 👍🏻 I was going for |
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
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.
This looks pretty straightforwards, thanks. Still needs a deprecation release note before it can be merged.
Added in 58ad6f2 👍🏻 |
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.
Looks good, thanks!
* Pending-deprecate duplicate circuit methods * Missed some old methods * may darkness rule (aka "run black") * Deprecate and id not i * use id over i * capture Aer's usage of QuantumCircuit.i * catch warning, don't assert * try fix errors Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> * Attempt 2 of ? Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> * Attempt 3 of 3 (hopefully) * redundant "+" * Filter the deprecation warning globally * add reno --------- Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Summary
Currently, several gates can be appended to the circuit with two differently named methods. As "circuit maintenance" and cleanup we would like to keep only a single way of doing this task. This PR deprecates duplicate quantum circuit gate methods to deprecate and remove them in following releases.
Details and comments
The methods that are kept are the ones aligned with the gate naming scheme. For example, the identity gate is called
CXGate
and notCnotGate
, therefore the plan is to removeQuantumCircuit.cnot
and only keep the exisitingQuantumCircuit.cx
. Note that this PR does not add any new methods but only removes duplicates.The deprecations are:
i
->id
(this is the only exception: the gate is calledIGate
butid
was voted to be more intuitive, andIGate
might go away in the future)cnot
->cx
toffoli
->ccx
mct
->mcx
fredkin
->cswap
No reno is added as nothing is deprecated yet.