Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
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 pointvalue 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 – O(n2)!!! Bad -- too slow! jk • 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 : wn0 = 1, wn1 = principal , wn2 = wnwn, …, wnn-1 • Properties: – Cancellation: wdndk = wnk – Halving: if n is even then the squares of nth roots are n/2-roots – Summation: n-1 (wnk ) 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 (wn0 )2 , (wn1 )2 ,…, (wnn-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 Interpolation y = (y0 y1 y2...yn-1), a = (a0 a1 a2...an-1), x = (x0 x1 x2…xn-1) Vn = Vn (x) Vandermonde matrix y = a Vn (x) Replace x = (x0 x1 x2…xn-1) => wn = (wn0 w n1 w n2 …wnn-1) DFT = y = a Vn (wn) a = y Vn-1 (wn) 10/16/01 - 10/18/01 CS8550 Efficient FFT 10/16/01 - 10/18/01 CS8550