I am trying to understand a test called Hadamard Overlap Test, which consists of a destructive swap test (section IV of swap test and Hong-Ou-Mandel effect are equivalent) right after a Hadamard test. The circuit is from the Variational Quantum Linear Solver paper: The authors claim that "conditioning the measurement on the ancilla qubit to yield the $$|\boldsymbol{0}\rangle$$ state, we can perform the depth-two Overlap circuit between registers S1 and S2 to get": \begin{equation} \begin{aligned} P(0) &=\frac{1}{2}\left(\left\langle\mathbf{0}\left|U^{\dagger} V\right| \mathbf{0}\right\rangle\left\langle\mathbf{0}\left|V^{\dagger} U\right| \mathbf{0}\right\rangle\right.+\left\langle\mathbf{0}\left|U^{\dagger} A_{l^{\prime}} A_{l} V\right| \mathbf{0}\right\rangle\left\langle\mathbf{0}\left|V^{\dagger} A_{l}^{\dagger} A_{l^{\prime}}^{\dagger} U\right| \mathbf{0}\right\rangle \\ &\left.+\operatorname{Re}\left[\left\langle\mathbf{0}\left|U^{\dagger} A_{l} V\right| \mathbf{0}\right\rangle\left\langle\mathbf{0}\left|V^{\dagger} A_{l^{\prime}}^{\dagger} U\right| \mathbf{0}\right\rangle\right]\right) \end{aligned} \end{equation}

$$|\boldsymbol{0}\rangle$$ represents a vector of 0 qubits, those making up the registers $$S_1$$ or $$S_2$$. I can't understand how to derive this result. In particular, I have the following questions:

• What are we exactly measuring by $$P(0)$$? From the circuit, it seems like all the qubits are measured, and that is also the case when you do a swap test according to the reference above. I initially thought that $$P(0)$$ is the probability of getting 0 in the ancilla, but this should not be the case, because otherwise what is the effect of the CNOT and H performed? What I mean is that the gates inside the box are not controlled on the ancilla, so they cannot change the outcome of the ancilla.
• How do you get to this result? Below is my attempt and what I achieved so far

\begin{equation} \begin{aligned} & |0 \rangle |\boldsymbol{0} \rangle |\boldsymbol{0} \rangle \xrightarrow{V, U} |0 \rangle V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle \xrightarrow{H}\frac{1}{\sqrt{2}}\left(|0 \rangle +|1 \rangle \right)V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle \xrightarrow{A_l, A_{l'}^{\dagger}}\\ &\frac{1}{\sqrt{2}}\left(|0 \rangle V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle +|1 \rangle A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle \right) \xrightarrow{H}\\ & \frac{1}{2}\left[|0 \rangle(V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle +A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle )+|1 \rangle (V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle -A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle )\right] \end{aligned} \end{equation} Now, one measures the ancilla, if it results in a 0 state, the system collapses in $$\begin{equation} \frac{1}{2}(V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle +A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle) \end{equation}$$ How does one implement the the CNOTs and H now? What are the further steps that yields the results of the authors?

• It seems that the VQLS paper has not adequately explained their procedure. As you said, they are not measuring only the ancilla as in a standard hadamard test. Instead, they are measuring each qubit. The question that I have is how do they calculate the overlap after measuring the probabilities of each state? The Garcia-Escartin et al. paper that you reference has an equation for estimating the overlap given in (20), however, it is not clear how that may apply here. – thespaceman Apr 22 at 23:54
• Have you tried calculating the probability that that ancilla, and all the other measurement results, give 0? The reason I suggest this is that the boxed area is equivalent to measuring in the Bell basis, which kind of teleports one system to the other. That's how I see you getting the cross terms like $\langle 0|U^\dagger V|0\rangle$ (ever seen the Choi-Jamiolkowski isomorphism?). – DaftWullie Apr 23 at 7:00
• As I understand it, the hadamard overlap test calculates the product of two different expectation values. In equations (C3) - (C5) of the VQLS paper you can see that they accomplish this in an analogous way as the simple hadamard test. Given your comment, are you suggesting that $Re[\gamma_{ll'}]=P(00...0) - P(11...1)$? Where $P(00...0)$ means the $0$ state for all qubits. If not, what is your suggestion for calculating $Re[\gamma_{ll'}]$? – thespaceman Apr 26 at 17:31