diff --git a/docs/source/guide/executors.md b/docs/source/guide/executors.md index 11bb2ee9e..a578e60cc 100644 --- a/docs/source/guide/executors.md +++ b/docs/source/guide/executors.md @@ -30,7 +30,9 @@ To instantiate an `Executor`, provide a function which either: 1. Inputs a `mitiq.QPROGRAM` and outputs a `mitiq.QuantumResult`. 2. Inputs a sequence of `mitiq.QPROGRAM`s and outputs a sequence of `mitiq.QuantumResult`s. -**The function must be [annotated](https://peps.python.org/pep-3107/) to tell Mitiq which type of `QuantumResult` it returns. Functions with no annotations are assumed to return `float`s.** +```{warning} +To avoid confusion and invalid results, the executor function must be [annotated](https://peps.python.org/pep-3107/) to tell Mitiq which type of `QuantumResult` it returns. Functions without annotations are assumed to return `float`s. +``` A `QPROGRAM` is "something which a quantum computer inputs" and a `QuantumResult` is "something which a quantum computer outputs." The latter is canonically a bitstring for real quantum hardware, but can be other objects for testing, e.g. a density matrix. diff --git a/docs/source/guide/observables.md b/docs/source/guide/observables.md index 697911940..3978265c7 100644 --- a/docs/source/guide/observables.md +++ b/docs/source/guide/observables.md @@ -128,8 +128,8 @@ obs.expectation(circuit, execute=mitiq_cirq.sample_bitstrings) In error mitigation techniques, you can provide an observable to specify the expectation value to mitigate. -```{admonition} Note: -When specifying an `Observable`, you must ensure that the return type of the executor function is `MeasurementResultLike` or `DensityMatrixLike`. +```{warning} +As note in the [executor documentation](./executors.md#the-input-function), the executor must be annotated with the appropriate type hinting for the return type. Additionally, when specifying an `Observable`, you must ensure that the return type of the executor function is `MeasurementResultLike` or `DensityMatrixLike`. ``` ```{code-cell} ipython3