-
Notifications
You must be signed in to change notification settings - Fork 631
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
Reimplement qubit unitary #6986
Reimplement qubit unitary #6986
Conversation
Co-authored-by: Christina Lee <[email protected]>
@JerryChen97, are these CI tests supposed to fail? |
Sorry, forgot to fix them on e2e branch. I'll fix soon |
External fail is exactly the same as this morning. Just ignore it until we merge this PR to e2e branch and update there with master |
**Context:** In our on-going sparse matrix epic, we used to postponed the full implementation of controlled ops family due to others of higher priorities. However, in a related PR https://github.com/PennyLaneAI/pennylane/actions/runs/13464002433/job/37625640042?pr=6986 it seems inevitable to have the `wire_order` branch of `Controlled.sparse_matrix` method implemented. For the sake of traceability, and to prevent some the mentioned PR from being furthermore spaghettized with high entanglement, we implement the `wire_order` branch here with unit tests, and watch and fix whatever new impact introduced as an independent PR instead of hotfix overthere. **Description of the Change:** Direct call `expand_matrix` just as what `matrix()` did above `sparse_matrix`, right before format-convert. Convert the error-raise test into a consistency-check with `matrix(wire_order=...)` **Benefits:** Fully fledged sparse `Controlled` Unblock #6986 **Possible Drawbacks:** Small chance to still have incompatibility in the future, which is also why we would like to have this separated such that easy to revert. **Related GitHub Issues:** [sc-84949] --------- Co-authored-by: Andrija Paurevic <[email protected]>
😅Messed up with the git branch control |
cfaa2aa
to
7a24f16
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## e2e-sparse-default-qubit #6986 +/- ##
===========================================================
Coverage ? 99.59%
===========================================================
Files ? 483
Lines ? 46156
Branches ? 0
===========================================================
Hits ? 45971
Misses ? 185
Partials ? 0 ☔ View full report in Codecov by Sentry. |
@AmintorDusko @albi3ro Now we have cleared the errors. Major changes since last check: 1. |
Co-authored-by: Christina Lee <[email protected]>
Hey @JerryChen97, we still have some work to do regarding this error. |
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.
Nice job! I don't see any blocker but I have a few questions.
It should work as inherited from parents
I wonder if you know what is happening with PennyLane wheels here. |
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 for that change 👍
PL CI affected by setuptools updates. Fix coming soon. |
CI back and passed |
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.
Nice job!
Context:
Our current sparse repr for
QubitUntiary
is quite confusing: itsmatrix()
return a sparse matrix by default, if this obj was instantiated by a CSR, which is inconsistent from what we expected for other operators, thatmatrix()
should return a dense andsparse_matrix()
gives out the sparse, well separated from each other.Therefore, a slight re-work is needed to make things clearer. Basically, we will overload the
has_matrix
andhas_sparse
from parents and have a more friendly and straightforward usage.Description of the Change:
Benefits:
Possible Drawbacks:
Related GitHub Issues: