QFT (Quantum Fourier Transform)¶
The standard H + controlled-phase cascade plus trailing qubit-order swap, returned as a gate-tuple list. Verified against the brute-force analytic DFT matrix (max error 1.4e-15 across 1-4 qubits) and a QFT-then-inverse-QFT round trip.
qft ¶
Quantum Fourier Transform circuit builder -- the textbook cascade of H and
controlled-phase gates, plus the trailing qubit-order swap, returned as a
gate-tuple list ready for run_circuit. A standard building block (phase
estimation, Shor's algorithm, arithmetic circuits) that every general-
purpose SDK ships (Qiskit's QFT, Cirq's cirq.QuantumFourierTransformGate).
qft ¶
Build the Quantum Fourier Transform circuit on n_qubits.
Parameters¶
n_qubits : int Number of qubits, must be >= 1. inverse : bool Build the inverse QFT instead (same gate set, reversed order, negated phase angles). do_swaps : bool Include the trailing qubit-reversal swaps that put the output in the same qubit order as the input. The H/CP cascade alone produces the Fourier-transformed amplitudes in bit-reversed qubit order; set this to False only if the caller will account for that reversal itself (e.g. chaining straight into another subroutine that expects it).
Returns¶
list[tuple]
Examples¶
import dense_evolution as de sim = de.DenseSVSimulator(3) sim.run_circuit(de.qft(3)) sim.get_probabilities() # uniform: QFT|000> = equal superposition