Quantum Fourier transform
Cette page n'a pas encore été traduite. Vous voyez la version originale en anglais.
For this Qiskit in Classrooms module, students must have a working Python environment with the following packages installed:
qiskitv2.1.0 or newerqiskit-ibm-runtimev0.40.1 or newerqiskit-aerv0.17.0 or newerqiskit.visualizationnumpypylatexenc
To set up and install the packages above, see the Install Qiskit guide. In order to run jobs on real quantum computers, students will need to set up an account with IBM Quantum® by following the steps in the Set up your IBM Cloud account guide.
This module was tested and used 13 seconds of QPU time. This is a good-faith estimate; your actual usage may vary.
# Uncomment and modify this line as needed to install dependencies
#!pip install 'qiskit>=2.1.0' 'qiskit-ibm-runtime>=0.40.1' 'qiskit-aer>=0.17.0' 'numpy' 'pylatexenc'
Introduction
A Fourier transform is a ubiquitous tool with applications in math, physics, signal processing, data compression, and countless other fields. A quantum version of the Fourier transform, aptly named the quantum Fourier transform, forms the basis for some of the most important quantum algorithms.
Today, after a reminder of the classical Fourier transform, we'll talk about how we implement the quantum Fourier transform on a quantum computer. Then, we'll discuss one of the applications of the quantum Fourier transform to an algorithm called the phase estimation algorithm. Quantum phase estimation is a subroutine in Shor's famous factoring algorithm, which is sometimes referred to as the "crown jewel" of quantum computing. This module builds toward another module all about Shor's algorithm, but it's also meant to be stand-alone. The quantum Fourier transform is a fascinating and useful algorithm in its own right!
The classical Fourier transform
Before we jump into the quantum Fourier transform, let's first remind ourselves of the classical version. The Fourier transform is a method of transforming from one so-called "basis" to another. You can think of two bases as different perspectives of the same problem — they are both valid ways to express a function, but one or the other might be more illuminating, depending on the problem at hand. Some examples of pairs of bases that are connected by Fourier transform are position and momentum, and time and frequency.
Let's see an example of how the Fourier transform might help us figure out what note an instrument is playing based on its audio waveform. Typically, we see the waveforms represented in the time basis — that is, the amplitude of the wave is expressed as a function of time.

We can Fourier transform this waveform to go from the time basis to the frequency basis:

In the frequency basis, we can easily see a clear peak at about 260 Hz. That's a middle C!
Now, you might have been able to determine that a middle C was being played without the use of a Fourier transform, but what if multiple notes are played at once? Then the waveform becomes more complicated when we plot it in the time basis:

But the frequency spectrum clearly identifies three peaks:

This was a C-major chord, playing the notes C, E, and G.
This kind of Fourier analysis can help us extract the frequency components of any sort of complicated signal.
Discrete Fourier transform
The Fourier transform is useful for any number of signal-processing applications. But in most of these real-world applications (including the music example we used above), we want to transform a discrete set of data points — not a continuous function. In this case, we use the discrete Fourier transform. The discrete Fourier transform (DFT) acts on a vector