Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shots.bins() generator method (#5476)
**Context:** The current approach for sampling multiple shots involves handling shot vectors by sampling multiple times and processing each shot independently. However, a more efficient strategy would be to sample all shots at once and then process each bin separately. The `shots.bins()` method facilitates this by providing the lower and upper bounds for each bin. **Description of the Change:** - The `shots.bins()` method generates a sequence of tuples, where each tuple represents the lower and upper bounds of a bin. - In `_measure_with_samples_diagonalizing_gates` sample once with total number of shots and use `shots.bins()` to process each bin separately **Benefits:** This method is particularly useful for processing shot quantities in a partitioned manner, as it allows for the separate handling of each bin's range **Possible Drawbacks:** **Related GitHub Issues:** Fixes #5433 --------- Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
- Loading branch information