5 6 convolution and fft fast fourier transform
play

5.6 Convolution and FFT Fast Fourier Transform: Applications - PowerPoint PPT Presentation

5.6 Convolution and FFT Fast Fourier Transform: Applications Applications. Optics, acoustics, quantum physics, telecommunications, control systems, signal processing, speech recognition, data compression, image processing. DVD, JPEG,


  1. 5.6 Convolution and FFT

  2. Fast Fourier Transform: Applications Applications.  Optics, acoustics, quantum physics, telecommunications, control systems, signal processing, speech recognition, data compression, image processing.  DVD, JPEG, MP3, MRI, CAT scan.  Numerical solutions to Poisson's equation. The FFT is one of the truly great computational developments of this [20th] century. It has changed the face of science and engineering so much that it is not an exaggeration to say that life as we know it would be very different without the FFT. -Charles van Loan 3

  3. Fast Fourier Transform: Brief History Gauss (1805, 1866). Analyzed periodic motion of asteroid Ceres. Runge-König (1924). Laid theoretical groundwork. Danielson-Lanczos (1942). Efficient algorithm. Cooley-Tukey (1965). Monitoring nuclear tests in Soviet Union and tracking submarines. Rediscovered and popularized FFT. Importance not fully realized until advent of digital computers. 4

  4. Polynomials: Coefficient Representation Polynomial. [coefficient representation] A ( x ) = a 0 + a 1 x + a 2 x 2 + L + a n − 1 x n − 1 1 x + b 2 x 2 + L + b n − 1 x n − 1 B ( x ) = b 0 + b Add: O(n) arithmetic operations. 1 ) x + L + ( a n − 1 + b n − 1 ) x n − 1 A ( x ) + B ( x ) = ( a 0 + b 0 ) + ( a 1 + b Evaluate: O(n) using Horner's method. A ( x ) = a 0 + ( x ( a 1 + x ( a 2 + L + x ( a n − 2 + x ( a n − 1 )) L )) Multiply (convolve): O(n 2 ) using brute force. 2 n − 2 i c i x i A ( x ) × B ( x ) = , where c i = a j b i − j ∑ ∑ i = 0 j = 0 5

  5. Polynomials: Point-Value Representation Fundamental theorem of algebra. [Gauss, PhD thesis] A degree n polynomial with complex coefficients has n complex roots. Corollary. A degree n-1 polynomial A(x) is uniquely specified by its evaluation at n distinct values of x. y y j = A(x j ) x j x 6

  6. Polynomials: Point-Value Representation Polynomial. [point-value representation] A ( x ): (x 0 , y 0 ), K , (x n-1 , y n − 1 ) B ( x ): (x 0 , z 0 ), K , (x n-1 , z n − 1 ) Add: O(n) arithmetic operations. A ( x ) + B ( x ): (x 0 , y 0 + z 0 ), K , (x n-1 , y n − 1 + z n − 1 ) Multiply: O(n), but need 2n-1 points. A ( x ) × B ( x ): (x 0 , y 0 × z 0 ), K , (x 2n-1 , y 2 n − 1 × z 2 n − 1 ) Evaluate: O(n 2 ) using Lagrange's formula. ( x − x j ) ∏ n − 1 j ≠ k A ( x ) = y k ∑ ( x k − x j ) ∏ k = 0 j ≠ k 7

  7. Converting Between Two Polynomial Representations Tradeoff. Fast evaluation or fast multiplication. We want both! Representation Multiply Evaluate Coefficient O(n 2 ) O(n) Point-value O(n) O(n 2 ) Goal. Make all ops fast by efficiently converting between two representations. ( x 0 , y 0 ), K , ( x n − 1 , y n − 1 ) a 0 , a 1 , K , a n-1 point-value coefficient representation representation 8

  8. Converting Between Two Polynomial Representations: Brute Force Coefficient to point-value. Given a polynomial a 0 + a 1 x + ... + a n-1 x n-1 , evaluate it at n distinct points x 0 , ... , x n-1 . O(n 2 ) for matrix-vector multiply n − 1 y 0   a 0 2   x 0 x 0 x 0   L 1       n − 1 y 1 a 1 2 x 1 x 1 x 1 L 1       n − 1 y 2 a 2  2  = x 2 x 2 x 2   L   1       M M M M M O M       n − 1 y n − 1 a n − 1    2    x n − 1 x n − 1 x n − 1 L 1 O(n 3 ) for Gaussian elimination       Vandermonde matrix is invertible iff x i distinct Point-value to coefficient. Given n distinct points x 0 , ..., x n-1 and values y 0 , ..., y n-1 , find unique polynomial a 0 + a 1 x + ... + a n-1 x n-1 that has given values at given points. 9

  9. Coefficient to Point-Value Representation: Intuition Coefficient to point-value. Given a polynomial a 0 + a 1 x + ... + a n-1 x n-1 , evaluate it at n distinct points x 0 , ... , x n-1 . Divide. Break polynomial up into even and odd powers.  A(x) = a 0 + a 1 x + a 2 x 2 + a 3 x 3 + a 4 x 4 + a 5 x 5 + a 6 x 6 + a 7 x 7 .  A even (x) = a 0 + a 2 x + a 4 x 2 + a 6 x 3 .  A odd (x) = a 1 + a 3 x + a 5 x 2 + a 7 x 3 .  A(-x) = A even (x 2 ) + x A odd (x 2 ).  A(-x) = A even (x 2 ) - x A odd (x 2 ). Intuition. Choose two points to be ± 1.  A(-1) = A even (1) + 1 A odd (1). Can evaluate polynomial of degree ≤ n  A(-1) = A even (1) - 1 A odd (1). at 2 points by evaluating two polynomials of degree ≤ ½ n at 1 point. 10

  10. Coefficient to Point-Value Representation: Intuition Coefficient to point-value. Given a polynomial a 0 + a 1 x + ... + a n-1 x n-1 , evaluate it at n distinct points x 0 , ... , x n-1 . Divide. Break polynomial up into even and odd powers.  A(x) = a 0 + a 1 x + a 2 x 2 + a 3 x 3 + a 4 x 4 + a 5 x 5 + a 6 x 6 + a 7 x 7 .  A even (x) = a 0 + a 2 x + a 4 x 2 + a 6 x 3 .  A odd (x) = a 1 + a 3 x + a 5 x 2 + a 7 x 3 .  A(-x) = A even (x 2 ) + x A odd (x 2 ).  A(-x) = A even (x 2 ) - x A odd (x 2 ). Intuition. Choose four points to be ± 1, ± i.  A(-1) = A even (-1) + 1 A odd ( 1). Can evaluate polynomial of degree ≤ n  A(-1) = A even (-1) - 1 A odd (-1). at 4 points by evaluating two polynomials  A(-i) = A even (-1) + i A odd (-1). of degree ≤ ½ n at 2 points.  A(-i) = A even (-1) - i A odd (-1). 11

  11. Discrete Fourier Transform Coefficient to point-value. Given a polynomial a 0 + a 1 x + ... + a n-1 x n-1 , evaluate it at n distinct points x 0 , ... , x n-1 . Key idea: choose x k = ω k where ω is principal n th root of unity.  1 1 1 1 L 1   y 0   a 0        ω 1 ω 2 ω 3 ω n − 1 L 1 y 1 a 1       ω 2 ω 4 ω 6 ω 2( n − 1)  L  1  y 2   a 2  =       ω 3 ω 6 ω 9 ω 3( n − 1) L 1 y 3 a 3       M M M M O M M   M           ω n − 1 ω 2( n − 1) ω 3( n − 1) ω ( n − 1)( n − 1) L 1 y n − 1 a n − 1       Discrete Fourier transform Fourier matrix F n 12

  12. Roots of Unity Def. An n th root of unity is a complex number x such that x n = 1. Fact. The n th roots of unity are: ω 0 , ω 1 , …, ω n-1 where ω = e 2 π i / n . Pf. ( ω k ) n = (e 2 π i k / n ) n = (e π i ) 2k = (-1) 2k = 1. Fact. The ½ n th roots of unity are: ν 0 , ν 1 , …, ν n/2-1 where ν = e 4 π i / n . Fact. ω 2 = ν and ( ω 2 ) k = ν k . ω 2 = ν 1 = i ω 3 ω 1 n = 8 ω 4 = ν 2 = -1 ω 0 = ν 0 = 1 ω 7 ω 5 ω 6 = ν 3 = -i 13

  13. Fast Fourier Transform Goal. Evaluate a degree n-1 polynomial A(x) = a 0 + ... + a n-1 x n-1 at its n th roots of unity: ω 0 , ω 1 , …, ω n-1 . Divide. Break polynomial up into even and odd powers.  A even (x) = a 0 + a 2 x + a 4 x 2 + … + a n/2-2 x (n-1)/2 .  A odd (x) = a 1 + a 3 x + a 5 x 2 + … + a n/2-1 x (n-1)/2 .  A(x) = A even (x 2 ) + x A odd (x 2 ). Conquer. Evaluate degree A even (x) and A odd (x) at the ½ n th roots of unity: ν 0 , ν 1 , …, ν n/2-1 . Combine.  A( ω k+n ) = A even ( ν k ) + ω k A odd ( ν k ), 0 ≤ k < n/2 ν k = ( ω k ) 2 = ( ω k+n ) 2  A( ω k+n ) = A even ( ν k ) - ω k A odd ( ν k ), 0 ≤ k < n/2 ω k+n = - ω k 14

  14. FFT Algorithm fft(n, a 0 ,a 1 ,…,a n-1 ) { if (n == 1) return a 0 (e 0 ,e 1 ,…,e n/2-1 ) ← FFT(n/2, a 0 ,a 2 ,a 4 ,…,a n-2 ) (d 0 ,d 1 ,…,d n/2-1 ) ← FFT(n/2, a 1 ,a 3 ,a 5 ,…,a n-1 ) for k = 0 to n/2 - 1 { ω k ← e 2 π ik/n y k+n/2 ← e k + ω k d k y k+n/2 ← e k - ω k d k } return (y 0 ,y 1 ,…,y n-1 ) } 15

  15. FFT Summary Theorem. FFT algorithm evaluates a degree n-1 polynomial at each of the n th roots of unity in O(n log n) steps. assumes n is a power of 2 Running time. T(2n) = 2T(n) + O(n) ⇒ T(n) = O(n log n). O(n log n) ( ω 0 , y 0 ), K , ( ω n − 1 , y n − 1 ) a 0 , a 1 , K , a n-1 point-value coefficient representation representation 16

  16. Recursion Tree a 0 , a 1 , a 2 , a 3 , a 4 , a 5 , a 6 , a 7 perfect shuffle a 0 , a 2 , a 4 , a 6 a 1 , a 3 , a 5 , a 7 a 0 , a 4 a 2 , a 6 a 3 , a 7 a 1 , a 5 a 0 a 4 a 2 a 6 a 1 a 5 a 3 a 7 000 100 010 110 001 101 011 111 "bit-reversed" order 17

  17. Point-Value to Coefficient Representation: Inverse DFT Goal. Given the values y 0 , ... , y n-1 of a degree n-1 polynomial at the n points ω 0 , ω 1 , …, ω n-1 , find unique polynomial a 0 + a 1 x + ... + a n-1 x n-1 that has given values at given points. − 1  L  1 1 1 1 1    y 0  a 0       ω 1 ω 2 ω 3 ω n − 1 1 L a 1 y 1       ω 2 ω 4 ω 6 ω 2( n − 1) L  1  a 2 y 2     =       ω 3 ω 6 ω 9 ω 3( n − 1) L 1 a 3 y 3       M M M M O M M   M           ω n − 1 ω 2( n − 1) ω 3( n − 1) ω ( n − 1)( n − 1) L 1 a n − 1 y n − 1       Inverse DFT Fourier matrix inverse (F n ) -1 18

  18. Inverse FFT Claim. Inverse of Fourier matrix is given by following formula.  1 1 1 1 L 1    ω − 1 ω − 2 ω − 3 ω − ( n − 1) L 1   ω − 2 ω − 4 ω − 6 ω − 2( n − 1)  L  1 = 1 G n   ω − 3 ω − 6 ω − 9 ω − 3( n − 1) L 1 n   M M M M O M     ω − ( n − 1) ω − 2( n − 1) ω − 3( n − 1) ω − ( n − 1)( n − 1) L 1   Consequence. To compute inverse FFT, apply same algorithm but use ω -1 = e -2 π i / n as principal n th root of unity (and divide by n). 19

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend