# RandomWalkPhaseEstimation operation

Namespace: Microsoft.Quantum.Research.Characterization

Package: Microsoft.Quantum.Research.Characterization

Performs iterative phase estimation using a random walk to approximate Bayesian inference on the classical measurement results from a given oracle and eigenstate.

```
operation RandomWalkPhaseEstimation (initialMean : Double, initialStdDev : Double, nMeasurements : Int, maxMeasurements : Int, unwind : Int, oracle : Microsoft.Quantum.Oracles.ContinuousOracle, targetState : Qubit[]) : Double
```

## Input

### initialMean : Double

Mean of the initial normal prior distribution over $\phi$.

### initialStdDev : Double

Standard deviation of the initial normal prior distribution over $\phi$.

### nMeasurements : Int

Number of measurements to be accepted into the final posterior estimate.

### maxMeasurements : Int

Total number of measurements than can be taken before the operation is considered to have failed.

### unwind : Int

Number of results to forget when consistency checks fail.

### oracle : ContinuousOracle

An operation representing a unitary $U$ such that $U(t)\ket{\phi} = e^{i t \phi}\ket{\phi}$ for eigenstates $\ket{\phi}$ with unknown phase $\phi \in \mathbb{R}^+$.

### targetState : Qubit[]

A register that $U$ acts on.

## Output : Double

The final estimate $\hat{\phi} \mathrel{:=} \expect[\phi]$ , where the expectation is over the posterior given all accepted data.

## Remarks

### Iterative Phase Estimation and Eigenstates

In general, the input register `eigenstate`

need not be an
eigenstate $\ket{\phi}$ of $U$, but can be a superposition over
eigenstates. Suppose that the input state is given by
\begin{align}
\ket{\psi} & = \sum_{j} \alpha_j \ket{\phi_j},
\end{align}
where ${\alpha_j}$ are complex coefficients such that
$\sum_j |\alpha_j|^2 = 1$ and where $U\ket{\phi_j} = \phi_j\ket{\phi_j}$.

Then, performing iterative phase estimation will eventually converge to a single eigenstate, as described in the development guide.

### Experiment Design

The measurement times $t$ and inversion angles $\theta$
passed to `oracle`

are chosen according to
the *particle guess heuristic*,
\begin{align}
\theta \sim \Pr(\phi),\quad t \approx \frac{1}{\variance{\phi}}.
\end{align}
This heuristic is optimal for reducing the expected posterior variance
in iterative phase estimation under the assumption of a normal prior.

### Optimality

This operation approximates the optimal estimator for the phase $\phi$, as evaluated using the quadratic loss $L(\phi, \hat{\phi}) \mathrel{:=} (\phi - \hat{\phi})^2$.

See Bayesian Phase Estimation for more details on the statistics of iterative phase estimation.

## References

- Ferrie
*et al.*2011 doi:10/tfx, arXiv:1110.3067. - Wiebe
*et al.*2013 doi:10/tf3, arXiv:1309.0876 - Wiebe and Granade 2018
*(in preparation)*.

## Feedback

Submit and view feedback for