CSE 421 Algorithms Richard Anderson Lecture 15 Fast Fourier Transform.

Slides:



Advertisements
Similar presentations
Instructor Neelima Gupta Table of Contents Divide and Conquer.
Advertisements

Fast Fourier Transform Lecture 6 Spoken Language Processing Prof. Andrew Rosenberg.
FFT1 The Fast Fourier Transform. FFT2 Outline and Reading Polynomial Multiplication Problem Primitive Roots of Unity (§10.4.1) The Discrete Fourier Transform.
Administrative Oct. 2 Oct. 4 – QUIZ #2 (pages of DPV)
Lecture 37 CSE 331 Nov 4, Homework stuff (Last!) HW 10 at the end of the lecture Solutions to HW 9 on Monday Graded HW 9 on.
Richard Fateman CS 282 Lecture 101 The Finite-Field FFT Lecture 10.
FFT(Fast Fourier Transform). p2. FFT Coefficient representation: How to evaluate A(x 0 )?
FFT1 The Fast Fourier Transform by Jorge M. Trabal.
Faster Multiplication, Powering of Polynomials
Lecture 38 CSE 331 Dec 3, A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) .
Princeton University COS 423 Theory of Algorithms Spring 2002 Kevin Wayne Fast Fourier Transform Jean Baptiste Joseph Fourier ( ) These lecture.
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 16: Application-Driven Hardware Acceleration (1/4)
CSE 421 Algorithms Richard Anderson Lecture 16 Dynamic Programming.
Richard Fateman CS 282 Lecture 51 Faster Multiplication, Powering of Polynomials Lecture 5.
Lecture 36 CSE 331 Dec 2, Graded HW 8 END of the lecture.
CSE 421 Algorithms Richard Anderson Lecture 13 Divide and Conquer.
Lecture 37 CSE 331 Dec 1, A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) .
Introduction to Algorithms
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.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 10 Roots of Polynomials.
Fast Fourier Transform Irina Bobkova. Overview I. Polynomials II. The DFT and FFT III. Efficient implementations IV. Some problems.
Fourier Interpolation. The Fourier Method of Interpolation is a way a interpolating data that uses combinations of sin( px ) and cos( px ) where p is.
1 Chapter 5 Divide and Conquer Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 Fingerprinting techniques. 2 Is X equal to Y? = ? = ?
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
Karatsuba’s Algorithm for Integer Multiplication
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
1 Fast Polynomial and Integer Multiplication Jeremy R. Johnson.
CSE 421 Algorithms Lecture 15 Closest Pair, Multiplication.
PreCalculus Section 2.6 Solve polynomial equations by factoring and the Rational Roots Theorem. Solve by factoring: x 3 + 5x 2 – 4x – 20 = 0 x 6 – x 3.
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.
Chapter 2 Divide-and-Conquer algorithms
Lecture 16 Fast Fourier Transform
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Polynomial + Fast Fourier Transform
Richard Anderson Lecture 17 Dynamic Programming
September 4, 1997 Applied Symbolic Computation (CS 300) Fast Polynomial and Integer Multiplication Jeremy R. Johnson.
CS38 Introduction to Algorithms
Polynomials and the FFT(UNIT-3)
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.
Punya Biswas Lecture 15 Closest Pair, Multiplication
The Fast Fourier Transform
Lecture 33 CSE 331 Nov 18, 2016.
Lecture 33 CSE 331 Nov 17, 2017.
Advanced Algorithms Analysis and Design
Richard Anderson Lecture 16 Dynamic Programming
September 4, 1997 Applied Symbolic Computation (CS 567) Fast Polynomial and Integer Multiplication Jeremy R. Johnson.
CSEP 521 Applied Algorithms
Lecture 11 Overview Self-Reducibility.
Richard Anderson Lecture 16a Dynamic Programming
Richard Anderson Lecture 16 Dynamic Programming
Chapter 5 Divide and Conquer
Applied Symbolic Computation
Richard Anderson Lecture 14 Inversions, Multiplication, FFT
Lecture 36 CSE 331 Nov 28, 2011.
Lecture 36 CSE 331 Nov 30, 2012.
The Fast Fourier Transform
Lecture 15, Winter 2019 Closest Pair, Multiplication
Richard Anderson Lecture 16, Winter 2019 Dynamic Programming
Lecture 15 Closest Pair, Multiplication
Fast Polynomial and Integer Multiplication
Presentation transcript:

CSE 421 Algorithms Richard Anderson Lecture 15 Fast Fourier Transform

FFT, Convolution and Polynomial Multiplication FFT: O(n log n) algorithm –Evaluate a polynomial of degree n at n points in O(n log n) time Polynomial Multiplication: O(n log n) time

Complex Analysis Polar coordinates: re  i e  i = cos  + i sin  a is an n th root of unity if a n = 1 Square roots of unity: +1, -1 Fourth roots of unity: +1, -1, i, -i –Eighth roots of unity: +1, -1, i, -i,  + i ,  - i , -  + i , -  - i  where  = sqrt(2)

e 2  ki/n e 2  i = 1 e  i = -1 n th roots of unity: e 2  ki/n for k = 0 …n-1 Notation:  k,n = e 2  ki/n Interesting fact: 1 +  k,n +  2 k,n +  3 k,n  n-1 k,n = 0 for k != 0

FFT Overview Polynomial interpolation –Given n+1 points (x i,y i ), there is a unique polynomial P of degree at most n which satisfies P(x i ) = y i

Polynomial Multiplication n-1 degree polynomials A(x) = a 0 + a 1 x + a 2 x 2 + … +a n-1 x n-1, B(x) = b 0 + b 1 x + b 2 x 2 + …+ b n-1 x n-1 C(x) = A(x)B(x) C(x)=c 0 +c 1 x + c 2 x 2 + … + c 2n-2 x 2n-2 p 1, p 2,..., p 2n A(p 1 ), A(p 2 ),..., A(p 2n ) B(p 1 ), B(p 2 ),..., B(p 2n ) C(p i ) = A(p i )B(p i ) C(p 1 ), C(p 2 ),..., C(p 2n )

FFT Polynomial A(x) = a 0 + a 1 x a n-1 x n-1 Compute A(  j,n ) for j = 0,..., n-1 For simplicity, n is a power of 2

Useful trick A(x) = a 0 + a 1 x + a 2 x 2 + a 3 x a n-1 x n-1 A even (x) = a 0 + a 2 x + a 4 x a n-2 x (n-2)/2 A odd (x) = a 1 + a 3 x + a 5 x 2 + …+ a n-1 x (n-2)/2 Show: A(x) = A even (x 2 ) + x A odd (x 2 )

Lemma:  2 j,2n =  j,n Squares of 2n th roots of unity are n th roots of unity

FFT Algorithm // Evaluate the 2n-1 th degree polynomial A at //  0,2n,  1,2n,  2,2n,...,  2n-1,2n FFT(A, 2n) Recursively compute FFT(A even, n) Recursively compute FFT(A odd, n) for j = 0 to 2n-1 A(  j,2n ) = A even (  2 j,2n ) +  j,2n A odd (  2 j,2n )

Polynomial Multiplication n-1 th degree polynomials A and B Evaluate A and B at  0,2n,  1,2n,...,  2n-1,2n Compute C(  j,2n ) for j = 0 to 2n -1 We know the value of a 2n-2 th degree polynomial at 2n points – this determines a unique polynomial, we just need to determine the coefficients

Now the magic happens... C(x) = c 0 + c 1 x + c 2 x 2 + … + c 2n-1 x 2n-1 (we want to compute the c i ’s) Let d j = C(  j,2n ) D(x) = d 0 + d 1 x + d 2 x 2 + … + d 2n-1 x 2n-1 Evaluate D(x) at the 2n th roots of unity D(  j,2n ) = [see text for details] = 2nc 2n-j

Polynomial Interpolation Build polynomial from the values of C at the 2n th roots of unity Evaluate this polynomial at the 2n th roots of unity

Dynamic Programming Weighted Interval Scheduling Given a collection of intervals I 1,…,I n with weights w 1,…,w n, choose a maximum weight set of non-overlapping intervals

Recursive Algorithm Intervals sorted by finish time p[i] is the index of the last interval which finishes before i starts

Optimality Condition Opt[j] is the maximum weight independent set of intervals I 1, I 2,..., I j

Algorithm MaxValue(j) = if j = 0 return 0 else return max( MaxValue(j-1), w j + MaxValue(p[ j ]))

Run time What is the worst case run time of MaxValue Design a worst case input

A better algorithm M[ j ] initialized to -1 before the first recursive call for all j MaxValue(j) = if j = 0 return 0; else if M[ j ] != -1 return M[ j ]; else M[ j ] = max(MaxValue(j-1),w j + MaxValue(p[ j ])); return M[ j ];