4
$\begingroup$

As mentioned at length in this answer, in good part taking inspiration from these online pdf notes, there is a very direct relation between the quantum Fourier transform (QFT) circuit and the (classical) fast Fourier transform (FFT). So much so that one might arguably consider the QFT circuit as nothing but a direct implementation of the FFT on qubits.

While I've been aware of this for some time, I never quite followed the discussions on these online sources. Also in part because I think there's typos on those notes that confuse the reasoning somewhat (e.g. in the notes linked above, I find the reasoning around Fig. 5.4 a bit obscure, and the Hadamard in Fig. 5.5 is misplaced as far as I can tell). A paper I found that seems to discuss this connection is (arXiv:2003.03011), but again, the simplest aspects of the connection aren't overly transparent from a cursory reading of it.

The purpose of this question is thus to create a space to further discuss this particular aspect, which I think merits a standalone post. In summary, the question I'm asking is: if the QFT circuit does indeed "correspond" to the FFT, how exactly does this work? What's a good way to show explicitly that the standard QFT decomposition can be derived from the ideas behind the FFT?

$\endgroup$

2 Answers 2

4
$\begingroup$

The FFT relies on decomposing the DFT of vectors $\mathbf x\in\mathbb{R}^N$, $N=2^n$ into a sequence of DFTs of lower-dimension. On the other hand, finding a "quantum circuit", at a purely algebraic level, amounts to expressing the procedure operating at the level of individual bits. I'll try to show how this can be done in a relatively straightforward manner.

FFT

Here's a very rough rundown of the FFT algorithm, focusing on the decomposition it provides for $F_N \mathbf x$.

Suppose we want to compute the DFT of a vector $\mathbf x$ of length $N=2^n$. A standard approach is to decompose $\mathbf x$ into even and odd components, $\mathbf x_e$ and $\mathbf x_o$, respectively, and then express the DFT as $$F_N \mathbf x = F_N \mathbf x_e+F_N \mathbf x_o \\= \binom{F_{N/2}\mathbf x_e }{F_{N/2}\mathbf x_e} + \binom{\Omega F_{N/2}\mathbf x_o }{-\Omega F_{N/2}\mathbf x_o} = \binom{F_{N/2} \mathbf x_e + \Omega F_{N/2} \mathbf x_0 }{F_{N/2} \mathbf x_e - \Omega F_{N/2} \mathbf x_0 },\tag 1$$ where $\Omega\equiv \operatorname{diag}(\omega_N^{0},\omega_N^1,...,\omega_N^{N/2})$, and $\omega_N\equiv e^{2\pi i/N}$. This is the core idea behind the FFT: instead of applying $F_N$ to $\mathbf x$, which has cost $O(N^2)$, we compute $F_{N/2}\mathbf x_e$ and $F_{N/2}\mathbf x_o$, for a total cost of $\sim 2(N/2)^2=N^2/2$ (plus overheads).

This recursive formula is the cornerstone of the FFT algorithm. Iterating this procedure, we manage to compute $F_N\mathbf x$ using $2^k$ applications of $F_{N/2^k}$, and thus using $N$ applications of $F_1$, for a cost of $N$ (times logarithmic overheads).

QFT vs FFT

The first thing to stress when discussing FFT and QFT together is that when talking about DFT/FFT we're usually operating on vectors $\mathbf x\in\mathbb{R}^N$ represented as length-$N$ vectors (as you'd naturally do). However, when $N=2^n$, one can also represent each index for such vectors in binary notation. Thus, we can express $\mathbf{x}$ as: $$\mathbf x = \sum_{k=1}^N x_k \mathbf e_k = \sum_{b_1,...,b_n\in\{0,1\} } x_{b_1,...,b_n} (\mathbf e_{b_1}\otimes\cdots\otimes\mathbf e_{b_n}) \equiv \sum_{\mathbf b} x_{\mathbf b} |\mathbf b \rangle,\tag2$$ where $\mathbf{e}_k$ are the standard basis vectors, and $\vert \mathbf{b} \rangle$ denotes the tensor product of basis vectors corresponding to the binary string $\mathbf{b} = b_1 b_2 \dots b_n$.

This representation highlights that quantum gates operate at the bit level; they manipulate individual bits (qubits) rather than entire vector components. By reformulating the FFT steps to operate on bits, we move closer to constructing a quantum circuit that implements the FFT.

FFT-inspired QFT circuit decomposition

Our objective is now to express the FFT decomposition in terms of (qu)bit operations.

Firstly, note that the even and odd components of the vector $\mathbf{x}$ correspond to indices where the least significant bit (LSB) is 0 and 1, respectively. In our notation, this is the last bit. This allows us to write: $$\mathbf x = \mathbf x_e\otimes \mathbf e_0 + \mathbf x_o\otimes \mathbf e_1.\tag3$$ So if we apply the linear operation $F_{N/2}$ "locally" on the first $n-1$ bits, we have $$(F_{N/2}\otimes I)\mathbf x = (F_{N/2}\mathbf x_e)\otimes\mathbf e_0 + (F_{N/2}\mathbf x_o)\otimes\mathbf e_1.\tag4$$ Imagine we now implement a conditional operation: we apply the linear operator $\Omega$ to the first $n-1$ bits, iff the last one is $1$ (in other words, we apply it to the odd indices only). Denote this operation with $C(\Omega)$. This gets us to $$C(\Omega)(F_{N/2}\otimes I)\mathbf x = (F_{N/2}\mathbf x_e)\otimes\mathbf e_0 + (\Omega F_{N/2}\mathbf x_o)\otimes\mathbf e_1.\tag5$$ We're almost there. To get (1) from (5), we need to put together the even and odd terms, with suitable signs. We can do it with a Hadamard operation $H$ acting only on the last bit: $$\sqrt2 (I_{n-1}\otimes H)C(\Omega)(F_{N/2}\otimes I)\mathbf x \\= (F_{N/2}\mathbf x_e + \Omega F_{N/2}\mathbf x_o)\otimes\mathbf e_0 + (F_{N/2}\mathbf x_o - \Omega F_{N/2}\mathbf x_o)\otimes\mathbf e_1. \tag 6 $$ The remaining difference between equations (1) and (6) is that in equation (1), the components correspond to the first and last $N/2$ indices, whereas in equation (6), they are associated with the even and odd indices. This discrepancy is trivially resolved by performing a bitwise permutation: rotate bits so that the last one becomes the first one. This leaves us with precisely (1).

You'll notice that the sequence of operations I just outlined is precisely the sequence of gates used to decompose the QFT, with $C(\Omega)$ corresponding for example to the sequence of controlled-phase gates you typically find in these decompositions.

Toy example

To be a bit more explicitly, let's consider how this translates in the case of $N=4$. We have $$\mathbf x = \begin{pmatrix}x_0\\x_1\\x_2\\x_3\end{pmatrix} = \begin{pmatrix}x_0 \\ x_2\end{pmatrix}\otimes\binom10 + \begin{pmatrix}x_1 \\ x_3\end{pmatrix}\otimes\binom01.$$ The DFT decomposes, following (1) as, $$F_4 \mathbf x = \begin{pmatrix}F_2 \mathbf x_e\\ F_2\mathbf x_e\end{pmatrix} + \begin{pmatrix}\Omega F_2 \mathbf x_o\\ -\Omega F_2\mathbf x_o\end{pmatrix} = \begin{pmatrix}x_0+x_2 \\ x_0-x_2 \\ x_0+x_2 \\ x_0-x_2\end{pmatrix} + \begin{pmatrix}i^0(x_1+x_3) \\ i(x_1-x_3) \\ i^2(x_1+x_3) \\ i^3(x_1-x_3)\end{pmatrix},$$ where $\Omega=S\equiv\operatorname{diag}(1,i)$.

The "QFT-like decomposition" is then $$F_4 \mathbf x = (I\otimes H)C(\Omega)(F_2\otimes I)\mathbf x.$$

$\endgroup$
3
$\begingroup$

I'm fascinated by how this was reflected in the mind's eye of, say, Peter Shor circa January-March 1994, after he had seen Simon's preprint but before he cracked the general discrete log and factoring problem.

In particular, he initially gave a quantum algorithm for the discrete log problem when $p-1$ is smooth (e.g., the product of a polynomial number of small primes such as $2\cdot 3\cdot 5\cdots p_k$) by recursing over $\mathbb Z_{p-1}$ for each of FFT$_2$, FF$_3$, FFT$_5,\cdots$, as opposed to over $\mathbb Z^{\otimes n}_2$ as in Simon's Hadamard transform. Althoguh the smooth case of the discrete-log problem was known to have an efficient classical solution, it's interesting that this was his first intuition, and the first version of his paper makes no mention of a quantum circuit to implement his QFT. Rather, Lemma 3.2 of that first version just wants to choose a smooth number between $N$ and $2N$ (the number to be factored), and the Fourier transform would work in whatever mixed radix decomposition is required as FFT$_2\otimes$FFT$_3\otimes$FFT$_5\otimes$...

When the radix is fixed to two, the circuit that we now know and love came from David Deutsch and concurrently Don Coppersmith at IBM (after seeing Shor's preprint). But I'm sure that even in January of 1994, Umesh Vazirani, Dan Simon, Peter Shor, and company were certainly well aware of the Cooley-Tukey butterfly with fixed radix two - Shor later references the Schönhage–Strassen algorithm and its use of the classical FFT when discussing modular exponentiation with repeated squaring; the mod-2 FFT is a well-known workhorse even then.

It seems like Shor's progression was to (A) start with a smooth number and develop a Turing-tape version of the Quantum Fourier Transform and solve the smooth discrete log with a mixed-radix, then to (B) rely on the first couple of chapters of Hardy and Wright and Bertrand's Postulate to find a smooth number larger than $N$ and take the QFT while building up the machinery of the continued fraction algorithm to find the period, and finally to (C) forget about Hardy and Wright (and Bertrand's Postulate) and just go straight to a fixed radix of two, while almost directly porting Cooley-Tukey to the quantum world. Shor has hinted that solving (A) was what gave him the confidence to forge ahead with (B) - and (C) only came about after Deutsch's and Coppersmith's contribution.

See also Cleve and Watrous's 2000 paper briefly touching on this history and of Coppersmith's contributions. I'm partial to this quote:

Intuitively, the difference between performing a DFT and a QFT can be thought of as being analogous to the difference between computing all the probabilities that comprise a probability distribution and sampling a probability distribution—the latter task being frequently much easier.

$\endgroup$
4
  • $\begingroup$ interesting, thanks! So is Coppersmith's paper the original source for the efficient decomposition we use for the QFT? They mention giving an "approximate version", so I can't quite tell if it's the same or not $\endgroup$
    – glS
    Commented Nov 11 at 10:51
  • $\begingroup$ I think so, depending on how it’s phrased - Shor just wanted a polynomial-sized decomposition, which he was able to get based on Bertrand’s postulate, while Coppersmith gave the first decomposition into qubits. He also sacrificed some precision in the angles while saving a factor if $n$ in the QFT costs over $2^n$ and calling it an “approximate” algorithm, while Shor’s algorithm was “exact” at least over $2\cdot 3\cdot 5\cdots p_k$ (I think). $\endgroup$ Commented Nov 11 at 13:56
  • $\begingroup$ It would be really nice if he chimed in :) $\endgroup$
    – Glorfindel
    Commented Nov 11 at 19:10
  • $\begingroup$ *Although is spelled wrong; fix this later. $\endgroup$ Commented Nov 12 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.