FFT (Fast Fourier Transform)
FFT (Fast Fourier Transform)
Transform)
FFT
A( x ) a0 a1 x ..... an 1 x n 1
B( x ) b0 b1 x ..... bn 1 x n 1
C ( x ) A( x ) B ( x )
= c0 c1 x c2 x 2 ..... c2 n 3 x 2 n 3 c2 n 2 x 2 n 2
j
c j ak b j k
k 0
•Coefficient representation:
How to evaluate A(x0)?
p2.
Horner’s rule:
A( x0 ) a0 x0 (a1 x0 (a2 ..... x0 (an 2 x0 an 1 )...))
(n)
Point-value representation:
A point-value representation of a polynomial A(x) of
degree-bound n is a set of n point-value pairs {(x 0 , y0 ),
(x1 , y1 ),.....(x n-1 , yn 1 )}, where y k A( xk )
p3.
Thm1
For any set {(x 0 , y0 ),(x1, y1 ),.....(x n-1, yn 1 )} of n point-value
pairs, there is a unique poly A(x) of degree n-1, such that
y k A( xk ) for k=0, 1,...., n-1
Pf:
1 x0 x02 x0n 1
2 n 1
1 x1 x1 x1
if X = then
1 x 2 n 1
n 1 xn 1 xn 1
a0 y0
a y
X 1 1
a y
n 1 n 1
p4.
det( X ) ( xk x j ) 0 if xk 's are distinct
jk
n-point interpolation:
Lagrange’s formula:
(x x )
n 1 j
A( x) y
j k
(x x )
k
k 0 k j
jk
p5.
a0 , a1 ,...., an 1 Ordinary Mult c0 , c1 ,...., c2 n 2 Cof.
rep.
b0 , b1 ,...., bn 1 ( n 2 )
Evalation Interpolation
(n log n) (n log n)
p6.
Thm2
The product of 2 polynomials of deg-bound n can
be computed in time (nlog n), with both the input
and output representation in coefficient form
Complex roots of unity:
n 1, e 2ik/n for k=0, 1, ..., n-1 e iu cos u i sin u
n e 2i/n , the principal n-th root of unity
0n , 1n , 2n ,..., nn 1
nn =?, 0n =1
nj kn =(n j k ) mod n
n1 nn 1
p7.
Lemma 3 (Cancellation Lemma)
dk
n, k, d: non-negative integers, dn k
n
Pf:
2 i / dn dk 2 i / n k
dk
dn ( e ) ( e ) k
n
p8.
Lemma 5 (Halving lemma)
n: even positive integer
The squares of the n complex n-th roots of unity are n/2
complex (n/2)th roots of unity.
Pf:
(kn )2 2n k kn / 2, where k Z {0}
(kn n / 2 ) 2 2n k n 2n k kn / 2
kn and kn n / 2 have the same squre
Lemma 6 (Summation lemma)
n-1
n Z , k Z {0}, n | k , n) 0
(
j=0
k j
Pf:
n-1
(kn ) n 1 (nn ) k 1
j=0
( )
k
n
j
k
1
k
1
0
n n
p9.
DFT n -1
Evaluate A( x) a j x j at 0n , 1n ,....., nn-1 ,
j 0
Assume n is a power of 2
n -1
Let a a0 , a1 ,...., an -1 , and yk A(kn ) a j kjn
j 0
p10.
Interpolation at the complex roots of unity:
y0 1 1 1 1 a0
n 1
y 1 2
n 1 a
1 n n
y2 = 1 2 4 2( n 1)
a2
n n n
y n 1 2( n 1) ( n 1)( n 1)
an 1
n 1 1 n n n
y Vn a, (Vn ) k , j nkj
a Vn1 y
p11.
Thm 7
1 kj
j, k 0,1,....., n 1, (V ) n j ,k n /n
Pf:
n 1
V V I n , (V V ) j , j ' (Vn1 ) j ,k (Vn ) k , j '
n
1
n n
1
n
k 0
n 1
1
= n kj kjn '
k 0 n
1 n 1 k ( j ' j )
= n -------(*)
n k 0
if j=j', then (*)=1, if j j', then by lemma 6, (*)=0
-(n-1) < j'-j <n-1, and n | (j'-j)
1 n 1 n 1
a j yk n k j , yk a j kn j
n k 0 j 0
p12.
FFT
A[0] ( x ) a0 a2 x a4 x 2 ..... an 2 x n / 21
A[1] ( x ) a1 a3 x a5 x 2 ..... an 1x n / 21
(*) A( x ) A[0] ( x 2 ) xA[1] ( x 2 )
Thus evaluating A(x) at 0n , 1n ,....., nn 1 reduce to
1. evaluating A[0] ( x) and A[1] ( x) at
(0n ) 2 , (1n ) 2 ,....., (nn 1 )2
2. combining the results according to (*)
p13.
yk[0] A[0] (kn / 2 )
Let [1]
yk A (n / 2 )
[1] k
p14.
Recursive-FFT(a)
{ n=length[a]; /* n: power of 2 */
if n=1 the return a;
n e 2 i / n ;
=1
a [0] (a0 , a2 ,....., an 2 );
a [1] (a1 , a3 ,....., an 1 );
y[0] Recursive-FFT(a [0] );
y[1] Recursive-FFT(a [1] );
for k=0 to (n/2 - 1) do
{
y k y[0] y[1]
k ;
T (n) 2T (n / 2) ( n)
k
y k+n/2 y y ;
[0]
k
[1]
k
=n ; } =(nlog n)
}
Thm 8 (Convolution thm)
n: power of 2
a, b: vectors of length n
a b=DFT2-1n (DFT2 n (a) DFT2 n (b))
Componentwise product
p16.
Efficient FFT implement
yk[0] y [0]
k y k
n
[1]
k
kn
yk[1] y [0]
y k [1]
k n k
(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 )
(a0 , a2 , a4 , a6 ) (a1 , a3 , a5 , a7 )
(a0 , a4 ) (a2 , a6 ) (a1 , a5 ) (a3 , a7 )
a0 a4 a2 a6 a1 a5 a3 a7
000 100 010 110 001 101 011 111
Idea :
for s=1 to (lg n) do
for k=0 to n-1 by 2s
combine the two 2 s-1 element DFT's in y[1]
y[0] A[k..k+2 s-1 1] and A[k+2s-1..k+2s-1 1]
into one 2s element DFT in A[k..k+2s 1]
FFT-Base(a)
{ n = length[a];
for s=1 to (lg n) do
{ m=2s ;
m e 2 i / m ;
for k=0 to n-1 by m do
{ =1;
for j=0 to (m/2 - 1) do
{ t=A[k j m / 2];
u=A[k+j];
A[k+j]=u+t;
A[k+j+m/2]=u-t;
m ; }
} } }
Iterative-FFT(a)
{ Bit-Reverse-Copy(a, A);
n=length[a];
Bit-Reverse-Copy(a,A)
for s=1 to (lg n) do { n=length[a];
{ m=2s ; m e 2 i / m ; 1; for k=0 to n-1 do
for j=0 to (m/2 -1) do A[rev(k)] = a k
{ for k=j to n-1 by m do }
{ t = A[k m / 2]; eg
u = A[k]; rev(011)=110, rev(001)=100
A[k]=u+t;
A[k+m/2]=u-t; }
m
}
}
}
p19.
FFT circuit
a0 y0
0
2
a1 y1
04
a2 y2
02 14
a3 y3
0
8
a4 y4
02 18
a5 y5
0 82
4
a6 y6
02 14 83
a7 y7