From 71a0a63e11f67343bb66c743798acaa883709a66 Mon Sep 17 00:00:00 2001 From: nate stemen Date: Mon, 7 Oct 2024 16:29:57 -0700 Subject: [PATCH] add instatiation example --- mitiq/typing.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mitiq/typing.py b/mitiq/typing.py index 1cae0400d..eba8f1252 100644 --- a/mitiq/typing.py +++ b/mitiq/typing.py @@ -112,6 +112,11 @@ class MeasurementResult: ``tuple(range(self.nqubits))``, where ``self.nqubits`` is the bitstring length deduced from ``result``. + Example: + >>> mr = MeasurementResult(["001", "010", "001"]) + >>> mr.get_counts() + {'001': 2, '010': 1} + Note: Use caution when selecting the default option for ``qubit_indices``, especially when estimating an :class:`.Observable`