The QFT circuit will work as follows for the first qubit:
- Apply a Hadamard gate to the first qubit.
- Apply a controlled rotation gate Rk to the first qubit with parameter k = 2 targeted on the following (second) qubit.
- Continue applying controlled rotation gates Rk to the first qubit, increasing the parameter k each time by one, and moving the control qubit to the following qubit each time until we run out of control qubits. For example:
- Apply a controlled rotation gate Rk to the first qubit with parameter k = 3 controlled by the third qubit
- Apply a controlled rotation gate Rk to the first qubit with parameter k = 4 controlled by the fourth qubit
The entire QFT circuit will repeat the procedure above for each successive qubit until we run out of qubits. The general circuit diagram is as follows:
Specifically, here is an implementation with five qubits: