Title: Fast Fourier Transform
1Fast Fourier Transform
- Rich Macchi
- MET CS 566, Analysis of Algorithms
- April 10, 2007
2What is a Fourier Transform?
- Invented by Jean Baptiste Joseph Fourier
- Transforms one function into another function
- Commonly used to transform a function in the time
domain to the frequency domain - Continuous functions
3What is a Discrete Fourier Transform?
k 0, , N - 1
- Also known as finite Fourier transform
- X is a set of complex numbers describing the
transformation of domain x - Each output element is a summation of a function
of all input elements
4What is a Fast Fourier Transform?
- Computes a discrete Fourier transform and its
inverse efficiently - Fast Fourier Transform (FFT) works in time O(n
log n) - (More on this later)
5Inverse Discrete Fourier Transform
n 0, , N - 1
- Produces original domain x given set of complex
numbers X
6The Cooley-Tukey FFT
- Most common FFT algorithm
- Recursive Divide-and-Conquer algorithm
- Breaks input domain x into two interleaved
sub-domains xe and xo - Usually this represents even- and odd-indexed
elements of the domain - Radix-2 Decimation-in-Time (DIT)
7History of Cooley-Tukey
- Named for J.W. Cooley and John Tukey
- Re-invented the algorithm in 1965
- Described how to perform it on a computer
- Implemented at IBM Research Computing Ctr.
- Invented by Carl Friedrich Gauss
- circa 1805
- Did not analyze computational time
8Radix-2 DIT case
k lt M
k M
- Also known as Danielson-Lanczos lemma
- Ek represents even-indexed elements
- Ok represents odd-indexed elements
9Pseudocode
- assume input array x0..N-1
- assume N is a power of 2
- function fft(N, X0..N-1)
- if N 1 then Xn xn
- else
- M N/2
- allocate array evens0..M-1
- allocate array odds0..M-1
- fft(M, evens)
- fft(M, odds)
- for k 0 to M-1 do
- if k lt M then Xk evensk oddsk
e(2piik/N) - else Xk evensk-M oddsk-M
e(2pii(k-M)/N)
10Example Graphs
Time Domain
Frequency Domain
11Common Application of FFT
- Data compression of digitized signals
- Audio waves sampled digitally
- Time domain transformedto frequency domain
- Eliminate frequencies with valuesunder a certain
threshold - Also can be used for digital frequency filtering
- Magnetic Resonance Imaging
12Simple Example
Xk
N 8
xn
1
2
3
4
5
6
7
8
13Simple Example
Xk
N 8, M 4
N 4
Even
Odd
xn
1
2
3
4
5
6
7
8
14Simple Example
Xk
N 8, M 4
N 4, M 2
Even
Odd
N 2, M 1
Even Odd
Even Odd
xn
1
2
3
4
5
6
7
8
15Simple Example
Xk
N 8, M 4
N 4, M 2
Even
Odd
N 2, M 1
Even Odd
Even Odd
N 1
Even Odd
Even Odd
Even Odd
Even Odd
xn
1
2
3
4
5
6
7
8
16Simple Example
Xk
N 8, M 4
N 4, M 2
Even
Odd
k in all cases is zero Xk xn
N 2, M 1
Even Odd
Even Odd
N 1
Even Odd
Even Odd
Even Odd
Even Odd
1
2
3
4
5
6
8
7
xn
1
2
3
4
5
6
7
8
17Simple Example
Xk Ek e2pik/NOk when k 0 (lt M) Xk Ek-M
e2pi(k-M)/NOk-M when k 1 ( M) X0 E0 2e0
1 2 3 X1 E0 - 2e0 1 - 2 -1
Xk
N 8, M 4
N 4, M 2
Even
Odd
N 2, M 1
Even Odd
Even Odd
3
-1
7
-1
11
-1
15
-1
N 1
Even Odd
Even Odd
Even Odd
Even Odd
1
2
3
4
5
6
8
7
xn
1
2
3
4
5
6
7
8
18Simple Example
Xk
N 8, M 4
N 4, M 2
Even
Odd
10
3 - epi
-4
3 epi
26
-4
3 - epi
3 epi
N 2, M 1
Even Odd
Even Odd
Xk Ek e2pik/NOk when k 0 and 1 Xk Ek-M
e2pi(k-M)/NOk-M when k 2 and 3 X0 E0 e0O0
3 7 10 X1 E1 e2pi/2O1 3 (-1)epi 3 -
epi X2 E(2-2) e(2-2)O0 3 7 -4 X3
E(3-2) e2pi(3-2)/2O1 3 (-1)epi 3 epi
3
-1
7
-1
11
-1
15
-1
N 1
Even Odd
Even Odd
Even Odd
Even Odd
1
2
3
4
5
6
8
7
xn
1
2
3
4
5
6
7
8
19Simple Example
Xk
N 8, M 4
N 4, M 2
Even
Odd
10
4
-4
2
26
-4
4
2
N 2, M 1
Even Odd
Even Odd
eai cos a i sin a epi cos p i sin p sin
p 0 and cos p is -1 3 epi 3 (-1) 0i
4 3 epi 3 (-1) 0i 2
3
-1
7
-1
11
-1
15
-1
N 1
Even Odd
Even Odd
Even Odd
Even Odd
1
2
3
4
5
6
8
7
xn
1
2
3
4
5
6
7
8
20Simple Example
26
4 4i
0
-6
-8
2 2i
4 4i
2 2i
N 8, M 4
Xk
N 4, M 2
Even
Odd
10
-4
16
-4
4
2
4
2
N 2, M 1
Xk Ek e2pik/NOk when k 0,1,2,3 X0 E0
e0O0 10 16 26 X1 E1 e2pi/4O1 4
4e0.5pi 4 4(cos p/2 i sin p/2) 4 4(0
i) 4 4i X2 E2 e2pi(2)/4O2 -4 (-4)epi
-4 - 4epi -4 4(cos p i sin p) -4 4(-1
0i) -4 4 0 X3 E3 e2pi(3)/4O3 2
2e1.5pi 2 2(cos 3p/2 i sin 3p/2) 2 2(0
-1i) 2 2i
Even Odd
Even Odd
3
-1
7
-1
11
-1
15
-1
N 1
Even Odd
Even Odd
Even Odd
Even Odd
1
2
3
4
5
6
8
7
xn
1
2
3
4
5
6
7
8
21Simple Example
26
4 4i
0
-6
-8
2 2i
4 4i
2 2i
N 8, M 4
Xk
N 4, M 2
Even
Odd
10
-4
16
-4
4
2
4
2
N 2, M 1
Xk Ek-M e2pi(k-M)/NOk-M when k 4,5,6,7 X4
E(4-4) - e0O(4-4) 10 - 16 -6 X5 E(5-4) -
e2pi(5-4)/4O(5-4) 4 - 4e0.5pi 4 - 4(cos p/2
i sin p/2) 4 - 4(0 i) 4 - 4i X6 E(6-4) -
e2pi(6-4)/4O(6-4) -4 - (-4)epi -4 4epi -4
4(cos p i sin p) -4 4(-1 0i) -4 - 4
-8 X7 E(7-4) - e2pi(7-4)/4O(7-4) 2 - 2e1.5pi
2 - 2(cos 3p/2 i sin 3p/2) 2 - 2(0 -1i) 2
2i
Even Odd
Even Odd
3
-1
7
-1
11
-1
15
-1
N 1
Even Odd
Even Odd
Even Odd
Even Odd
1
2
3
4
5
6
8
7
xn
1
2
3
4
5
6
7
8
22Simple Example
26
4 4i
0
-6
-8
2 2i
4 4i
2 2i
Xk
Even
Odd
10
-4
16
-4
4
2
4
2
Even Odd
Even Odd
3
-1
7
-1
11
-1
15
-1
Even Odd
Even Odd
Even Odd
Even Odd
1
2
3
4
5
6
8
7
xn
1
2
3
4
5
6
7
8
23Simple Example
26
4 4i
0
-6
-8
2 2i
4 4i
2 2i
Xk
Each level is half of the previous level there
are log N levels. On every level every k index is
visited. So, the complexity of the FFT is N log
N.
Even
Odd
10
-4
16
-4
4
2
4
2
Even Odd
Even Odd
3
-1
7
-1
11
-1
15
-1
Even Odd
Even Odd
Even Odd
Even Odd
1
2
3
4
5
6
8
7
xn
1
2
3
4
5
6
7
8
24Comparison with Naïve DFT
k 0, , N - 1
Naïve DFT traverses every element (xn)k times,
resulting in a computational complexity of ?(n2)
25Questions?