FFT1 The Fast Fourier Transform. FFT2 Outline and Reading Polynomial Multiplication Problem Primitive Roots of Unity (§10.4.1) The Discrete Fourier Transform.

Slides:



Advertisements
Similar presentations
Fast Fourier Transform for speeding up the multiplication of polynomials an Algorithm Visualization Alexandru Cioaca.
Advertisements

Parallel Fast Fourier Transform Ryan Liu. Introduction The Discrete Fourier Transform could be applied in science and engineering. Examples: ◦ Voice recognition.
Digital Kommunikationselektronik TNE027 Lecture 5 1 Fourier Transforms Discrete Fourier Transform (DFT) Algorithms Fast Fourier Transform (FFT) Algorithms.
296.3Page :Algorithms in the Real World Error Correcting Codes II – Cyclic Codes – Reed-Solomon Codes.
15-853:Algorithms in the Real World
Polynomial and FFT. Topics 1. Problem 2. Representation of polynomials 3. The DFT and FFT 4. Efficient FFT implementations 5. Conclusion.
Instructor Neelima Gupta Table of Contents Divide and Conquer.
Copyright © 2007 Pearson Addison-Wesley. All rights reserved. Problem Reduction Dr. M. Sakalli Marmara Unv, Levitin ’ s notes.
Fast Fourier Transform Lecture 6 Spoken Language Processing Prof. Andrew Rosenberg.
Administrative Oct. 2 Oct. 4 – QUIZ #2 (pages of DPV)
Richard Fateman CS 282 Lecture 101 The Finite-Field FFT Lecture 10.
CSE 421 Algorithms Richard Anderson Lecture 15 Fast Fourier Transform.
FFT(Fast Fourier Transform). p2. FFT Coefficient representation: How to evaluate A(x 0 )?
FFT1 The Fast Fourier Transform by Jorge M. Trabal.
Princeton University COS 423 Theory of Algorithms Spring 2002 Kevin Wayne Fast Fourier Transform Jean Baptiste Joseph Fourier ( ) These lecture.
5 - 1 § 5 The Divide-and-Conquer Strategy e.g. find the maximum of a set S of n numbers.
Chapter 11 Algebraic Coding Theory. Single Error Detection M = (1, 1, …, 1) is the m  1 parity check matrix for single error detection. If c = (0, 1,
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 16: Application-Driven Hardware Acceleration (1/4)
Introduction to Algorithms
Fast Multiplication Polynomial multiplication Toom–Cook method
The Fourier series A large class of phenomena can be described as periodic in nature: waves, sounds, light, radio, water waves etc. It is natural to attempt.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 14 Instructor: Paul Beame.
11/26/02CSE FFT,etc CSE Algorithms Polynomial Representations, Fourier Transfer, and other goodies. (Chapters 28-30)
Fast Fourier Transform Irina Bobkova. Overview I. Polynomials II. The DFT and FFT III. Efficient implementations IV. Some problems.
Fourier Transformations Jeff Edmonds York University COSC 6111 Change from Time to Polynomial Basis Evaluating & Interpolating FFT in nlogn Time Roots.
By: Hector L Contreras SSGT / USMC
Great Theoretical Ideas in Computer Science.
1 Chapter 5 Divide and Conquer Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CS654: Digital Image Analysis Lecture 15: Image Transforms with Real Basis Functions.
CS 6068 Parallel Computing Fall 2013 Lecture 10 – Nov 18 The Parallel FFT Prof. Fred Office Hours: MWF.
FFT1 The Fast Fourier Transform. FFT2 Outline and Reading Polynomial Multiplication Problem Primitive Roots of Unity (§10.4.1) The Discrete Fourier Transform.
5.6 Convolution and FFT. 2 Fast Fourier Transform: Applications Applications. n Optics, acoustics, quantum physics, telecommunications, control systems,
The Fast Fourier Transform
Advanced Algebraic Algorithms on Integers and Polynomials Prepared by John Reif, Ph.D. Analysis of Algorithms.
Karatsuba’s Algorithm for Integer Multiplication
Great Theoretical Ideas in Computer Science.
Applied Symbolic Computation1 Applied Symbolic Computation (CS 300) Karatsuba’s Algorithm for Integer Multiplication Jeremy R. Johnson.
The Fast Fourier Transform and Applications to Multiplication
Inverse DFT. Frequency to time domain Sometimes calculations are easier in the frequency domain then later convert the results back to the time domain.
06/12/2015Applied Algorithmics - week41 Non-periodicity and witnesses  Periodicity - continued If string w=w[0..n-1] has periodicity p if w[i]=w[i+p],
1 Fast Polynomial and Integer Multiplication Jeremy R. Johnson.
1 Mathematical Algorithms 1. Arithmetic, (Pseudo) Random Numbers and all that 2. Evaluation & Multiplication of Polynomials I 3. Multiplication of Large.
Algorithms 2005 Ramesh Hariharan. Polynomial Computation.
Applied Symbolic Computation1 Applied Symbolic Computation (CS 567) The Fast Fourier Transform (FFT) and Convolution Jeremy R. Johnson TexPoint fonts used.
May 9, 2001Applied Symbolic Computation1 Applied Symbolic Computation (CS 680/480) Lecture 6: Multiplication, Interpolation, and the Chinese Remainder.
MA/CSSE 473 Day 06 DivisionPrimes Modular Arithmetic.
week 8Complexity of Algorithms1 Elementary Number Theory Given positive integers a and b, we use the notation a¦b to indicated that a divides b, i.e.,
Chapter 2 Divide-and-Conquer algorithms
DIGITAL SIGNAL PROCESSING ELECTRONICS
Chapter 2 Divide-and-Conquer algorithms
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Catie Baker Spring 2015.
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Polynomial + Fast Fourier Transform
Applied Symbolic Computation
September 4, 1997 Applied Symbolic Computation (CS 300) Fast Polynomial and Integer Multiplication Jeremy R. Johnson.
Applied Symbolic Computation
Fast Fourier Transform
Applied Symbolic Computation
DFT and FFT By using the complex roots of unity, we can evaluate and interpolate a polynomial in O(n lg n) An example, here are the solutions to 8 =
September 4, 1997 Applied Symbolic Computation (CS 300) Fast Polynomial and Integer Multiplication Jeremy R. Johnson.
The Fast Fourier Transform
Advanced Algorithms Analysis and Design
Applied Symbolic Computation
Applied Symbolic Computation
September 4, 1997 Applied Symbolic Computation (CS 567) Fast Polynomial and Integer Multiplication Jeremy R. Johnson.
Chapter 5 Divide and Conquer
Applied Symbolic Computation
The Fast Fourier Transform
Applied Symbolic Computation
Fast Polynomial and Integer Multiplication
Presentation transcript:

FFT1 The Fast Fourier Transform

FFT2 Outline and Reading Polynomial Multiplication Problem Primitive Roots of Unity (§10.4.1) The Discrete Fourier Transform (§10.4.2) The FFT Algorithm (§10.4.3) Integer Multiplication (§10.4.4) Java FFT Integer Multiplication (§10.5)

FFT3 Polynomials Polynomial: In general,

FFT4 Polynomial Evaluation Horner’s Rule: Given coefficients (a 0,a 1,a 2,…,a n-1 ), defining polynomial Given x, we can evaluate p(x) in O(n) time using the equation Eval(A,x): [Where A=(a 0,a 1,a 2,…,a n-1 )] If n=1, then return a 0 Else,  Let A’=(a 1,a 2,…,a n-1 ) [assume this can be done in constant time]  return a 0 +x*Eval(A’,x)

FFT5 Polynomial Multiplication Problem Given coefficients (a 0,a 1,a 2,…,a n-1 ) and (b 0,b 1,b 2,…,b n-1 ) defining two polynomials, p() and q(), and number x, compute p(x)q(x). Horner’s rule doesn’t help, since where A straightforward evaluation would take O(n 2 ) time. The “magical” FFT will do it in O(n log n) time.

FFT6 Polynomial Interpolation & Polynomial Multiplication Given a set of n points in the plane with distinct x-coordinates, there is exactly one (n-1)-degree polynomial going through all these points. Alternate approach to computing p(x)q(x): Calculate p() on 2n x-values, x 0,x 1,…,x 2n-1. Calculate q() on the same 2n x values. Find the (2n-1)-degree polynomial that goes through the points {(x 0,p(x 0 )q(x 0 )), (x 1,p(x 1 )q(x 1 )), …, (x 2n-1,p(x 2n-1 )q(x 2n-1 ))}. Unfortunately, a straightforward evaluation would still take O(n 2 ) time, as we would need to apply an O(n)-time Horner’s Rule evaluation to 2n different points. The “magical” FFT will do it in O(n log n) time, by picking 2n points that are easy to evaluate…

FFT7 Primitive Roots of Unity A number  is a primitive n-th root of unity, for n>1, if  n = 1 The numbers 1, ,  2, …,  n-1 are all distinct Example 1: Z * 11 : 2, 6, 7, 8 are 10-th roots of unity in Z * =4, 6 2 =3, 7 2 =5, 8 2 =9 are 5-th roots of unity in Z * =6, 3 -1 =4, 4 -1 =3, 5 -1 =9, 6 -1 =2, 7 -1 =8, 8 -1 =7, 9 -1 =5 Example 2: The complex number e 2  i/n is a primitive n-th root of unity, where

FFT8 Properties of Primitive Roots of Unity Inverse Property: If  is a primitive root of unity, then  -1 =  n-1 Proof:  n-1 =  n =1 Cancellation Property: For non-zero -n<k<n, Proof: Reduction Property: If w is a primitve (2n)-th root of unity, then  2 is a primitive n-th root of unity. Proof: If 1, ,  2,…,  2n-1 are all distinct, so are 1,  2,(  2 ) 2,…,(  2 ) n-1 Reflective Property: If n is even, then  n/2 = -1. Proof: By the cancellation property, for k=n/2: Corollary:  k+n/2 = -  k.

FFT9 The Discrete Fourier Transform Given coefficients (a 0,a 1,a 2,…,a n-1 ) for an (n-1)-degree polynomial p(x) The Discrete Fourier Transform is to evaluate p at the values 1, ,  2,…,  n-1 We produce (y 0,y 1,y 2,…,y n-1 ), where y j =p(  j ) That is, Matrix form: y=Fa, where F[i,j]=  ij. The Inverse Discrete Fourier Transform recovers the coefficients of an (n-1)-degree polynomial given its values at 1, ,  2,…,  n-1 Matrix form: a=F -1 y, where F -1 [i,j]=  -ij /n.

FFT10 Correctness of the inverse DFT The DFT and inverse DFT really are inverse operations Proof: Let A=F -1 F. We want to show that A=I, where If i=j, then If i and j are different, then

FFT11 Convolution The DFT and the inverse DFT can be used to multiply two polynomials So we can get the coefficients of the product polynomial quickly if we can compute the DFT (and its inverse) quickly…

FFT12 The Fast Fourier Transform The FFT is an efficient algorithm for computing the DFT The FFT is based on the divide-and-conquer paradigm: If n is even, we can divide a polynomial into two polynomials and we can write

FFT13 The FFT Algorithm The running time is O(n log n). [inverse FFT is similar]

FFT14 Multiplying Big Integers Given N-bit integers I and J, compute IJ. Assume: we can multiply words of O(log N) bits in constant time. Setup: Find a prime p=cn+1 that can be represented in one word, and set m=(log p)/3, so that we can view I and J as n-length vectors of m-bit words. Finding a primitive root of unity. Find a generator x of Z * p. Then  =x c is a primitive n-th root of unity in Z * p (arithmetic is mod p) Apply convolution and FFT algorithm to compute the convolution C of the vector representations of I and J. Then compute K is a vector representing IJ, and takes O(n log n) time to compute.

FFT15 Java Example: Multiplying Big Integers Setup: Define BigInt class, and include essential parameters, including the prime, P, and primitive root of unity, OMEGA. 10;

FFT16 Java Integer Multiply Method Use convolution to multiply two big integers, this and val:

FFT17 Java FFT in Z * p

FFT18 Support Methods for Java FFT in Z * p

FFT19 Non-recursive FFT There is also a non-recursive version of the FFT Performs the FFT in place Precomputes all roots of unity Performs a cumulative collection of shuffles on A and on B prior to the FFT, which amounts to assigning the value at index i to the index bit-reverse(i). The code is a bit more complex, but the running time is faster by a constant, due to improved overhead

FFT20 Experimental Results Log-log scale shows traditional multiply runs in O(n 2 ) time, while FFT versions are almost linear