Fast Fourier Transform 2 Announcements HW 3 posted tonight (after - - PowerPoint PPT Presentation

fast fourier transform
SMART_READER_LITE
LIVE PREVIEW

Fast Fourier Transform 2 Announcements HW 3 posted tonight (after - - PowerPoint PPT Presentation

1 Fast Fourier Transform 2 Announcements HW 3 posted tonight (after this) 3 Fast Fourier Transform 4 Math ground work Let Called n th roots of unity We will prove/use: 5 Math ground work Prove: By definition: Prove: Again, by


slide-1
SLIDE 1

Fast Fourier Transform

1

slide-2
SLIDE 2

Announcements

HW 3 posted tonight (after this)

2

slide-3
SLIDE 3

Fast Fourier Transform

3

slide-4
SLIDE 4

Math ground work

Let Called “nth roots of unity” We will prove/use:

4

slide-5
SLIDE 5

Math ground work

Prove: By definition: Prove: Again, by definition:

5

slide-6
SLIDE 6

Math ground work

Prove: A geometric sum is known to be: ... thus: k not divisible by n, denominator ≠ 0

6

slide-7
SLIDE 7

Math ground work

Prove: Direct proof: (using proof #1) Picture proof: Thus, twice the angle

7

slide-8
SLIDE 8

Fast Fourier Transform

First, we need to efficiently go from coefficient to point form (n is even) We will use the n roots of unity for xs

8

slide-9
SLIDE 9

Fast Fourier Transform

We can use the symmetry of the unity roots to divide & conquer: First we break even and odd indexed coefficients into their own polys

9

slide-10
SLIDE 10

Fast Fourier Transform

We then notice that: Thus:

10

slide-11
SLIDE 11

Fast Fourier Transform

By proof #4, computing A() as: ... breaks down the problem into: two parts, each with half the points (as squaring nth unity roots gives n/2 unity roots)

11

slide-12
SLIDE 12

Fast Fourier Transform

By following this process, we get the following tree: A[0] A[1] A(x)

12

slide-13
SLIDE 13

Fast Fourier Transform

Recursive-FFT(a) n = a.length (n assumed power of 2) if (n == 1), return a wn= e2πi/n, w = 1 a[0] = (a0, a2, ... an-2), a[1] = (a1, a3, ... an-1) y[0] = Recursive-FFT(a[0]) y[1] = Recursive-FFT(a[1]) for k = 0 to n/2 - 1 yk = y[0]k + w * y[1]k yk+(n/2) = y[0]k - w * y[1]k w = w * wn return y

13

slide-14
SLIDE 14

Fast Fourier Transform

For loop runs O(n) times with O(1) work inside each loop 2 recursive calls each size n/2, thus...

14

slide-15
SLIDE 15

Fast Fourier Transform

The first line of loop computes: Similarly, the second finds: proof #2

15

slide-16
SLIDE 16

Fast Fourier Transform

Suppose.... A(x) = (x+1) B(x) = (x2 - 2x + 3) The A(x)*B(x) will be degree 3 (thus 4 coefficients) So 4 points needed on A(x) and B(x)

16

slide-17
SLIDE 17

Fast Fourier Transform

To do this we buffer some “0” coefficients: A(x) = (x+1) = (0x3 + 0x2 + x + 1) So coefficients (from power 0) = [1 1 0 0] From this we can run FFT

17

slide-18
SLIDE 18

Fast Fourier Transform

just did did last time ... =(

18

slide-19
SLIDE 19

Fast Fourier Transform

If you remember from last time, we want to solve for y's in: y V (x's) a

19

slide-20
SLIDE 20

Fast Fourier Transform

To solve for a's in previous, we use the math magic below! Due to unity root magic

20

slide-21
SLIDE 21

Fast Fourier Transform

Proof: (that this is V-1) Using proof #3, if j ≠ k then this is 0 When j = k, we have

21

slide-22
SLIDE 22

Fast Fourier Transform

Wait, a second... we basically just solved y = V a, with Now we want to solve (knowing y not a) a = V-1 y, with This is a very similar problem!

22

slide-23
SLIDE 23

Fast Fourier Transform

Recursive-FFT-backwards(y) n = y.length (n assumed power of 2) if (n == 1), return y wn= e-2πi/n, w = 1 y[0] = (y0, y2, ... yn-2), y[1] = (y1, y3, ... yn-1) a[0] = Recursive-FFT-backwards(y[0]) a[1] = Recursive-FFT-backwards(y[1]) for k = 0 to n/2 - 1 ak = a[0]k + w * a[1]k ak+(n/2) = a[0]k - w * a[1]k w = w * wn return a

  • nly added “-” to exponent

swap y and a after recursion, divide a by n in main

23

slide-24
SLIDE 24

Fast Fourier Transform

Breaking down A(x) into A[0](x) and A[1](x) gives: If we can get ai in order of the bottom we can efficiently compute A

25

slide-25
SLIDE 25

Fast Fourier Transform

Consider the order: [a0, a4, a2, a6, a1, a5, a3, a7] See a pattern?

26

slide-26
SLIDE 26

Fast Fourier Transform

Consider the order: [a0, a4, a2, a6, a1, a5, a3, a7] See a pattern? ... what if I write it as: [000,100,010,110,001,101,011,111] These are just the bits inversed

27

slide-27
SLIDE 27

Fast Fourier Transform

Thus, if we initially swap the coefficient matrix in this order...

  • 1. We can update the value in place
  • 2. Each level of the tree, we compare

coefficients twice as far as the previous

28

slide-28
SLIDE 28

Fast Fourier Transform

Thus we can compute it iteratively as: Good for parallel processing?

29

slide-29
SLIDE 29

Fast Fourier Transform

This works well for a circuit, but not so much for multi-core The processes need to wait until all previous level done to continue

30

slide-30
SLIDE 30

Fast Fourier Transform

It might work just as well (or better) to parallelize the recursive calls cpu #1 solves cpu #2 solves Easy ~2x speed up!

31