-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement process_counts in ExpectationMP, VarianceMP and CountsMP (#…
…5256) **Context:** Under #4941 abstract method `process_counts` was added to `SampleMeasurement`. This method provides support to process counts dictionary produced by external systems. **Description of the Change:** * Implement `process_counts` in `ExpectationMP`, `VarianceMP` and `CountsMP`. * While implementing `process_counts` in `CountsMP` some common logic was extracted from `ProbabilityMP` to `CountsMP` **Benefits:** The below methods won't throw `NotImplementedError` exception * `ExpectationMP.process_counts` * `VarianceMP.process_counts` * `CountsMP.process_counts` **Possible Drawbacks:** * All classes which inherit from `SampleMeasurement` implement `process_counts` except `SampleMP`. Should I add an implementation for that ? * After implementing `process_counts` in all child classes can we make the method abstract similar to `process_samples` ? This might break some tests where some classes inherit from `SampleMeasurement` as there `process_counts` is not implemented * It is assumed that `counts` dictionary is valid and caller is responsible to call with valid dictionary. It has already been discussed in this [conversation](https://github.com/PennyLaneAI/pennylane/pull/4952/files/eb9c1ee81ea87c274a5ec094f90a0065d05fdc36#r1433117236) and this is a design choice. **Related GitHub Issues:** This PR * fixes #5249 * fixes #5244 * fixes #5241 *** **Further details** I'm excited to be making my first open-source contribution with this PR 😄 . As a newcomer to the community, I'm eager to learn and improve. Any feedback for enhancements would be greatly appreciated! **Internal Shortcut Stories** - [sc-57166] - [sc-57274] - [sc-57307] --------- Co-authored-by: Christina Lee <[email protected]> Co-authored-by: Christina Lee <[email protected]>
- Loading branch information
1 parent
9d54b1c
commit 5157192
Showing
8 changed files
with
208 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters