-
Notifications
You must be signed in to change notification settings - Fork 54
Description
The GateModelResultData.get_probabilities() method currently computes a probability distribution based on the measurement counts:
qBraid/qbraid/runtime/result.py
Lines 163 to 164 in 03aa38b
| counts = self.get_counts(include_zero_values=include_zero_values, decimal=decimal) | |
| probabilities = counts_to_probabilities(counts) |
This works well for QPUs and for simulators that return raw measurement counts. However, many ideal quantum simulators compute the exact quantum state, providing deterministic results. These simulators do not involve probabilistic sampling, and the concept of shots does not apply. Consequently, these simulators do not return raw measurements or measurement counts, but instead provide direct probability data (histogram).
To better support these simulators, the GateModelResultData class should be updated to optionally accept pre-computed probabilities. This would allow get_probabilities() to return these probabilities directly, without needing to calculate them from counts.
TODO
- Add an optional argument to the
GateModelResultDataclass to accept pre-computed probabilities. - If probabilities are provided,
get_probabilities()should return them directly. - If probabilities are not provided,
get_probabilities()should maintain its current behavior of calculating probabilities based onget_counts(). - Regardless of whether probabilities are computed from counts or provided directly,
get_probabilities()should continue to respect thedecimal=True/Falseoption for formatting keys. - Since the function for normalizing data will now apply to both counts and direct probability histograms, consider renaming
normalize_counts()to something more general, likenormalize_histogram_data().