-
Notifications
You must be signed in to change notification settings - Fork 571
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
Disallow taking the adjoint of fractional power operations #5835
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5835 +/- ##
==========================================
- Coverage 99.68% 99.67% -0.01%
==========================================
Files 420 420
Lines 40138 39847 -291
==========================================
- Hits 40010 39717 -293
- Misses 128 130 +2 ☔ View full report in Codecov by Sentry. |
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 PR looks good! All my comments are related to the case of whole-floats (e.g. z = 2.0
) which in my opinion should be treated as integers. But of course, I am open for discussion 😄
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.
We can handle exponents like z=1.0
at some later point. This fixes the issue.
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.
Based on our discussion, I also agree the current changes are fine for now 😃. Thank you for the discussion!
Context:
The adjoint of an integer power of an operator is the same power of the adjoint of the operator.
For fractional powers, this does not hold because of branch cuts in the power function.
Description of the Change:
This PR explicitly disallows computing the (eager) adjoint of a
Pow
operator with fractional power, and raises anAdjointUndefinedError
in this case.As a tiny side effect, this PR changes the signature of
Identity.pow
to be compatible with generalized simplification workflows where the keyword argumentz
for the power is passed around explicitly (this popped up in a simplification test ofPow
)NB: As usual, a lazy
Adjoint(Pow(base, z=0.2))
is still supported, just can't be evaluated/simplified if that would lead to calling the methodadjoint
ofPow
.Benefits:
Possible Drawbacks:
Related GitHub Issues:
Fixes #5812
[sc-65297]