-
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
Adding annotated argument to power methods #12101
Conversation
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 8804886395Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
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.
LGTM, this is a fairly straightforward addition, and inline with what was done for inverse()
and control()
. I just pushed a small change to the docstrings to make it explicit that the return will not be a UnitaryGate
or AnnotatedOperation
in cases when the power is a defined standard gate; and then removed some docstring overloading from subclasses in the standard gate library.
Summary
This commit adds the
annotated
argument to thepower
method ofQuantumCircuit
,AnnotatedOperation
,Gate
and its child classes, similarly to how it was added toinverse
andcontrol
methods in #11433 and #11593. As before, for the basic gates which have their ownpower
methods, this argument is ignored, e. g.,SGate
raised to a power is an instance of thePhaseGate
ignoring theannotated
argument. But forQuantumCircuit
,Gate
and its subclasses without a nativepower
method, settingannotated
toTrue
would return an instance ofAnnotatedOperation
and not ofUnitaryGate
. This allows to delay the actual computation to the transpiler, and in principle allows additional optimizations.Details and comments