Quick Start
This page gets OQFT running and walks through its three commands: gen writes a circuit, stats counts it, and check tests it against the exact transform.
Install
Download the archive for your system from the download page, unpack it and put oqft on your PATH. Then:
oqft version
Write a Circuit
oqft gen prints a circuit as OpenQASM 3. The textbook QFT on four qubits:
oqft gen -n 4
The optimistic QFT on 128 qubits, with an error target of 0.01, saved to a file:
oqft gen --type oqft -n 128 --eps 0.01 > oqft128.qasm
There’s also the approximate QFT, the older shortcut that drops the smallest rotations. --cutoff sets how far apart two qubits can be and still keep their rotation:
oqft gen --type aqft -n 16 --cutoff 3
Every circuit uses only h, cp and swap from the standard gate library. Qubit 0 is the least significant bit.
Count It
oqft stats puts the textbook and approximate circuits side by side, and adds the optimistic one when you give an error target:
oqft stats -n 2048 --eps 0.01
Qubits: 2048, AQFT cutoff: 2
Metric QFT AQFT
h 2048 2048
cp 2096128 4093
swap 1024 1024
rz 0 0
Total gates 2099200 7165
Two-qubit 2097152 5117
Depth 4096 4096
OQFT epsilon: 0.01, total gates: 104200, two-qubit gates: 100152, depth: 198
Depth counts every gate as one layer, and gates on separate qubits share a layer.
Check It
oqft check runs inputs through a simulator and measures how far the circuit’s output is from the exact QFT. Up to 10 qubits it checks every input:
oqft check -n 8 --eps 0.01
From 11 to 20 qubits, pick inputs at random with a seed so the run can be repeated:
oqft check -n 17 --eps 1 --samples 8 --seed 42
To see the weak spot on purpose, force small blocks with --block-width and pick an input at the edge of a block’s range:
oqft check -n 12 --block-width 3 --basis 63 --threshold 0.5
Add --format csv to get a table you can open in a spreadsheet. The reference lists every option.