The elements of the result at position greater than n / 2 can be trivially calculated from the relation DFT(f)i = DFT(f)[n - i]* that holds because the input sequence is real.
The length of the array must be equal to n and the array must be properly aligned. To obtain a properly aligned array you can use allocate.
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:
r(0), r(1), ... r(n / 2), i(1), i(2), ... i(n / 2 - 1)