-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Update BitArray.get_counts() to support zero classical registers #12317
base: main
Are you sure you want to change the base?
Update BitArray.get_counts() to support zero classical registers #12317
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 8979374846Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
fde2ef7
to
90ac40c
Compare
511b5c7
to
1324a5d
Compare
Thanks for taking this on @atharva-satpute . I think we will also need to make sure that from_bitstrings, from_int also support the num_bits=0 case, because I suspect that they don't right now. |
Sure |
@ihincks It seems BitString doesn't support from_bitstrings or from_int. The only reference I see to from_bitstrings is in the documentation of the DataBin class. However, @atharva-satpute , I think it should probably support |
What would |
Summary
Fixes #12062
Added support for zero classical registers in
BitArray.get_counts()
,BitArray.get_int_counts()
andBitArray.get_bitstring()
Details and comments
BitArray
is initialised with zero classical registers it will return{'': <count>}
forget_counts()
and{0: <count>}
forget_int_counts()
loc
is notNone
andarr
is a number (arr = self._array[loc]
), this would throw aTypeError
on line, to handle this convertedarr
tonp.array
and along with this, checkingarr.size == 0
in caseget_bitstring()