The quantum Fourier transform is the step in Shor’s factoring algorithm, and in quantum phase estimation, that turns a hidden repeating pattern into a number you can measure. The textbook version gets very deep on large registers. On 2,048 qubits, the size people talk about when they talk about breaking RSA, it runs to about 2.1 million gates.
OQFT builds a different version. The optimistic QFT is right on almost every input and gives up on a small, predictable slice of them. In exchange it’s shallow, it needs no spare qubits, and its depth grows slowly as the register grows. OQFT is an open-source toolkit that builds that circuit for any register size, exports it as OpenQASM 3, counts its gates and depth, and checks it on an ordinary computer against the exact transform.
The Pitch in Four Numbers
- 198 layers of depth on a 2,048-qubit register at an error target of 0.01, against 4,096 for the textbook circuit.
- About 104,000 gates against 2.1 million. Twenty times fewer.
- 0 spare qubits. The circuit works in place.
- 68 qubits is the crossover. Below about 64 the textbook circuit is shallower. From 68 qubits on, the optimistic one wins, and the gap keeps widening.
Where the Idea Comes From
The method comes from a 2025 research paper, “A log-depth in-place quantum Fourier transform that rarely needs ancillas,” by Kahanamoku-Meyer, Blue, Bergamaschi, Gidney and Chuang. OQFT is an independent implementation. It isn’t affiliated with the authors and uses none of their code. The name is the abbreviation the papers use, so anyone searching for the method finds the tool.
How It Works
The circuit is built from blocks, and the width of the blocks sets the error. Narrow blocks make a shallower circuit that fails more often. Wide blocks fail rarely but cost more depth. You choose the trade with one setting, --eps, the average squared error you’ll accept over all inputs.
At an error target of 0.01 the output is very close to the exact transform for nearly every input. It’s badly off for a small fraction of inputs near the edges of each block’s range. Each tenfold tightening of the target costs 24 to 32 more layers at 2,048 qubits, so you can make it as careful as you like and see the price before you pay it.
The output uses three gates from the OpenQASM 3 standard library: h, cp and swap. That means Qiskit, Cirq and other tools load the circuits as they are. Loaded into Qiskit and transpiled, an OQFT circuit has the same CX count as the textbook one at less than a third of the depth.
OQFT is written in Go using only the standard library and ships as one small binary. There’s nothing else to install.
How It Was Tested
Up to 10 qubits, the tests compare every entry of the full matrix with the exact Fourier transform. Up to 20 qubits, a simulator runs chosen and random inputs through the circuit. The tests include the wraparound edge, the place where an optimistic circuit is most likely to slip. Every figure on the project site comes from results recorded in the GitHub repository.
Who It’s For
- Quantum algorithm researchers who want real gate and depth counts for the QFT at sizes no simulator can run, in a few seconds.
- Compiler and toolchain people who need a clean OpenQASM 3 circuit to feed into their own passes and compare against.
- Authors of papers who need a comparison table. One shell loop over register sizes produces it.
- Post-quantum planners who track how fast the cost of breaking today’s cryptography is falling, and want to see one of the pieces with their own eyes.
What It Isn’t
It isn’t a quantum computer. It builds and checks circuits on an ordinary machine, and the circuits run on any hardware or simulator that reads OpenQASM 3. And it doesn’t break RSA. It’s a tool for building and studying one part of a circuit that could be used for that. A resource calculator for factoring, which would show how the optimistic QFT changes the cost estimates, is planned and not out yet.
The Four-Question Screening
Every project featured here gets the same four questions, the way you’d screen a startup idea.
1. Where is the money in it?
Version 0.3 is free under Apache 2.0, and there’s no paid offering. The money around OQFT is in the question it helps answer: when does a quantum computer break today’s encryption, and how big does it have to be? Banks, governments and security vendors are spending on post-quantum migration now, and they pay for credible estimates. The planned resource calculator, turned into reports, consulting or a hosted estimate service for those buyers, is the most direct path. Research groups and quantum software companies that want a maintained, tested circuit generator are a second, smaller one.
2. What real problem does it solve?
The textbook QFT is too deep and too big at the sizes that matter, and every gate is a chance for noise to ruin the run. A circuit twenty times smaller is a big step toward something real hardware could one day finish. Shor’s algorithm already works by probability and reruns when it misses, so a small extra chance of a wrong answer costs far less than a circuit that’s twenty times bigger.
3. The technology in plain words
Picture a translator who’s fast and nearly always right, but stumbles on a few words at the end of each page. For a book you’ll read twice anyway, that’s a good deal. The optimistic QFT is that translator for quantum circuits. OQFT writes out the translator’s instructions for any size of book, tells you how often it stumbles, and lets you choose how careful it should be.
4. Moat and differentiation
The method is published, so the moat isn’t the idea. What OQFT adds is a working, tested implementation that anyone can run in seconds: one binary, standard output, recorded results, and posts that walk through every number. The big quantum toolkits ship the textbook QFT. A focused tool that does the optimistic one well, and is cited in papers and post-quantum planning, can become the reference people reach for. The planned factoring calculator would widen the gap.
Why It Matters
Every estimate of when RSA falls depends on how big the circuits are. Methods like this one keep pulling that number down. OQFT turns a research result into something you can download, run and check, which is how ideas leave the paper and start changing plans.
Follow the Project
Start with the quick start, get a build from the download page, or read the code in the OQFT repository on GitHub. The site explains what an optimistic circuit is and walks through the cut from 4,096 to 198 layers. OQFT is listed with the other open-source projects on SoftDevStudio.com. Other featured projects here: HyperCrux, AltSql and BareProxy.