1
$\begingroup$

after reading the chapter of QPE (Quantum phase estimation) in Nielsen, I wanted to try an implementation in Quirk. My idea was to apply the T-gate, from which I know the following relation $T|1\rangle = e^{\frac{i\pi}{4}}|1\rangle$ so I expect as output of the phase $\theta = 1/8$, because $T|1\rangle = e^{2i\pi\theta}|1\rangle$.

In Nielsen, I followed the following diagram to construct "my approach" later in Quirk, followed by the inverse QFT applied to the first register, which is not shown in this picture:

Circuit from Nielsen, inverse QFT is left out

Using the diagram from Nielsen together with the inverse QFT, I thus constructed the first part in Quirk as follows:

My approach of QPE based on Nielsen

I remembered that a swap gate was needed to get the desired output at the end. In the QFT part in Nielsen, for example, this was the case (It was mentioned but not depicted in the circuit diagram). Thats why I decided to put this in the circuit after applying the controlled gates.

In Quirk I now get the output $|001\rangle$ with 100% probability, if I convert $0.001_2$ to a decimal fraction I get $\frac{1}{8}$. This would fit what I would expect.

I now have this question:

Is the circuit really correct as I have built it? Background: In qiskit the circuit is built "descending" with T-gates and without the swap gate, while I have followed Nielsen and put the T-gates "ascending" in the circuit and then use the swap gate.

I hope my question is understandable so far. Thanks a lot for any upcoming answers/help.

$\endgroup$

1 Answer 1

1
$\begingroup$

Quirk uses the convention that the top qubit is the least significant qubit. When Quirk shows the ket $|001\rangle$, the rightmost bit (the 1) is the top qubit line and the equivalent decimal value is 1 (instead of 4). This is the opposite of the convention in Nielsen and Chuang.

Basically this means that, in Quirk, it's the top qubit that should control the single T gate (instead of the bottom qubit).

For example:

enter image description here

$\endgroup$
5
  • $\begingroup$ First question, would what I implemented there be correct according to Nielsen? Especially the part with the swap gate? $\endgroup$
    – P_Gate
    Nov 18, 2021 at 14:11
  • $\begingroup$ @P_Gate You wouldn't need the swap gate I think. $\endgroup$ Nov 18, 2021 at 14:24
  • $\begingroup$ Ok, but the controlled gates are then already correct. Yes, I'm not sure about the swap gate, so in Nielsen the QFT is implemented with swap gates at the end to get the correct output. Now I don't know exactly how the inverse QFT does this in Quirk.... $\endgroup$
    – P_Gate
    Nov 18, 2021 at 14:29
  • $\begingroup$ @P_Gate Quirk has the swap gates they're referring to embedded in the QFT gate itself, as is usually done. Otherwise it wouldn't have the right unitary matrix. You can see the swap gates in the QFT example circuit in Quirk's menu. $\endgroup$ Nov 18, 2021 at 15:28
  • $\begingroup$ Ok, I almost thought that was already included there. I would like to present you another circuit inspired by Nielsen, the right result comes out, but I again built the T-gates as in Nielsen suggested, what do you say? Link $\endgroup$
    – P_Gate
    Nov 18, 2021 at 16:05

Your Answer

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

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