fftplan_new
Creation of a FFT computing plan (to compute efficiently several FFT).
Namespace: dsp::fourier
Prototype
sptr<FFTPlan> fftplan_new(int n=-1, bool forward=true, bool normalize=true)
Parameters
n | Vector length (optional parameter) |
forward | If true, direct transform, otherwise inverse transform. |
normalize | If true, then the transform includes a normalization factor of \(1/\sqrt{N}\) so as to have the same total energy for the input and output samples. |
Returns
A poin Filter cfloat vers cfloat.
Description
This function will create a structure which will be efficient to compute sereral FFT with the same data length (the twiddle factors are only computed once).
Note that the parameters n and forward can be left unspecified, or even changed later while calling the FFT plan.
- Note
- If the input samples are real, then a more efficient plan is possible: rfftplan_new().
Example
let N = 1024; // Bloc length
let plan = fftplan_new();
for (i = 0; i < n; i++)
{
let x = Vecf::random(N);
// X is the FFT of x
let X = plan->step(x);
// (equivalent to X = fft(x), but more efficient)
}