iqm.benchmarks.utils.marginal_distribution

iqm.benchmarks.utils.marginal_distribution#

iqm.benchmarks.utils.marginal_distribution(prob_dist_or_counts: dict[str, float | int], indices: Iterable[int]) dict[str, float]#

Compute the marginal distribution over specified bits (indices).

Parameters:
  • prob_dist_or_counts (dict[str, float | int]) – A dictionary with keys being bitstrings, and values are either probabilities or counts.

  • indices (Iterable[int]) – A list of bit indices to marginalize over.

Returns:

A dictionary representing the marginal distribution over the specified bits.

Return type:

dict[str, float]