1 / 37

The Fast Fourier Transform and Applications to Multiplication

The Fast Fourier Transform and Applications to Multiplication. Analysis of Algorithms. Prepared by John Reif, Ph.D. Topics and Readings: - The Fast Fourier Transform Advanced Material : - Using FFT to solve other Multipoint Evaluation Problems - Applications to Multiplication.

pegeen
Download Presentation

The Fast Fourier Transform and Applications to Multiplication

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Fast Fourier Transform andApplications to Multiplication Analysis of Algorithms Prepared by John Reif, Ph.D.

  2. Topics and Readings: - The Fast Fourier Transform Advanced Material :- Using FFT to solve other Multipoint Evaluation Problems- Applications to Multiplication • Reading Selection: • CLR, Chapter 30

  3. Nth Roots of Unity • Assume Commutative Ring (R,+,·, 0,1) •  is principal nth root of unity if • i  1 for i = 1, …, n-1 • n = 1, and • Example: for complex numbers

  4. Example of nth Root of Unity for Complex Numbers is the 8th root of unity

  5. Fourier Matrix

  6. Discrete Fourier Transform Input a column n-vector a = (a0, …, an-1)T Output an n-vector which is the product of the Fourier matrix times the input vector

  7. Inverse Fourier Transform

  8. Fourier Transform is Polynomial Evaluation at the Roots of Unity Input a column n-vector a = (a0, …, an-1)T Output an n-vector (f0, …, fn-1)T which are the values polynomial f(x)at the n roots of unity

  9. Fast Fourier Transform • Viewed as Evaluation Problem: naïve algorithm takes n2 ops • Divide and Conquer gives FFT with O(n log n) ops for n a power of 2 • Key Idea: • If  is nth root of unity then 2 is n/2th root of unity • So can reduce the problem to two subproblems of size n/2

  10. Algorithm FFTn • Input a = (a0, …, an-1)T, n a power of 2

  11. FFT Circuit (also known as Butterfly Network) • Total Recursion depth = log n • Communication Distance 2d at depth d

  12. Operation Counts for FFT Algorithm • Assume n = 2k • # additionsAdd(n) = 2· Add(n/2) + n = n log n • # multiplicationsMult(n) = 2· Mult(n/2) + n/2 = ½ n log n • Total Time O(n log n) • Note in complex FFT, # real ops is 5 n log n

  13. Multipoint Polynomial Evaluation • Input polynomial • Problem evaluate f(x) at x0, x1, …, xn-1 • Easy Cases: FFT Case xi =i = principal root of unity

  14. Multipoint Polynomial Evaluation (cont’d)

  15. Other Polynomial Evaluation Problems Solved by FFT Each costs O(n log n) time • Evaluate at points Xi = bai + d for i=0,…, n-1(Chirp Transfom) • Reduced to FFT • Single point evaluation of all derivatives of a polynomial • Solve by reduction to above Chirp Transform of case 2) • Evaluate at points Xi = b(ai)2+ cai + d for i=0,…, n-1 • Solve by divide and conquer similar to FFT

  16. Single Point Evaluation of all Derivatives of Polynomial • Input and point x0 • output

  17. Single Point Evaluation of all Derivatives of Polynomial (cont’d) • Taylor Series Representation ofThen reduces to case of evaluation at points • Solve this Chirp Transform problem by reduction FFT

  18. Advanced Material: Further Applications of FFT • Convolution: Products and Powers of Polynomials • Used for for Integer Multiplication Algorithms • Also used for Filtering on infinite input streams • Division and Inverse of Polynomials • Multipoint Evaluation and Interpolation

  19. Advanced Material: Products and Powers of Polynomials • Input vectors a = (a0, a1, …, an-1)T b = (b0, b1, …, bn-1)T • Definition of Convolution c = a  b Where for i=0, …, 2n-1 define ak = bk = 0 if k< 0 or kn

  20. Products and Powers of Polynomials (cont’d) • Convolution Theorem • Application to Polynomial Products:

  21. Products of m Polynomials • Generalized Convolution Theorem

  22. Wrapped Convolutions • a = (a0, a1, …, an-1)T , b = (b0, b1, …, bn-1)T • Positive wrapped convolution isc = (c0, c1, …, cn-1)T • Negative wrapped convolution is d = (d0, d1, …, dn-1)T

  23. Application of Wrapped Convolution to Modular Polynomial Products

  24. Computing Positive Wrapped Convolution • Let  = principal nth root of unity • Assume n has multiplicative inverse, Theoremis the positive wrapped convolution of n-vectors a and b.

  25. Computing Negative Wrapped Convolution • Also is the negatively wrapped convolution of n-vectors a and b where and 2 =  = principal nth root of unity

  26. Integer Multiplication by Polynomial Product (solved via FFT) • Input n bit integers a,bdefine polynomials degree k = n/L

  27. Integer Multiplication by Polynomial Product (cont’d) • Idea • Compute c(x) = a(x)· b(x) by convolution • Evaluate c(2L) = a· b

  28. Integer Multiplication Algorithms using Reduction to Polynomial Product • Pollard Mult Algorithm • Karp Mult Algorithm • Schönage-Strassen Mult Algorithm

  29. Pollard Multiplication Algorithm • n = kL, L = 1 + log k • Choose primes P1, P2, P3 where • Compute C(x) by convolution over finite field Zpi for i =1,2,3 (requires k mults on 2L bit integers)

  30. Pollard Multiplication Algorithm (cont’d) • Evaluate C(2L) • Time Bounds recursive mults FFT

  31. Korp Multiplication Algorithm • Compute C(x) modulo k by convolution • Compute C(x) modulo (22L+1) by convolution • Compute C(x) coefficients from C(x) mod k, C(x) mod (22L+1) by Chinese remaindering

  32. Korp Multiplication Algorithm (cont’d) • Compute C(2L) • Time recursive mults FFT

  33. Schönage-Strassen Multiplication Algorithm (2’) Compute C(x) mod (xk+1) modulo (22L+1) by wrapped convolution  requires only k recursive mults on 2L bit numbers • Time recursive mults FFT

  34. Still Open Problem: How Fast Can You Multiply Integers? • Can you mult n bit integers in O(n log n) time?

  35. The Fast Fourier Transform andApplications to Multiplication Analysis of Algorithms Prepared by John Reif, Ph.D.

More Related