2
$\begingroup$

My question should be fairly simple, though I did not find an answer to it here or anywhere else.

I have been working on an algorithm which, similarly to the HHL algorithm, provides a state $|x\rangle$ for which I want to extract some global quantity at the end. I now want to build a simple few-qubits implementation of such algorithm and for that I would like to find the $\texttt{Absolute Average}$ given by $\frac{1}{N}\big|\sum_{i=1}^Nx_i\big|$, which is clearly possible according to this tutorial to Qiskit's HHL implementation.

However, I am struggling to understand which observable $M$ I should apply in order to get this quantity from $\langle x|M|x\rangle$.

$\endgroup$
2
$\begingroup$

Let $|+\rangle$ denote the uniform superposition state with zero relative phases. Then

$$ \langle +|x\rangle = \frac{1}{\sqrt{N}}\begin{bmatrix}1&1&\dots&1\end{bmatrix}\begin{bmatrix}x_1\\x_2\\\dots\\x_N\end{bmatrix} = \frac{1}{\sqrt{N}}\sum_{i=1}^Nx_i. $$

For $M$ defined as $M:=|+\rangle\langle+|$, we have

$$ \langle x|M|x\rangle = \langle x|+\rangle\langle+|x\rangle = \frac{1}{N}\left|\sum_{i=1}^Nx_i\right|^2 $$

so we can obtain the absolute average from the measurement of $\langle x|M|x\rangle$ using

$$ \frac{1}{N}\left|\sum_{i=1}^Nx_i\right| = \sqrt{\frac{\langle x|M|x\rangle}{N}}. $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.