Building a QFT Comparison Table for a Paper With One Shell Loop and OQFT
A paper or a design review usually wants one table: circuit size against depth and gate count, for a few register sizes and error targets. oqft stats prints all of it, one size at a time. A short shell loop turns that into a CSV file you can drop into a spreadsheet or a LaTeX table.
echo "qubits,eps,qft_depth,oqft_depth,qft_gates,oqft_gates"
for n in 64 256 1024; do
for eps in 0.1 0.01; do
oqft stats -n "$n" --eps "$eps" | awk -v n="$n" -v e="$eps" '
/^Total gates/ {qg = $3}
/^Depth/ {qd = $2}
/^OQFT/ {gsub(",", ""); print n "," e "," qd "," $NF "," qg "," $6}'
done
done > qft-table.csv
The awk part picks three lines out of each report: the textbook total from “Total gates”, the textbook depth from “Depth”, and both OQFT figures from the line that starts with “OQFT”. The commas inside that line are stripped so they don’t split the CSV.
What It Prints
| Qubits | Error target | QFT depth | OQFT depth | QFT gates | OQFT gates |
|---|---|---|---|---|---|
| 64 | 0.1 | 128 | 110 | 2,112 | 1,608 |
| 64 | 0.01 | 128 | 126 | 2,112 | 1,616 |
| 256 | 0.1 | 512 | 134 | 33,024 | 8,629 |
| 256 | 0.01 | 512 | 158 | 33,024 | 10,024 |
| 1024 | 0.1 | 2,048 | 166 | 525,312 | 43,887 |
| 1024 | 0.01 | 2,048 | 190 | 525,312 | 49,848 |
The whole loop runs in a few seconds, even at 1,024 qubits, since stats counts gates without simulating anything.
Variations
- Add the approximate QFT. The same report has an AQFT column. Read
$4from the “Total gates” and$3from the “Depth” line, and set--cutoffto the distance you want. - Save the circuits too. Add
oqft gen --type oqft -n "$n" --eps "$eps" > "oqft-$n-$eps.qasm"inside the loop, so the table and the circuits it describes come from the same run. - Pin the version. Write
oqft versioninto the file’s first line. A later release could change the counts, and the table should say which one produced it.
The crossover case study used the same loop over every size from 32 to 80 qubits.