2022-09-22 10:45:05 +08:00
|
|
|
---
|
|
|
|
upgrade:
|
|
|
|
- |
|
|
|
|
Updated :class:`~qiskit.result.ProbDistribution` and :class:`~qiskit.result.QuasiDistribution`
|
|
|
|
to store the information of the number of bits if bitstrings without prefix "0b" are given.
|
2022-10-14 20:05:47 +08:00
|
|
|
:meth:`.ProbDistribution.binary_probabilities` and
|
|
|
|
:meth:`.QuasiDistribution.binary_probabilities` use the stored number of bits
|
2022-09-22 10:45:05 +08:00
|
|
|
as the default value of the number of bits.
|
|
|
|
|
|
|
|
.. code-block: python
|
|
|
|
|
|
|
|
import qiskit.result import ProbDistribution, QuasiDistribution
|
|
|
|
|
|
|
|
prob = ProbDistribution({"00": 0.5, "01": 0.5})
|
|
|
|
quasi = QuasiDistribution({"00": 0.5, "01": 0.5})
|
|
|
|
|
|
|
|
print(prob.binary_probabilities())
|
|
|
|
# {'00': 0.5, '01': 0.5}
|
|
|
|
|
|
|
|
print(quasi.binary_probabilities())
|
|
|
|
# {'00': 0.5, '01': 0.5}
|