-
Notifications
You must be signed in to change notification settings - Fork 586
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
Making wires
the last positional argument for several classes
#5643
Conversation
wires
as the last positional argumentwires
the last positional argument for several classes
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5643 +/- ##
==========================================
- Coverage 99.69% 99.68% -0.01%
==========================================
Files 412 412
Lines 38619 38352 -267
==========================================
- Hits 38500 38233 -267
Misses 119 119 ☔ 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, thanks for the quick fix @PietropaoloFrisoni ! 💯
I might have overlooked it, but is there any test where BasisRotation
is instantiated with unitary_matrix
as positional argument? Might be good to have that in as well, just by changing some arbitrary test. Maybe the test_standard_validity
test :)
Thanks @dwierichs. Actually, I changed the order of the arguments in the tests as well (even where it was not technically necessary) just to be consistent. in |
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.
Thanks @PietropaoloFrisoni I iterated my suggestion. It's good to go from my side either way.
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 is looking good, and I'm sorry to bring this up right now, but I'd like to propose another option for AllSinglesDoubles
.
We coudl instead default hf_state=None
, and then if hf_state is None
, we simply don't include the BasisState
op in the decomposition.
@albi3ro No problem, I am fine with everything the @PennyLaneAI/algorithms is happy with |
Closing the PR since it has been decided not to fix #5521 |
**Context:** Fixing doc typos that I found while working on #5643 (which has been closed)
Context: Currently, as noticed in this issue,
qml.GateFabric
,qml.AllSinglesDoubles
, andqml.BasisRotation
do not havewires
as the last positional argument, which is a requirement for pennylane operations. This might be confusing for users.Description of the Change: In
qml.GateFabric
, we madeinit_state
akwarg
instead of a positional argument, with an initial default state as the all-zeros state. Forqml.AllSinglesDoubles
andqml.BasisRotation
we simply changed the argument order. Now,wires
is the rightmost positional argument in all three cases.Benefits: Now, the three Python classes above have an argument order in accordance with pennylane requirements. Additionally, now
qml.AllSinglesDoubles
also accepts alist
ashf_state
parameter (not necessarily anumpy
array).Possible Drawbacks: In the case of
qml.AllSinglesDoubles
andqml.BasisRotation
, this is technically a breaking change since we changed the argument order:Related GitHub Issues: #5521
[sc-61430]