How OQFT Was Tested, Matrices, Random Inputs and the Wraparound Edge
A circuit generator can produce something that looks fine, loads fine, and computes the wrong thing. The only way to know is to run the circuit and compare. OQFT does that at three levels, and every number below comes from the recorded runs in the repository.
Whole Matrices, Up to 10 Qubits
For registers up to 10 qubits, the tests build the full matrix of each circuit, all 1,024 by 1,024 entries at the top end, and compare every entry with the exact Fourier transform written out by formula. The textbook QFT matches at every size from 1 to 10. The approximate QFT is checked the same way, to confirm its error stays inside a bound that tightens as it keeps more rotations.
The optimistic QFT is compared against an intermediate circuit, the blocked QFT, which keeps the same rotations but runs the blocks one after another. Matching that baseline shows the reordering, the step that lets blocks run in parallel, does what it should.
Random Inputs, Up to 20 Qubits
Past 10 qubits the full matrix gets too big, so the checker runs single inputs through a statevector simulator instead. On 17 qubits with a loose error target of 1, eight random inputs, chosen with a fixed seed so anyone can repeat the run, came out with an average squared error of about 0.000035. None came close to the flag threshold of 0.1.
Squared error here is the squared distance between the circuit’s output and the exact one. Zero means a perfect match. The largest it can be is 4.
Finding the Edge on Purpose
The interesting test is the one built to fail. The optimistic QFT goes wrong when a block’s value sits at the top of its range, where its fixed-width arithmetic wraps around. Normal block widths are too wide to show that on a simulated register, so the test forces blocks three qubits wide on a 12-qubit register, holds one block at 111 and walks its neighbour through all eight values.

The first seven values stay between 0.03 and 0.16. The eighth, 111, jumps to 2.00. That’s the wraparound, exactly where the theory puts it and nowhere else. A three-qubit block is far narrower than anything you’d use, which is why the errors next to the edge are visible at all. At real widths they shrink toward zero.
Gate Counts to 2,048 Qubits
Above the simulator’s reach, the tests check structure. They build the optimistic QFT at every power of two from 32 to 2,048 qubits and record its gates and depth next to the textbook circuit. At 2,048 qubits with an error target of 0.01, that’s 198 layers and 104,200 gates, against 4,096 layers and 2,099,200 gates.
Every Release
All of this runs on every change, on Linux, macOS and Windows. A release only goes out after all five platform builds succeed and the Linux, macOS and Windows binaries pass a short run of their own. The recorded results sit next to the code.