I've started getting into quantum computing in the last few days. As part of the learning, I've figured it would be fun to implement some circuits on IBMQ Experience as I learn. So now I'm stuck with implementing a 2-qubit QFT. My first try was this:
Where in red is my implementation of a controlled-phase rotation by pi. I did it based on some paper I found which explains how to construct a universal controlled gate.
On 00 input it gave a 1/4 1/4 1/4 1/4 probability as expected. Then for sanity check, I figured I might try a 'DC' input (hence the Hadamard gates at the start) so the output would be 100% 00 but it failed. After some reading on the internet, I came by this question. The answer there is basically that the 'controlled' phase shift need only use a simple phase rotation on the MSB qubit. His explanation seemed sound and it did work for the 'DC' case.
So, my final question is - why my implementation is wrong? I've tried doing the math and it seems ok: when
q is 0,
q isn't rotated, and when
q is 1
q is rotated by pi (+ a global -pi/2 phase).
Can I get some explanation, please? I think I'm missing something.