[Tutorial] Linear Time FFT

Правка en2, от TheBhediyaOfDalalStreet, 2023-02-16 17:19:10

Hell guys, today I gonna teach you to do linear time FFT.

Below is the problem:

Q) Given array of n integers, do First Four Traversal on array.

eg. array is [1, 2, 3, 4, 5, 6, 2, 1], then FFT of array is [1, 2, 3, 4].


So in first, it look very dangerous problem, but on meticulous scrutiny of the underlying scheme, we find easy solution.

  • So to solve, we iterate over the array from left to right. While left to right is happening, store first 5 elements of array in an array x[5] = [1, 2, 3, 4, 5].

For those thinking why 5, there is actually a very high IQ reason behind it. So maybe not everyone get it, so I not telling it in this blog.

  • Now what we are gonna doing is, we are find the circular-convolution of the array xc = x * x. This is the very easy technique, so I hope all will be able to find auto-convolution.

For up example, xc[5] = [45, 50, 50, 45, 355].

  • Now we will using the easy technique: Discrete Fourier Transform (DFT) to calculate X(5) of xc[5]. This step is easy so I am skip

  • Next we can find the square root of X(5) and take the inverse DFT of the sequence i[5].

  • Then we can simply print the first 4 element of i[5].

For those thinking why 4, there is actually a very high IQ reason behind it. So maybe not everyone get it, so I not telling it in this blog.

Time complexity analysis: Linear

Теги fft, tutorial

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский TheBhediyaOfDalalStreet 2023-02-24 07:45:16 0 (published)
en5 Английский TheBhediyaOfDalalStreet 2023-02-19 20:16:17 22
en4 Английский TheBhediyaOfDalalStreet 2023-02-17 19:19:26 6 Tiny change: 'ay xc = x[5] * x[5]. This i' -> 'ay xc = x[0:5] ⋆ x[0:5]. This i'
en3 Английский TheBhediyaOfDalalStreet 2023-02-17 19:15:09 61
en2 Английский TheBhediyaOfDalalStreet 2023-02-16 17:19:10 956 Tiny change: 'his blog._' -> 'his blog._\n\nTime complexity analysis: Linear'
en1 Английский TheBhediyaOfDalalStreet 2023-02-14 20:15:30 465 Initial revision (saved to drafts)