









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










2009 David Maier
Algorithm Design & Analysis
Fourier Transform
Lecture Notes 6 David Maier (^1)
Algorithm Design & Analysis
Polynomial as List of Coefficients
A(x) = Σ
Lecture Notes 6 David Maier (^2)
2009 David Maier
Algorithm Design & Analysis
Examples
Lecture Notes 6 David Maier (^3)
Algorithm Design & Analysis
Easy to Add Polynomials
Lecture Notes 6 David Maier (^4)
(-1, -2, 0, 1)
( 1, 0, 1, 1)
2009 David Maier
Algorithm Design & Analysis Example
(-1, -2, 0, 1)
( 1, 0, 1, 1)
Lecture Notes 6 David Maier (^7)
Algorithm Design & Analysis
Point-Value Representation
Lecture Notes 6 David Maier (^8)
2009 David Maier
Algorithm Design & Analysis
Interpolating Back to Coefficients
A(x) = Σy (^) k Π (x – x (^) j )
Lecture Notes 6 David Maier (^9)
Algorithm Design & Analysis
Example
1 ⋅ (x-1)(x-2)(x-3) (0-1)(0-2)(0-3)
0 ⋅ (x-0)(x-2)(x-3) (1-0)(1-2)(1-3)
Lecture Notes 6 David Maier (^10)
5 ⋅ (x-0)(x-1)(x-3) (2-0)(2-1)(2-3)
22 ⋅ (x-0)(x-1)(x-2) (3-0)(3-1)(3-2)
2009 David Maier
Algorithm Design & Analysis
Need 7 Coefficients Here
Lecture Notes 6 David Maier (^13)
Algorithm Design & Analysis
One Way to Multiply A(n), B(n) of Degree n
(a 0 , …, a (^) n )
(b 0 , …, b (^) n )
((x0 ,A(x0 )⋅B(x0 )),
(c 0 , …, c (^) 2n )
Lecture Notes 6 David Maier (^14)
((x 0 ,A(x 0 )), …,(x (^) 2n ,A(x (^) 2n ))
((x 0 ,B(x 0 )), …,(x (^) 2n ,B(x (^) 2n ))
…,(x (^) 2n ,A(x (^) 2n )⋅B(x (^) 2n ))
2009 David Maier
Algorithm Design & Analysis
Why Bother
Lecture Notes 6 David Maier (^15)
Algorithm Design & Analysis
Roots of Unity
All f h b k b h 4!
Lecture Notes 6 David Maier (^16)
All of the above work, but there are 4 more!
2009 David Maier
Algorithm Design & Analysis
Picture of 8 th^ Roots in Complex Plane
6
Lecture Notes 6 David Maier (^19)
8
These roots act like the integers mod 8 under +
Algorithm Design & Analysis
Cancellation Lemma
Lecture Notes 6 David Maier (^20)
2009 David Maier
Algorithm Design & Analysis
Squares of 2r th^ roots
{(ω2r^0 )^2 , (ω2r^1 )^2 , (ω2r^2 )^2 , …, (ω2r2r-1^ )^2 }
Lecture Notes 6 David Maier (^21)
= {ωr^0 , ωr^1 , ωr^2 , …, ωrr-1^ }
Algorithm Design & Analysis
Summing Up nth^ Roots
ω2r^0 + ω2r^1 + ω2r^2 + … + ω2r2r-1^ =
ωn^0 + ωn^1 + ωn^2 + … + ωnn-1^ =
Lecture Notes 6 David Maier (^22)
2009 David Maier
Algorithm Design & Analysis
How to Evaluate A(x)
x 0 , x 1 , x 2 , …, x (^) n-
x 0 , x 1 , x 2 , …, x (^) n-
Lecture Notes 6 David Maier (^25)
Algorithm Design & Analysis
Evaluating at n th^ Roots
x (^) j = ωnj^ = ω2rj (x (^) j )^2 = (ωnj^ )^2 = ω2r2j^ =
Evaluating one polynomial of degree 2r-1 at 2r points =
Lecture Notes 6 David Maier (^26)
2r points = Evaluating two polynomials of degree r-1 at r points plus
Time Complexity
2009 David Maier
Algorithm Design & Analysis
Recursive FFT
FFT(a 0 ) =
FFT(aFFT(a 0 0 , a1 , a1 , …, , …, anan-1 1 ) ) Let wn be principal n th^ root of unity w Å 1 a.0 = (a 0 , a 2 , a 4 , …, a (^) n-2 ) a.1 = (a 1 , a 3 , a 5 , …, a (^) n-1 ) y.0 = y.1 =
Lecture Notes 6 David Maier (^27)
for k Å 1 to (n/2)- yk Å y.0 (^) k + yk+(n/2) Å y.0 (^) k - w Å w⋅wn return( )
Algorithm Design & Analysis
Are the Values Right?
y.0 (^) k = A.0(ωn/2k^ ) = A.0( ) y 1y.1k = A.1(A 1(ωωn/2 kk^ )^ ) = A 1(A.1( ))
y (^) k = y.0 (^) k + ωnk⋅y.1 (^) k = A.0(ωn2k^ ) + ωnk⋅A.1(ωn2k^ ) =
y (^) k+(n/2) = y.0 (^) k - ωnk⋅y.1 (^) k
Lecture Notes 6 David Maier (^28)
yk+(n/2) y (^) k n y (^) k = y.0 (^) k + ωnk+(n/2)⋅y.1 (^) k = A.0(ωn2k^ ) + ωnk+(n/2)⋅A.1(ωn2k^ ) =