Assuming qubit 0 is the least significant qubit and qubit 4 is the most significant qubit (big-endian notation), the QFT on a five-qubit state '10110' can be implemented as follows:
Apply Hadamard gates to all qubits:
Code: Select all
|10110⟩ -> (H ⊗ H ⊗ H ⊗ H ⊗ H) |10110⟩
Code: Select all
(H ⊗ H ⊗ H ⊗ H) Cφ1 --- Cφ2 --- Cφ3 --- Cφ4 (H ⊗ H ⊗ H ⊗ H) |10110⟩
Cφ1 applies a controlled-phase gate with a rotation of 2π/2^1 between qubit 0 and qubit 1.
Cφ2 applies a controlled-phase gate with a rotation of 2π/2^2 between qubit 0 and qubit 2.
Cφ3 applies a controlled-phase gate with a rotation of 2π/2^3 between qubit 0 and qubit 3.
Cφ4 applies a controlled-phase gate with a rotation of 2π/2^4 between qubit 0 and qubit 4.
Apply additional Hadamard gates:
Code: Select all
(H ⊗ H ⊗ H ⊗ H) Cφ1 --- Cφ2 --- Cφ3 --- Cφ4 (H ⊗ H ⊗ H ⊗ H) |10110⟩
| | | |
(H ⊗ H ⊗ H ⊗ H) H H H H |10110⟩