-
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
Add pauli_rep diagonalization #6113
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 #6113 +/- ##
==========================================
+ Coverage 98.72% 99.60% +0.88%
==========================================
Files 446 446
Lines 42934 42492 -442
==========================================
- Hits 42386 42326 -60
+ Misses 548 166 -382 ☔ View full report in Codecov by Sentry. |
…ane into pauli_rep_diagonalize
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, this was quite instructive to study.
I think in the PR branch there are some typos in doc (for example supported_base_obs
), but it looks like these have been fixed so it would only be necessary to merge from master.
I don't want to block this PR since it seems good to me. Still, I think I should not be the final reviewer since I still lack sufficient context about this project. Potentially, someone who reviewed the first PR and who is more familiar with Pauli words would be more recommended for the final approval.
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.
👍
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.
Minor docstring fixes, otherwise looks good. 🚀
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
**Context:** The diagonalization transform should default to the faster pauli implementation if all the observables have a `pauli_rep` and we are diagonalizing everything to the measurement basis. **Description of the Change:** Check if above contitions apply, and if so, use diagonalization via `rotations_and_diagonal_measurements` and `diagonalize_qwc_pauli_words` instead. Allow conversion to either `Z` or `eigvals` for both methods. Also includes a bug fix where the fallback method was failing to raise an error for non-commuting measurements when one of the measurements had no observable (like `qml.sample()`). **Benefits:** A common use case (all pauli words, everything has to be in the measurement basis) is diagonalized more efficiently. **Related Shortcut Stories:** [sc-60179] --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
**Context:** The diagonalization transform should default to the faster pauli implementation if all the observables have a `pauli_rep` and we are diagonalizing everything to the measurement basis. **Description of the Change:** Check if above contitions apply, and if so, use diagonalization via `rotations_and_diagonal_measurements` and `diagonalize_qwc_pauli_words` instead. Allow conversion to either `Z` or `eigvals` for both methods. Also includes a bug fix where the fallback method was failing to raise an error for non-commuting measurements when one of the measurements had no observable (like `qml.sample()`). **Benefits:** A common use case (all pauli words, everything has to be in the measurement basis) is diagonalized more efficiently. **Related Shortcut Stories:** [sc-60179] --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Context:
The diagonalization transform should default to the faster pauli implementation if all the observables have a
pauli_rep
and we are diagonalizing everything to the measurement basis.Description of the Change:
Check if above contitions apply, and if so, use diagonalization via
rotations_and_diagonal_measurements
anddiagonalize_qwc_pauli_words
instead. Allow conversion to eitherZ
oreigvals
for both methods.Also includes a bug fix where the fallback method was failing to raise an error for non-commuting measurements when one of the measurements had no observable (like
qml.sample()
).Benefits:
A common use case (all pauli words, everything has to be in the measurement basis) is diagonalized more efficiently.
Related Shortcut Stories:
[sc-60179]