-
Notifications
You must be signed in to change notification settings - Fork 613
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
qml.counts
returns all outcomes when requested if MCM
s present
#6732
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
all_outcomes
used when MCM
present in circuitqml.counts
returns all outcomes when requested with MCM
s present
qml.counts
returns all outcomes when requested with MCM
s presentqml.counts
returns all outcomes when requested if MCM
s present
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.
All good! Thanks a lot for fixing this. Just minor suggestions nonblocking
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6732 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 475 475
Lines 45102 45110 +8
=======================================
+ Hits 44925 44933 +8
Misses 177 177 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Yushao Chen (Jerry) <[email protected]>
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 @andrijapau!
Co-authored-by: Pietropaolo Frisoni <[email protected]>
…e into fix-counts-with-mcm
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.
LGTM!
Context:
Previously, despite using
all_outcomes
,qml.counts
incorrectly returned only the states that have counts present,Description of the Change:
If
all_outcomes
is specified, the intermediatetmp
variable (used to keep track of measurement values fromMCM
s) defaults to aCounter
object that initializes all possible basis states as keys with their values set to zero. This counter is then updated based on the measurement results, where each mcm sample contributes to updating the counts, weighted by a validity factor.This results in the correct output,
or,
Benefits:
all_outcomes
kwarg inqml.counts
now works as intended whenmcm_method="one-shot"
andMCM
operations are present.Possible Drawbacks:
tmp
object creation doesn't scale well with higher qubit counts.Related GitHub Issues: Fixes #6700
[sc-80206]