Polynomials and Fast Fourier Transform Chapter 30, pp.823-848 new edition
description
Transcript of Polynomials and Fast Fourier Transform Chapter 30, pp.823-848 new edition
10/16/01 - 10/18/01 CS8550
Polynomials and Fast Fourier Transform
Chapter 30, pp.823-848 new edition
10/16/01 - 10/18/01 CS8550
Polynomials• Polynomial in coefficient representation
A(x ) = a0 + a1x +a2 x2 +…+ an-2 xn-2
+ an-1 xn-1
• Operations over polynomials:– polynomial degree n = highest nonzero coeff
– addition = O(n)
– multiplication = O(n2)!!! Bad -- too slow!
– evaluation (finding the value in a point) = O(n) !!! Good --
Horner’s rule = stack-based
A(x0 ) = a0 + x0 (a1 + x0 (a2 + …+ x0 (an-2 + x0 (an-1))…)
• Point-value representation
– (x0 ,y0 ), (x1 ,y1 ), …, (xn-1 ,yn-1 ) - n point-values are sufficient
10/16/01 - 10/18/01 CS8550
Point-value representation• Interpolation = getting polynomial coefficients from point-
value representation
• Theorem (unique interpolation):
for any set of distinct n point-value pairs,
! polynomial of degree less than n
• Operations over polynomials:– addition = O(n)
– multiplication = O(n)!!! Good --• how?
– evaluation (finding the value in a point) = O(n2)!!! Bad -- too slow!
• IDEA: Use both representations!!!
10/16/01 - 10/18/01 CS8550
Simple Transformations
• Coefficient => point-value (evaluation) – just O(n) per point
– O(n2)!!! Bad -- too slow!
• Point-value => coefficient (interpolation) – Lagrange’s formula
n-1
yk (x-xj) / (xk-xj) k=0 jk jk– O(n2)!!! Bad -- too slow!
• GOAL – both transformations in O(n log n)
10/16/01 - 10/18/01 CS8550
O(n log n) Multiplication• Double-degree bound
– 2n point-value pairs– O(n)
• Evaluate – Compute point point-value representations using FFT– in (2n)-roots of unity– O(n log n)
• Point-wise multiply– Multiply the values for each of 2n points– O(n)
• Interpolate – Compute coefficient representation of product using FFT– O(n log n)
10/16/01 - 10/18/01 CS8550
Complex Roots of Unity• Point-value representation in complex roots of 1 = DFT = discrete Fourier Transform• Complex n-th root of 1: wn = 1• Complex numbers: i = -1• The principal n-th root is
wn1 = e2 i /n = cos(2/n)+ i sin (2/n)
• n roots of n-th power : wn
0 = 1, wn1 = principal , wn
2 = wnwn, …, wnn-1
• Properties:– Cancellation: wdn
dk = wnk
– Halving: if n is even then the squares of nth roots are n/2-roots– Summation: n-1 (wn
k ) j = 0 j=0
10/16/01 - 10/18/01 CS8550
Fast Fourier Transform• Problem:
– Given polynomial
A(x ) = a0 + a1x +a2 x2 +…+ an-2 xn-2
+ an-1 xn-1
– Find values in roots of unity
• FFT = divide and conquer:A[0](x )= a0 + a1x +a2 x2
+…+ an-2 xn/2-1
A[1](x ) = a1 + a3x +a5 x2 +… + an-1 xn/2-1
– A(x) = A[0](x2 )+ xA[1](x2)
• Recursive procedure:– Evaluate A[0](x) and A[1](x) in points (wn
0 )2 , (wn1 )2 ,…, (wn
n-1 )2
• n/2 roots each
– Combine the results
• T(n) = 2T(n/2) +(n) = (n log n) (master theorem)
10/16/01 - 10/18/01 CS8550
Inverse FFT Interpolationyy = (y0 y1 y2...yn-1), aa = (a0 a1 a2...an-1), xx = (x0 x1 x2…xn-1)
VVn = VVn (xx) Vandermonde matrix
y y = aa V Vn (xx)
Replace xx = (x0 x1 x2…xn-1) => wwn = (wn0
w n1 w n
2 …wnn-1)
DFT = y = DFT = y = aa V Vn (wwn)
a = a = y Vy Vn-1 (wwn)
10/16/01 - 10/18/01 CS8550
Efficient FFT