You are on page 1of 13

Fast Fourier Transform

Project Report
Submitted in fulfilment of Course

QUANTUM INFO & COMPUTING (BITS F386)


BY

Saket Agarwal
ID No. 2012B5A8358G

Birla Institute of Technology and Science


Pilani
K.K. Birla Goa Campus

Quantum Fourier transform and its applications


The quantum Fourier transform is the classical discrete Fourier transform applied
to the vector of amplitudes of a quantum state. The classical (unitary) Fourier
transform acts on a vector in

, (x0, ..., xN1) and maps it to the vector

(y0, ..., yN1) according to the formula:

Where

is a primitive Nth root of unity.

Similarly, the quantum Fourier transform acts on a quantum state


maps it to a quantum state

and

according to the formula:

This can also be expressed as the map

Equivalently, the quantum Fourier transform can be viewed as a unitary matrix


acting on quantum state vectors, where the unitary matrix

is given by

Classical Fast Fourier Transform


Computing the DFTN of a vector involves evaluating N2 elements of the DFT
matrix, and looks like a job that scales as 22n with the number of bits n = log2 N.
In implementing the DFT transform on a digital machine, one can easily optimize
by exploiting the properties of the integer powers of N. There are cycles among
elements of DFTN, since

NN =1 . So while a direct matrix multiplication of the

form of Equation 8.24 would typically require O(N2) basic operations, the
optimized fast Fourier transform (FFT) algorithm requires O(N log 2 N) operations
only.
To compute FFT let us start with Danielson Lanczos lemma

Note it is a DFT broken up into two summations of half the size of the original.
The first summation is the "even terms", E, and the second is the "odd terms", O.
W is the "twiddle factor", and understanding it is another key to understanding
the FFT. Here is the "twiddle factor".

To expand the DFT into even and odd terms as in the lemma above, you do the
following. For the even term you substitute 2k into k, then you create a
summation of half the size of the original. For the odd term you substitute 2k + 1
into k, then create a summation of half the size of the original.

The example below shows the process required for a first level expansion.

The above is a first level break down. You can continue to break each term down
into even and odd terms until you run out of samples and only have one value in
the summation.

For the FFT we want all summations to be expanded down to 1 term.


Here is the pattern of expansion for the Danielson-Lanczos Lemma:

As shown in the diagram above, the D-L Lemma breaks down in a binary manner.
That is, the number of terms expands as follows 1, 2, 4, 8, 16, 32, etc. In order to
get all of the summation to unity, 1, therefore, we must have a power of base 2
number of samples, or N=2n samples. So, an FFT requires N = 2n samples.
For a sample size of N=2, a first level expansion will be enough to get the
summations to unity. The first level expansion will look like this

all that remains is a twiddle factor and input values, x(0) and x(1). This is the
general form used for the Butterfly diagram.

Now, N = 4 samples, and using the same procedure as was used for two
samples, the equation becomes:

and all you have remaining are "twiddle factors" and the input values, x(0), x(1),
x(2), and x(3).
After the expansion above you can plug in for N = 8 samples, and k=0, since all
summation would be unity when N=8.

The order in which the terms occur in the above equation is not in natural order
but an order called reverse binary order.
Count from 0 to 7 in binary 000, 001, 010, 011, 100, 101, 110, 111. Now, reverse
the bits of each number and you get 000, 100, 010, 110, 001, 101, 011, 111. In
decimal this sequence is 0, 4, 2, 6, 1, 5, 3, and 7.
So, the values in the D-L equation for 8 samples would be x(0), x(4), x(2), x(6),
x(1), x(5), x(3), and x(7).
The same pattern holds for all expansions of the D-L Lemma, and is made use of
by the Butterfly Diagram.

TWIDDLE FACTOR
The twiddle factor, W, describes a "rotating vector", which rotates in increments
according to the number of samples, N. Here are graphs where N = 2, 4 and 8
samples.

As shown in the diagram above, the twiddle factor has redundancy in values as
the vector rotates around. For example W for N=2, is the same for n = 0, 2, 4, 6,
etc. And W for N=8 is the same for n = 3, 11, 19, 27, etc.
Also, the symmetry is the fact that values that are 180 degrees out of phase are
the negative of each other. So for example, W for N =4 samples, where n =
0,4,8, etc, are the negative of n = 2,6,10, etc.
The Butterfly diagram takes advantage of this redundancy and symmetry, which
is part of what makes the FFT possible.

BUTTERFLY DIAGRAM
The Butterfly Diagram builds on the Danielson-Lanczos Lemma and the twiddle
factor to create an efficient algorithm. The Butterfly Diagram is the
FFT algorithm represented as a diagram.
First, here is the simplest butterfly. It's the basic unit, consisting of just two
inputs and two outputs.

F(0)

X(0)

X(1)

W 02
-1

F(1)

The four output equations for the butterfly are derived below :

N log N Savings
Remember, for a straight DFT you needed N*N multiplies. The N Log N savings
comes from the fact that there are two multiplies per Butterfly. In the 4 input
diagram above, there are 4 butterflies. so, there are a total of 4*2 = 8 multiplies.
4 Log(4) = 8. This is how you get the computational savings in the
FFT! The log is base 2.
Calculating DFT from above set of equations :

1W 04 W 02 W 04 W 02
DFT4 =

11 11

1W 14W 02W 14 W 02
1W 04 W 02W 04 W 02
1

1W 4 W 2 W 4 W 2

1i1i
11 11
1i1 i

For completeness lets look at the butterfly diagram for 8-point FFT :

An The 8 input butterfly diagram has 12 2-input butterflies and thus 12*2 = 24
multiplies.
N Log N = 8 Log (8) = 24. A straight DFT has N*N multiplies, or 8*8 = 64
multiplies. That's a pretty good savings for a small sample. The savings are over
100 times for N = 1024, and this increases as the number of samples increases.

Complexity of the classical FFT algorithm


Fast Fourier transform (FFT) is the fastest algorithm to compute
the discrete Fourier transform (DFT) and its inverse, As a result, fast Fourier
transforms are widely used for many applications in engineering, science, and
mathematics.
To know the difference we compare its complexity with the standard way of
solving DFT, complexity is no. of operations involved in an algorithm and gives a
nice idea of how fast & responsive the algorithm is. Later well compare the
complexities of FFT & QFT.

COMPLEXITY
1.) By Standard Method:

The complexity of solving above DFT by standard method is O(N2).


2.) Using FFT:
Breaking this up into even and odd terms,

Suppose the computation of DFTN requires T (N ) basic operations. This is


related to T (N/2) since we need to evaluate two DFT's of order N/2 and also
do N multiplications of the exponential factors. Thus,

T (N ) = 2T (N=2) + O(N )

Using this recursively to solve for T (N ) one gets,


T (N ) = O(N log 2N )
We can observe that, FFT is much (exponentially) faster than the
standard way of solving DFT.

3.) For QFT:


The circuit is,

N = n2
The efficiency of the above circuit is related to the
number of basic gate operations required per input bit.
We can easily see that this is,
n H -gates and
n(n - 1) / 2 C-R-gates for n bits
Hence, Complexity of QFT is O(n2). This is exponentially faster than the
classical FFT which takes O(n2n) operations.

But we must observe, that the output of the quantum Fourier transform is a
superposition of basis states whose phases represent the Fourier transform of
the corresponding input bit. A measurement at the end of the above circuit gives
us no information whatsoever about the Fourier transform of the input! So we
cannot use this circuit as a super-efficient Fourier transform computer! Instead,
we have to incorporate it in procedures that require FT-dependent phases.

You might also like