Following @DaftWullie's answer I tried to simulate the circuit given in Fig. 4 of the paper (arXiv pre-print): Quantum circuit design for solving linear systems of equations (Cao et al, 2012), on Quirk.

The relevant circuit in the arXiv pre-print by Cao et al is:

enter image description here

Please note that (I think) the $e^{-iAt_0/2^s}$ (s.t. $1\leq s \leq 4$) gates in the circuit should actually be $e^{+iAt_0/2^s}$ gates instead. That's probably a misprint in the paper.

You will find the equivalent Quirk simulated circuit here. The labellings of the gates (along with the matrix entries) can be seen from the dashboard by hovering over them. The matrix entries may also be obtained from the JSON code in the URL. You might want to use a JSON formatter for that purpose.

The rotation gates used in the paper are $R(8\pi/2^{r-1}),R(4\pi/2^{r-1}),R(2\pi/2^{r-1}),R(\pi/2^{r-1})$. On page 4 they mentioned that higher the value of $r$ they greater is the accuracy. So I took $r=7$.

I created the custom gates $R_y(8\pi/2^{r-1})$, $R_y(4\pi/2^{r-1})$, $R_y(2\pi/2^{r-1})$ & $R_y(\pi/2^{r-1})$, using the definition of the $R_y$ matrices as:

$$R_y(\theta) = \left(\begin{matrix}\cos(\theta/2) & \sin(\theta/2) \\ -\sin(\theta/2) & \cos(\theta/2) \end{matrix}\right)$$

Now, the output state of the "input register" should have been

$$\frac{-|00\rangle + 7|01\rangle + 11|10\rangle + 13|11\rangle}{\sqrt{340}}$$ i.e. $$-0.0542326|00\rangle + 0.379628|01\rangle + 0.596559|10\rangle + 0.705024|11\rangle$$

However, I'm getting the output state of the input register as


That is, there's a extraneous global phase of $-1$ in the final output. I'm not sure whether I have made a mistake in the implementation of the circuit OR whether the output of the circuit actually supposed to be accompanied with the global phase.

@DaftWullie mentions:

If it's a global phase, what does it matter? Everything is always "up to a global phase"

That sure is logical! However, I want to be sure that I'm not making any silly error in the implementation itself. I wonder that if there's actually supposed to be a global phase of $-1$, why they didn't explicitly mention it in the paper? I find that a bit surprising. (Indeed, yes, I should perhaps directly contact the authors, but maybe someone here might be able to spot the silly mistake (on my part) quicker! :)

In case you have any questions about my simulation, please feel free to ask in the comments. I'll be happy to clarify.

  • 1
    $\begingroup$ I’d start by trying a couple of different things. First, different values of r. Perhaps r=5? Then i’d Start properly debugging. Things like giving the input state as an eigenvector and checking what the output is from the Fourier Transform, before the computation of the inverse, and confirm that it is what you think. Equally, if you have to ask about the ON state, why not just try it? Make a $|1\rangle$ and measure it! $\endgroup$
    – DaftWullie
    Jul 15 '18 at 5:23
  • $\begingroup$ Thinking about it, the circuit should be more accurate for larger r, so set it big! I’m also not sure about the QFT step. I think the QFT and it’s inverse should be swapped. $\endgroup$
    – DaftWullie
    Jul 15 '18 at 5:31
  • $\begingroup$ That’s a good point. Your original circuit just has b=00. One of my suggestions was to try changing b... $\endgroup$
    – DaftWullie
    Jul 16 '18 at 5:03
  • $\begingroup$ @DaftWullie Geting the exact output as claimed in the paper now: goo.gl/v4JbRw. I noticed that if we use $e^{+iAt}$ in the QPE step we must necessarily use the inverse QFT gate. However, strangely the final result seems to have an overall factor of $-1$. I used a "Sign Flip" gate at the end to correct this but not sure from where the extraneous $-1$ is appearing in the global phase. Any idea? $\endgroup$ Jul 16 '18 at 13:13
  • $\begingroup$ If it's a global phase, what does it matter? Everything is always "up to a global phase" $\endgroup$
    – DaftWullie
    Jul 16 '18 at 14:12

Your Answer

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

Browse other questions tagged or ask your own question.