-
Notifications
You must be signed in to change notification settings - Fork 615
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
fallback to scipy when linalg.matrix_power isn't available #4827
Merged
Conversation
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
timmysilv
commented
Nov 10, 2023
albi3ro
reviewed
Nov 10, 2023
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4827 +/- ##
==========================================
- Coverage 99.66% 99.65% -0.01%
==========================================
Files 382 382
Lines 34468 34213 -255
==========================================
- Hits 34351 34095 -256
- Misses 117 118 +1 ☔ View full report in Codecov by Sentry. |
albi3ro
approved these changes
Nov 13, 2023
lillian542
approved these changes
Nov 16, 2023
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.
🚀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context:
Tensorflow does not have a
matrix_power
function. For non-int powers, we always fall back to scipy, and we noticed that this works with Tensorflow as well! We can use this...Description of the Change:
scipy.linalg.fractional_matrix_power
. Until today, we just raised an error.Pow
is not trainable regardless, so there's no harm in adding this.QubitUnitary
to a non-int power (eg:qml.QubitUnitary(np.eye(2), wires=[0]).pow(3.5)
)Benefits:
Less errors! more features!
Possible Drawbacks:
QubitUnitary.pow
looks more complex to support more stuffRelated GitHub Issues:
Fixes #4825 [sc-49952]