-
Notifications
You must be signed in to change notification settings - Fork 585
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
Fix qml.center
with linear combinations
#6049
Conversation
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 👍
Some minor things/questions. Could you add a bit more description of the involved math, since this is not super trivial and not explained in the doc string, would be good to at least have some explanation in the code as comment. That being said, is it really necessary to compute three kernels here?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6049 +/- ##
==========================================
- Coverage 99.66% 99.66% -0.01%
==========================================
Files 430 430
Lines 41762 41489 -273
==========================================
- Hits 41624 41349 -275
- Misses 138 140 +2 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com>
Yep, good point! Will do!
I'm not sure, maybe we can do Gram-Schmidt instead 🤔 I'll give it another attempt! |
@Qottmann Found a (probably) easier way for the kernel intersections. Added derivation for that new technique to docstring and put the intersection code into a helper function with dev docstring. |
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.
Very nice now! Just some minor things but overall looks good 👍
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 this great upgrade @dwierichs 💪
Is this a bug or am I once again not fully getting the definition of the center 🫠
|
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 @dwierichs ! Your documentation was really helpful in understanding what the function does. Nevertheless, I was still a bit confused so I've mostly just left questions for my own understanding in this review. Other than that, it looks good, and I'm ready to approve once my questions are resolved 🚀 😄
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
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 @dwierichs !
**Context:** Linear combinations were not taken into account in `qml.center`, making it miss center elements for some inputs. **Description of the Change:** Change the algorithm that computes the center. Kudos to @therooler for the prototype. **Benefits:** Correct code. **Possible Drawbacks:** ~~Slower performance for inputs that would have been fine before anyways.~~ This has been fixed by reverting to the previous implementation if `PauliWord` instances are passed only. **Related GitHub Issues:** Fixes #6048 [sc-70014] --------- Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com> Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com> Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Context:
Linear combinations were not taken into account in
qml.center
, making it miss center elements for some inputs.Description of the Change:
Change the algorithm that computes the center.
Kudos to @therooler for the prototype.
Benefits:
Correct code.
Possible Drawbacks:
Slower performance for inputs that would have been fine before anyways.This has been fixed by reverting to the previous implementation if
PauliWord
instances are passed only.Related GitHub Issues:
Fixes #6048
[sc-70014]