Open garrison opened 6 months ago
Shouldn't it return {}
instead of some key-value pairs considering the fact that np.zeros([1024, 0])
is an empty array
Shouldn't it return
{}
instead of some key-value pairs considering the fact thatnp.zeros([1024, 0])
is an empty array
That array may be "empty" but it still has a shape. It just means there are 1024 instances of nothing.
Also, following my suggestion means there are fewer special cases a user must worry about; for instance, it maintains that the dict's values will sum up to the total number of shots, even if the register is empty.
Thanks @garrison . It looks like from_samples also breaks with num_bits=0, so we'd need to fix that too for full support.
Environment
What is happening?
BitArray
is not fully tested with empty classical registers. For instance,get_counts()
fails during the reshape if the output has zero bits. It appears thatget_int_counts()
will have the same problem, too.How can we reproduce the issue?
results in
What should happen?
I expect a sensible result, such as
{"": 1024}
forget_counts()
or{0: 1024}
forget_int_counts()
.Any suggestions?
No response