-
Notifications
You must be signed in to change notification settings - Fork 603
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
add pow
method to operators
#2225
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #2225 +/- ##
========================================
Coverage 99.57% 99.58%
========================================
Files 243 243
Lines 19480 19595 +115
========================================
+ Hits 19397 19513 +116
+ Misses 83 82 -1
Continue to review full report at Codecov.
|
wow @albi3ro this is one powerhouse of a PR - I didn't realize you had added |
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.
Great stuff Christina!
Except from some docstring clarifications, my only important comment is the return type!
Oh, and there are still many codecov issues, but I assume you're on it.
Note: I am not very clued up about power rules, so I haven't checked that they are true.
@mariaschuld Thanks for all the good comments. I'll get to responding to the rest in a moment, but I first wanted to address why I decided to return a list of operations instead of a single operation. First, this will be used in Second, how do we handle the identity use case? I was initially having the method return an What happens if the base gate is across multiple wires, like And lastly, what if we want to support more intricate rules later? For example, we could decide to decompose |
In this case, could we just return |
@josh146 So maybe my last point about longer decomposition might not hold as well in the future when we have a |
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.
Once the pylint issues are resolved this is good to go from my side, as we decided to go with list return types for now!
This PR adds the
Operator.pow
method. This method will provide easier ways to decompose an operator raised to a power. It will be purely developer-facing. Users will raise operators to powers through either aqml.pow
constructor orop ** n
.Later PR's will:
Pow
wrapper arithmetic classqml.pow
contructor transform__pow__
method.When the power does not exist for the provided exponent, it raises a
qml.operation.PowUndefinedError
.