-
Notifications
You must be signed in to change notification settings - Fork 617
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
_group_measurements in qubit sampling works with Prod, SProd, Sum, Hamiltonian #5525
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 #5525 +/- ##
==========================================
- Coverage 99.67% 99.66% -0.01%
==========================================
Files 406 407 +1
Lines 37934 37728 -206
==========================================
- Hits 37810 37603 -207
- Misses 124 125 +1 ☔ 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! Don't forget a changelog update 🚀
**Context:** PR #5525 led to two bugs: - `group_observables` uses `are_identity_pauli_words`, which does not work for legacy `Hamiltonian`. - `get_num_shots_and_executions` incorrectly counts number of executions for `Sum` **Description of the Change:** - Converts single-term `Hamiltonian` to `SProd` - Use the grouping information of `Sum` to correctly count number of executions. **Related Shortcut Issues:** [sc-61807] [sc-61812] Fixes #5561
Context:
The
_group_measurements
function inqubit/sampling.py
groups measurement processes with commuting observables together to reduce the number of executions. Now it does not handleProd
,SProd
or single-termHamiltonian
andSum
, which leads to inefficiencies with new opmath.Description of the Change:
Removes the branch that places
Prod
,SProd
,Hamiltonian
andSum
in separate groups. Nowis_pauli_word
is used for everything.Benefits:
Better grouping leads to fewer number of executions.
Related GitHub Issues:
Fixes #5512
Related Shortcut Stories:
[sc-61306]