-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 primitives.containers.BitArray
container class
#11542
Conversation
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 7505848919Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
I think the main open question is do we use |
This PR looks good. I wait for the discussion of |
I am in favour of using Pros:
Cons:
IMO these pros outweigh the cons and is the path of least confusion. |
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 have to side with @ihincks here, shots is the established convention, and I believe that changing the term will be more confusing than beneficial. On top of this, "samples" is already pretty overloaded within IBM quantum projects, for example, to refer to the sub-experiments using circuit knitting techniques, or to refer to pulse samples. A quick search of samples
on the qiskit repo yields 69 results in the codebase.
I think "samples" being used heavily in the pulse layer is a good argument for sticking with "shots". I would also say we could go further and look to remove the terminology of using samples in twirling/circuit knitting and use a different name eg "randomizations" would be more descriptive for twirling |
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.
Couple of comments
Co-authored-by: Christopher J. Wood <[email protected]>
Co-authored-by: Christopher J. Wood <[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.
LGTM
* Add BitArray class and tests This reverts commit bb5b9e1. * change samples->shots for consistency with SamplerV2 * continue renaming samples>shots * final rename of samples -> shots * Update qiskit/primitives/containers/bit_array.py Co-authored-by: Christopher J. Wood <[email protected]> * Apply suggestions from code review Co-authored-by: Christopher J. Wood <[email protected]> * update the constructor to demand ndarray with unit8 * change behaviour of get_counts() as suggested by Chris * fix linting --------- Co-authored-by: Christopher J. Wood <[email protected]>
Summary
This PR introduces the
BitArray
class whose purpose is to store an array of bit values, and be the fundamental result type inside for SamplerV2 for those circuit outputs that are bit valued.Instances of this object contain a single, contiguous block of data that represents an array of bitstrings. The last axis is over packed bits, the second last axis is over shots, and the preceding axes correspond to the shape of the pub that was executed to sample these bits.
There are helper functions for converting from/to other formats, as well as for performing bitwise operations directly on the data chunk.
Details and comments
See also Qiskit/RFCs#56