Calculates discrete fourier transform. re should contain the real part of the data and im the imaginary part of the data. The method operates in place - the result is saved back to re and im. Both arrays must be properly aligned - to obtain a properly aligned array you can use allocate.
Calculates inverse discrete fourier transform scaled by n. The arguments have the same role as they do in fft.
Deallocates an array allocated with allocate.
Scales an array data by factor k. The array must be properly aligned. To obtain a properly aligned array, use allocate.
import std.stdio, std.conv, std.exception; import pfft.pfft; void main(string[] args) { auto n = to!int(args[1]); enforce((n & (n-1)) == 0, "N must be a power of two."); alias Fft!float F; F f; f.initialize(n); auto re = F.allocate(n); auto im = F.allocate(n); foreach(i, _; re) readf("%s %s\n", &re[i], &im[i]); f.fft(re, im); foreach(i, _; re) writefln("%s\t%s", re[i], im[i]); }
A class for calculating discrete fourier transform. The methods of this class use split format for complex data. This means that a complex data set is represented as two arrays - one for the real part and one for the imaginary part. An instance of this class can only be used for transforms of one particular size. The template parameter is the floating point type that the methods of the class will operate on.