# Estimation of Z in the quantum Euclidean algorithm

In this paper there is a quantum algorithm that can estimate the distance between a given vector U and a set of vectors V (by taking the mean). In some part of the algorithm, we need to find the sum of the vectors norm squared or Z. With the assumption that we do have some given Blackbox that will tell us the norm of each vector. So we can estimate Z by applying $${e^{-iHt}}$$ to the state $$\frac{1}{\sqrt{2}}\biggl(|0\rangle + \frac{1}{\sqrt{M}}\sum_{j=1}^M|j\rangle\biggr) \otimes |0\rangle$$ where $$H = \biggl(\frac{1}{\sqrt{M}}\sum_{j=0}^M |Vj| |j\rangle \langle j|\biggl) \otimes X$$

Assume U = V

What things do I need to know before I implement it? I really can't understand I tried phase rotations (around the Z axis) but it doesn't work.

or

you can tell me a little bit about the preparation of the state $$|\phi\rangle$$ using quantum counting?

Based on my understanding, the computation of Z in the quantum-ancilla based algorithm described in the above paper is basically using a post-processing vector U that amounts to estimating Z on the ancilla qubit, which is the same as observable measured in the swap test.

P.S.: In this paper, read the last sub-paragraph just before unsupervised quantum learning (p.4).

• I mean what is the quantum circuit equivalent for this kind of operation.
– Aman
Mar 19, 2019 at 6:22

One potential method, albeit clunky, is with traditional Hamiltonian simulation techniques like Trotterization. It's conceivable that you could argue:

$$e^{-iHt} = \prod_{j = 0}^M e^{-i |V_j|/\sqrt{M} |j \rangle \langle j | t \otimes X} + O(*)$$

For some error amount. Then, the simulation of $$e^{-i \gamma |j \rangle \langle j| t \otimes X}$$ for some $$\gamma$$ should not be difficult, as it is the application of a phase of $$-i\gamma t$$ on $$|j \rangle \langle j|$$ while leaving all other states intact (also, the ancilla should have the $$e^{-i\gamma Xt}$$ applied.)

Also, I admit there may be some error to these methods, and I'm unsure if the paper intended the Hamiltonian to be simulated through this mechanism.