About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
qiskit.result.marginal_distribution
marginal_distribution(counts, indices=None, format_marginal=False)
Marginalize counts from an experiment over some indices of interest.
Unlike marginal_counts()
this function respects the order of the input indices
. If the input indices
list is specified then the order the bit indices are specified will be the output order of the bitstrings in the marginalized output.
Parameters
- counts (
dict
) – result to be marginalized - indices (
Optional
[Sequence
[int
]]) – The bit positions of interest to marginalize over. IfNone
(default), do not marginalize at all. - format_marginal (
bool
) – Default: False. If True, takes the output of marginalize and formats it with placeholders between cregs and for non-indices.
Returns
A marginalized dictionary
Return type
dict(str, int)
Raises
- QiskitError – If any value in
indices
is invalid or thecounts
dict - is invalid. –
Was this page helpful?
Report a bug or request content on GitHub.