-
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 post-selection method to BitArray
#12688
Comments
cc @aeddins-ibm |
I wonder if we can make this easier for the user than the proposed signature above. Having Can we simplify the signature to more closely match this?
The values of qiskit/qiskit/primitives/containers/bit_array.py Lines 408 to 419 in 25c0542
Then the ordering of values in Then Modified signature:
|
For reference in making a PR, I believe this function works, though it could use more testing to confirm. It is missing the operation to flatten the BitArray. Since it uses
Ian, you had asked separately about the change qiskit/qiskit/primitives/containers/bit_array.py Lines 208 to 210 in 25c0542
|
I close this because #12693 has been merged |
What should we add?
We should add a method that helps to filter shots by post-selection. The user should be able to make requests such as "I would like all of the shots where bits 15 and 18 are in the state
01
".There is a complication to do with the shaped nature of BitArray: each index of the shape might result in a different number of post selections. For example, if the original BitArray has 100 shots, the example above might result in 57 post-selections on the first index, 17 on the second, and so forth. To get around this, I propose that the post-selection method always flattens the data. Alternate proposals welcome. For example, if a data BitArray has shape (2,3,4) and num_shots=20, then the post-selection specification would first flatten into a BitArray of shape () and num_shots=2023*4, and apply the post selection there.
Proposed signature:
The text was updated successfully, but these errors were encountered: