CQCL / phayes

Easy and efficient Bayesian quantum phase estimation
Apache License 2.0
2 stars 1 forks source link

How to extend to quantum amplitude estimation? #4

Open SamDuffield opened 1 year ago

SamDuffield commented 1 year ago

Quantum amplitude estimation (QAE) can be achieved using a similar low-depth circuit and likelihood-based statistical approach as phase estimation - see Suzuki et al.

Would it be possible to adapt phayes to be useful for QAE too? Certainly the Fourier + von Mises representation and update implementation can be used as the QAE likelihood has the same Fourier form, but what about the optimal parameter selection?

SamDuffield commented 1 year ago

For likelihood based QAE, it appears the noiseless likelihood (equation (4) in Suzuki et al) takes the form

$$p(m \mid \phi, k) = \frac12\left(1 + \cos(2(2k+1)\phi - m \pi)\right),$$

compared to the QPE likelihood:

$$p(m \mid \phi, k, \beta) = \frac12\left(1 + \cos(k\phi + \beta - m \pi)\right).$$

So it should be possible to use the existing phayes.expected_posterior_circular_variance and iterate across rescaled ks.

Although the main novelty + utility in phayes' parameter selection is phayes.get_beta_given_k. I wonder if the QAE circuit could be augmented with an exponential shift parameter beta (i.e. through an $R_z(\beta)$ gate) a la QPE

SamDuffield commented 1 year ago

We can consider the Brassard et al approach to amplitude estimation.

Here we have some (measurement-less) quantum algorithm $\mathcal{A}$ and also a partition of the basis into bad and good elements $\chi: \lbrace0, \dots 2^n -1 \rbrace \to \lbrace 0, 1 \rbrace$.

Then amplitude estimation aims to infer $a$ the probability that $\mathcal{A}|0\rangle$, when measured, produces a good element.

This can be considered a phase estimation problem. Inferring the eigenvalue of the operator $\mathbf{Q} = - \mathcal{A} S0 \mathcal{A}^{-1} S\chi$ corresponding to the eigenstate $\mathcal{A}|0\rangle$. Here $S_\chi$ flips the sign of the amplitudes in good states and $S_0$ flips the amplitude of the $|0\rangle$ state. The inferred phase $\phi$ then satisfies $\sin^2(\phi/2) = a$.

Thus amplitude estimation can be achieved as a direct application of phase estimation, i.e. with phayes and the following circuit

QAE_circuit

i.e. the phase estimation circuit with $|\phi \rangle = \mathcal{A}|0\rangle$ and $U = \mathbf{Q}$.

SamDuffield commented 1 year ago

However, there is an issue that $\mathcal{A}|0\rangle$ has two eigenphases at $\phi$ and $-\phi$. We are happy to infer either as $a = \sin^2(\phi/2)$. But this could inhibit the optimal parameter selection with the posterior remaining multimodal.

As a result, we only want to inference in the half circle $[0, \pi)$ rather than the full circle $[-\pi, \pi)$, however the half circle is not wrapped and therefore not represented by Fourier or von Mises distributions.

SamDuffield commented 1 year ago

Potentially the double eigenphase problem could be solved with a mixture posterior or mixture likelihood, although the parameter selection would need some thought.

SamDuffield commented 1 year ago

We could work with a Fourier distribution on the half-circle $[0, \pi)$ (i.e. $p(\phi) = 0$ in $[\pi, 2\pi)$ )

The integrals $\int_0^\pi \cos(j\phi) \cos(k\phi) d\phi$, $\int_0^\pi \cos(j\phi) \sin(k\phi) d\phi$ and $\int_0^\pi \sin(j\phi) \sin(k\phi) d\phi$ are still tractable and so we could apply the same approach as currently done in phayes. Although this would take some work and might have a higher algorithmic complexity as there are likely terms that no longer integrate to 0 (i.e. the optimal parameter selection likely becomes $O(J^2)$ rather than $O(J)$ ).

(Note that these integrals only apply to the Fourier representation as a von Mises distribution on $[0, \pi)$ doesn't really make sense)

SamDuffield commented 1 year ago

A naive approach might be to just do two updates for each measurement. One for $\phi$ and one for $-\phi$, this could be coded easily by using $\cos(-k\phi + \beta - m\pi) = \cos(k\phi - \beta -m\pi)$.

However, this is problematic as the $[0, 2\pi)$ wrapped distribution would always be even, at least bimodal and have mean 0.