-
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
deprecate qml.matrix with wire_order=None #5039
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 #5039 +/- ##
==========================================
- Coverage 99.67% 99.66% -0.02%
==========================================
Files 394 394
Lines 35670 35389 -281
==========================================
- Hits 35554 35270 -284
- Misses 116 119 +3 ☔ 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.
looks good to me!
# Conflicts: # doc/development/deprecations.rst # doc/releases/changelog-dev.md
**Context:** Wire-ordering can surprise people because PennyLane gives no promises. For example: ```pycon >>> qs = qml.tape.QuantumScript([qml.Identity(1), qml.CNOT([0, 1])]) >>> qml.matrix(qs) array([[1., 0., 0., 0.], [0., 0., 0., 1.], [0., 0., 1., 0.], [0., 1., 0., 0.]]) ``` This is in wire-order `[1, 0]` because that's the order in which they appeared in the tape. Most users would expect the other way. **Description of the Change:** Deprecate the default `wire_order=None` value in `qml.matrix` in certain cases. The warning is raised if: - the object is a tape with more than one wire - the object is a QNode and the device does not provide wires - the object is a qfunc **Benefits:** Users won't be surprised when they get a matrix in an unexpected wire order **Possible Drawbacks:** More deprecations, the user has to enter wire_order even though it's often safe to assume they meant ascending integers (but not often enough, so here we are) **Related GitHub Issues:** It was discussed in #3131 [sc-51277]
Context:
Wire-ordering can surprise people because PennyLane gives no promises. For example:
This is in wire-order
[1, 0]
because that's the order in which they appeared in the tape. Most users would expect the other way.Description of the Change:
Deprecate the default
wire_order=None
value inqml.matrix
in certain cases. The warning is raised if:Benefits:
Users won't be surprised when they get a matrix in an unexpected wire order
Possible Drawbacks:
More deprecations, the user has to enter wire_order even though it's often safe to assume they meant ascending integers (but not often enough, so here we are)
Related GitHub Issues:
It was discussed in #3131
[sc-51277]