An alias for Fft!T.alignment
An alias for Fft!T.allocate
An alias for Fft!T.deallocate
An alias for Fft!T.scale
The Rfft constructor. The parameter is the size of data sets that rfft will operate on. I will refer to this number as n in the rest of the documentation for this class. All tables used in rfft are calculated in the constructor.
Calculates the inverse of rfft, scaled by n (You can use scale to normalize the result). Before the method is called, data should contain a complex sequence in the same format as the result of rfft. It is assumed that the input sequence is a discrete fourier transform of a real valued sequence, so the elements of the input sequence not stored in data can be calculated from DFT(f)i = DFT(f)[n - i]*. When the method completes, the array contains the real part of the inverse discrete fourier transform. The imaginary part is known to be equal to 0.
Calculates discrete fourier transform of the real valued sequence in data. The method operates in place. When the method completes, data contains the result. First n / 2 + 1 elements contain the real part of the result and the rest contains the imaginary part. Imaginary parts at position 0 and n / 2 are known to be equal to 0 and are not stored, so the content of data looks like this:
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 Rfft!float F; F f; f.initialize(n); auto data = F.allocate(n); foreach(ref e; data) readf("%s\n", &e); f.rfft(data); foreach(i; 0 .. n / 2 + 1) writefln("%s\t%s", data[i], (i == 0 || i == n / 2) ? 0 : data[i]); }
A class for calculating real discrete fourier transform. The methods of this class use split format for complex data. This means that 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.