Convolution - Brigham Young University

Download Report

Transcript Convolution - Brigham Young University

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
CS 312: Algorithm Design &
Analysis
Lecture #15: Overview of the Fast
Fourier Transform
Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer, Sean Warnick;
some figures adapted from Dasgupta et al.
Announcements

HW #9


Project #7




Early: today!
Due: Friday
Required: submit answers to both surveys
End of semester:





Due now
This Friday: Final lecture
Monday: review for final exam
Tuesday: last day for late project reports
Final exam: consult the schedule on Learning Suite
Grades:


Ignore the “overall grade” column in Learning Suite
Use the “What If” calculator
Objectives
 Discover how to make a divide and
conquer algorithm for polynomial
evaluation, namely the Fast Fourier
Transform (FFT)
 Use the FFT and Inverse FFT for a faster
solution to convolution
Convolution is Useful!
⊗
=
• Polynomial multiplication
• Noise filtering and other
DSP
• Edge finding and other
Image Processing
Algorithms for Convolution
1. Polynomial multiplication
2. Computing 𝑐𝑘 directly (the moving trains)
Two more algorithms today.
Value Representation
 How many distinct points determine a
line?
 How many distinct points determine a
parabola?
…
 How many distinct points determine a
degree-𝑑 polynomial?
 Any 𝑑 + 1 distinct points.
Mapping Between The
Representations
First, choose 𝑑 + 1 unique points: 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑑
Mapping Between The
Representations
First, choose 𝑑 + 1 unique points: 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑑
Mapping Between The
Representations
First, choose 𝑑 + 1 unique points: 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑑
Mapping Between The
Representations
Choose 2𝑑 + 1 unique points.
& 𝐴 𝑥𝑑+1 , 𝐴 𝑥𝑑+2 , … , 𝐴(𝑥2𝑑 )
𝐵 𝑥0 , 𝐵 𝑥1 , … , 𝐵(𝑥2𝑑 )
𝐶 𝑥0 , 𝐶 𝑥1 , … , 𝐶(𝑥2𝑑 )
A New Algorithm (“the round trip”)
for Polynomial multiplication
Questions about Convolution
1. Is it Correct?
2. How long does it take?
3. Can we do better?
Coefficient
Representation
A,B
Evaluation
Convolution
Coefficient
Representation
C
Value
Representation
A,B
Multiplication
Interpolation
Value
Representation
C
Evaluation as Divide and Conquer
Key Idea #1: Split polynomial in half
and represent halves as function of 𝑥;
evaluate them at 𝑥 2 ; halves have degree
𝑛
2
.
Key Idea #2: Choose Clever Points
If we can choose wisely, we can have a D&C algorithm
whose running time is captured by our favorite recurrence
relation:
Solution 𝑇 𝑛 ∈ 𝑂(𝑛 log 𝑛)
Value Representation
A degree-𝑑 polynomial is uniquely
characterized by its values at any 𝑑 +
1 distinct points.
I didn’t say the points had to have real
values …
N-th Complex Roots of Unity
N-th Complex Roots of Unity
Review: The Complex Plane
Multiplication of Complex
Numbers
Powers of Complex Numbers
(on the unit circle)
Roots of Complex Numbers
(on the unit circle)
Punch-Line: N-th Complex
Roots of Unity
Punch-Line: N-th Complex
Roots of Unity
N-th Complex Roots of Unity
Divide and Conquer
Picking the Seed Root 
=e
2 /n
Recursive Calls
The FFT
One more piece:
Interpolation by FFT!
Questions about Convolution
1. Is it Correct?
2. How long does it take?
3. Can we do better?
Coefficient
Representation
A,B
Evaluation
Convolution
Coefficient
Representation
C
Value
Representation
A,B
Multiplication
Interpolation
Value
Representation
C
Algorithms for Convolution
1. Polynomial multiplication
2. Computing 𝑐𝑘 directly (the moving trains)
3. Round-trip through value representation
using naïve approach
4. Round-trip through value
representation using the FFT
Important Ideas
Even if you’re not completely comfortable with the nth roots of
unity, the following points should be noted:
 The convolution problem is important.
 The polynomial-multiplication algorithm for convolution is
quadratic.
 There is a more efficient algorithm for convolution.
 The more efficient algorithm requires the FFT (and the inverse
FFT).
 The FFT is a Divide and Conquer algorithm.
 Analyzing the FFT algorithm is just like analyzing any Divide
and Conquer algorithm.
 You have some high-level intuition into how the FFT works / is
correct.
Take CS 450 (Image Processing) to master the FFT.
Assignment
No more homework!
Proj. #7 due Friday
Any late projects due by end of day on
Tuesday.