Trying to understand the circuit/algorithm for VQLS and I found this diagram to show the high-level idea of doing the Hadamard test in this tutorial. But I am not quite sure why we need the two circuit blocks in the red box that I drew.

enter image description here

I appreciate the insight.

  • $\begingroup$ Can you share the link from where you found that image so people can look at it and answer your questions more easily? $\endgroup$
    – epelaez
    Jun 24, 2021 at 15:32
  • 1
    $\begingroup$ From the first glance, it looks like an uncomputation step(see that it is the exact inverse of block 2 and block 3) so as to restore the all 0 state of the ancilla register but as @epelaaez said, source of that image would be pretty helpful. $\endgroup$ Jun 24, 2021 at 16:00
  • 1
    $\begingroup$ @epelaaez just added the link . Thanks $\endgroup$ Jun 24, 2021 at 16:44
  • 1
    $\begingroup$ I think I answered this here: quantumcomputing.stackexchange.com/a/16934/1386. It might not be a full answer, this question is not really a duplicate, but it might be enough to fill the gap. Tell me if this does not answer your question. $\endgroup$ Jun 24, 2021 at 17:03
  • $\begingroup$ @Andrien Suau Thank you $\endgroup$ Jun 24, 2021 at 17:26

1 Answer 1


This circuit is used to calculate the coefficients $\mu_{l, l', j}$ which appear in the numerator of $C_ L$

\begin{align*}\mu_{l, l', j} = \langle 0| V^\dagger A_{l'}^\dagger U Z_j U^\dagger A_l V |0\rangle\end{align*}

Hadamard test is used to calculate the expectation value $\langle\psi|{\bf Q}|\psi\rangle$.

Now we have,

$$\langle\psi|{\bf Q}|\psi\rangle\ = \langle 0| V^\dagger (A_{l'}^\dagger U Z_j U^\dagger A_l) V |0\rangle$$

That is, $|\psi\rangle\ = V |0\rangle$ and ${\bf Q} = A_{l'}^\dagger U Z_j U^\dagger A_l$.

  • $\begingroup$ Thank you so much Both of you Very clear! Salute! $\endgroup$ Jun 24, 2021 at 17:18
  • $\begingroup$ But why do you need to control $A$ but not $U$ (here I refer to $U$ as the blue box of the circuit)? I thought that in a Hadamard test you need to control all the unitaries used to encode $U$ (here by $U$ I mean the general unitary in your answer) $\endgroup$
    – Enrico
    Jun 24, 2021 at 21:08
  • $\begingroup$ @Enrico, You are correct in assuming that the $U$ should be controlled. However, it is also equivalent not to include the control. See Adrien Suau's answer in this question for an explanation: quantumcomputing.stackexchange.com/questions/16931/… $\endgroup$ Jun 24, 2021 at 23:25
  • $\begingroup$ @thespaceman Thanks for the link, it makes perfect sense! $\endgroup$
    – Enrico
    Jun 25, 2021 at 13:18
  • $\begingroup$ @Egretta.Thula Follow-up question on calculating the expectation value. $$\langle\psi|{\bf Q}|\psi\rangle\ = \langle 0| V^\dagger (A_{l'}^\dagger U Z_j U^\dagger A_l) V |0\rangle$$ I assume this is done in Z (standard) basis or do we have to do transformation based on the matrix A , similar to VQE, to measure the expectation value? $\endgroup$ Jun 29, 2021 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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