-
Notifications
You must be signed in to change notification settings - Fork 603
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 eigvals support to ExpectationMP, CountsMP, VarianceMP, SampleMP #5463
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5463 +/- ##
=========================================
Coverage ? 99.66%
=========================================
Files ? 402
Lines ? 37347
Branches ? 0
=========================================
Hits ? 37221
Misses ? 126
Partials ? 0 ☔ 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.
Looking good! Left a bit of feedback regarding the wires
check, otherwise just a couple very minor comments from me 🚀
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.
Fantastic, thanks @astralcai. I notice that some statements in strings have periods, and others do not (and I am not a massive fan of capital words), but it seems to me you just adapted such a style to the existing context.
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.
I'm a little hesitant to make specifying eigenvalues user-facing via the constructor functions.
While we do have internal logic for having eigvals+wires as the description for a measurement (see MeasurementProcess.expand
), it isn't particularly well supported right now (see PR #5445 for some other places things are going wrong). The bugfix is part of the first push to improving our support for this specification, but we need to more testing and support improvement.
I would recommend breaking this PR into two, one fixing the internal bug, and another making this representation user-facing. In that way, the bug fix won't be blocked by product concerns.
|
Could we just directly create a |
+1 to @albi3ro's comment, do we need to add another argument to |
|
I'd be fine with moving more validation and preprocessing into |
Co-authored-by: Christina Lee <christina@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 for adding this! Looks great :)
Context:
MeasurementProcess
supports specifyingeigvals
instead ofobs
, which should include sample based measurements such asExpectationMP
,VarianceMP
. However,process_samples
of these measurements does not work if the measurement was created usingeigvals
Description of the Change:
Adds
eigvals
support to variance sample measurementsBenefits:
Bugfix
Possible Drawbacks:
This fix only makes sure that the
process_samples
method would work. Specifically forexpval
, as it is also a state measurement, currently taking aexpval
in aqnode
with onlyeigvals
specified does not work.Related GitHub Issues:
Fixes #5432
[sc-59519]