In-Place Functions for 1D Real FFT
Perform fast Fourier transforms in place on 1D real data.
Overview
The functions in this group use the following operation for a forward real-to-complex transform:
N = 1 << Log2N;
scale = 2;
// Define a real vector, h:
for (j = 0; j < N/2; ++j)
{
h[2*j + 0] = C->realp[j*IC];
h[2*j + 1] = C->imagp[j*IC];
}
// Perform Discrete Fourier Transform.
for (k = 0; k < N; ++k)
H[k] = scale *
sum(h[j] * e**(-Direction*2*pi*i*j*k/N), 0 <= j < N);
// Pack DC and Nyquist components into C->realp[0] and C->imagp[0].
C->realp[0*IC] = Re(H[ 0 ]).
C->imagp[0*IC] = Re(H[N/2]).
// Store regular components:
for (k = 1; k < N/2; ++k)
{
C->realp[k*IC] = Re(H[k]);
C->imagp[k*IC] = Im(H[k]);
}The functions in this group use the following operation for an inverse complex-to-real transform:
N = 1 << Log2N;
scale = 1./N;
// Define a complex vector, h:
h[ 0 ] = C->realp[0*IC];
h[N/2] = C->imagp[0*IC];
for (j = 1; j < N/2; ++j)
{
h[ j ] = C->realp[j*IC] + i * C->imagp[j*IC];
h[N-j] = conj(h[j]);
}
// Perform Discrete Fourier Transform.
for (k = 0; k < N; ++k)
H[k] = scale *
sum(h[j] * e**(-Direction*2*pi*i*j*k/N), 0 <= j < N);
// Coerce real results into complex structure:
for (k = 0; k < N/2; ++k)
{
C->realp[k*IC] = H[2*k+0];
C->imagp[k*IC] = H[2*k+1];
}
The temporary buffer versions perform the same operation but use a temporary buffer for improved performance.