Introduction to "FFT"
First, I thought about it for a while. I hope to elaborate on FFT in a better way, open source, and share it.
......
Answer: What FFT?
FFT, fast Fourier transform. it is a fast DFT (discret Fourier Transform), because people are using DFT, the algorithm is very slow, the computing time is long, (you can't stand it for a long time, and so on ~ It has not yet computed the results), so Niu Ren tried to improve the traditional DFT algorithm. The improved result is FFT. It is not a new transformation, but an improvement of DFT. Due to its fast feature, it has been widely used ~
DFT:
For the complex number sequence, the discrete Fourier transformation formula is:
It takes some time to implement DFT.
Here, I used to take DFT notes. To understand FFT, we must first understand DFT.
Http://blog.csdn.net/cinmyheart/article/details/21050119
Get start with "FFT" (time-based-2 FFT Algorithm)
Algorithm principle:
Divides the DFT of the original part into two parts based on the parity of the input signal.
Finally, the original DFT [x (n)] is added to two parts by the constant transformation.
Note:
I. w2n = exp (-2 * pI * j * 2/n) = exp (-2 * pI * j/(n/2); this is an extremely important constant deformation! The cumulative range ranges from 0 ~ N-1, reduced to 0 ~ N/2-1 !!!
II. exp (-2 * pI * j * (R * k)/(n/2 )) = exp (-2 * pI * j * (R * (K + n/2)/(n/2 )) here we use the periodicity of exp (-2 * pI * j * X)
Using this periodicity, we can infer that,
This is a very important nature. With this periodicity, I know that we can figure out half of the data in the end, because it is the same!
X1 (n/2 + k) = x1 (k)
III.
K = 0, 1, 2, 3... (n/2-1)
Exploitation
W _ (n/2 + k) _ n = exp (-2 * pI * j * (N/2 + k)/n)
= W _ (n/2) _ n * W _ (k) _ n = exp (-2 * pI * j * (N/2)/n) * exp (-2 * pI * j * (k)/n)
=-W _ (k) _ n =-exp (-2 * pI * j * (K/n ))
So! W _ (n/2 + k) _ n =-W _ (k) _ n
+ N/2 on the left side of the equation produces the x1 (k) in the second half. [Note that the value range of K is no longer 0 ~ N-1 slightly]
Finally, we finished a very beautiful thing. It was simply "Mr Fortune Teller". Haha, using "half of the data, we can get all the data"
Why?
View this figure
X1 and X2 are input data
X (k) is the output,
X (K) = first half = x1 (k) + w_k_n * X2 (k );
X (K + n/2) = second half = x1 (k)-w_k_n * X2 (k );
K is 0 ~ N/2. At this time, we can use n/2 input data to obtain N output data.
It is based on the above reasons that the speed can be improved !!!
How can we implement the idea?
Butter fly
Here,
X (K) = first half = x1 (k) + w_k_n * X2 (k );
X (K + n/2) = second half = x1 (k)-w_k_n * X2 (k );
Does it look like a butterfly ~
This is based on the DFT of n/2 points, so there is only one parity re-sorting,
The first four vertices are odd order points, and the last four are even order points (note that the count starts from 0, not 1, so 0 is an odd order point)
The result is actually 4 pairs of butterflies ,:)
Here N = 8, there can be 4 vertices in n/2, you can also perform the parity sorting until there are only two vertices, do not need to perform the parity sorting again
Precautions for Program Implementation
1. Parity re-sorting-Implementation Method bits reversal, which will be provided in the following link in the form of C language code demo
2. In the first layer, w_0_n Layer 2 w_0_n, w_2_n, Layer 3 w_0_n w_1_n w_2_n w_3_n
The relationship between the coefficient r of the w_r_n and the number of layers is expressed
TMP = k <(bits-M );
Then, take the lower M valid bits to obtain the r
R = TMP & (1 <m)-1 );
3. It's time to implement yourown fft!
Http://blog.csdn.net/cinmyheart/article/details/39042623
Introduction to "FFT"