Given a sequence of
real data values
, for
, C06EAF calculates their discrete Fourier transform defined by
(Note the scale factor of
in this definition.) The transformed values
are complex, but they form a Hermitian sequence (i.e.,
is the complex conjugate of
), so they are completely determined by
real numbers (see also the
C06 Chapter Introduction).
To compute the inverse discrete Fourier transform defined by
this routine should be followed by a call of
C06GBF to form the complex conjugates of the
.
C06EAF uses the fast Fourier transform (FFT) algorithm (see
Brigham (1974)). There are some restrictions on the value of
(see
Section 5).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Some indication of accuracy can be obtained by performing a subsequent inverse transform and comparing the results with the original sequence (in exact arithmetic they would be identical).
On the other hand, C06EAF is particularly slow if
has several unpaired prime factors, i.e., if the ‘square-free’ part of
has several factors.
For such values of
,
C06FAF (which requires additional real workspace) is considerably faster.
This example reads in a sequence of real data values and prints their discrete Fourier transform (as computed by C06EAF), after expanding it from Hermitian form into a full complex sequence. It then performs an inverse transform using
C06GBF followed by
C06EBF, and prints the sequence so obtained alongside the original data values.