-
Notifications
You must be signed in to change notification settings - Fork 2
FFT Algorithm
We explain the FFT algorithm on the cplx
layout. The reim layout follows the same mathematical principle, but separates real and imaginary parts.
FFT is usually described by separating the polynomial into odd and even powers of X (e.g.
The above presentation has
For practical applications, we are in general interested in keeping the coefficients in natural order, but are on the other hand more relaxed on the order in which the evaluations are presented in the FFT vector, as long as FFT and iFFT are consistent. We therefore use a dual description of the same algorithm.
Let
For
The main idea is to compute all the
There are many interesting properties we can derive from this figure:
- On the first layer
$(\ell=0,k=0)$ ,$(u_{0,0,0},\dots,u_{0,m-1,0})$ happen to be the$m$ coefficients of$P$ in natural order, which are the inputs of the FFT. - On the last layer
$(\ell=\log_2(m),j=0)$ ,$(u_{\log_2(m),0,0},\dots,u_{\log_2(m),0,m-1})$ happen to be the$m$ evaluations of$P$ in fracrevbit order, which are the outputs of the FFT. - There is a nice recurrence formula to compute layer
$\ell+1$ out of the previous one:$(u_{\ell+1,2k,j},u_{\ell+1,2k+1,j}) = \textrm{twiddle}(u_{\ell,k,j},u_{\ell,k,j+m/ 2^{\ell+1}},\omega_{\ell+1,2k})$ This means that the total number of twiddles is$m\log_2(m)/2$ and that only the current layer needs to reside in memory. - The twiddle formula allow to update the layer in place, and in a mostly sequential manner in memory.