Given a Hermitian sequence of
$n$ complex data values
${z}_{\mathit{j}}$ (i.e., a sequence such that
${z}_{0}$ is real and
${z}_{n-\mathit{j}}$ is the complex conjugate of
${z}_{\mathit{j}}$, for
$\mathit{j}=1,2,\dots ,n-1$), C06FBF calculates their discrete Fourier transform defined by
(Note the scale factor of
$\frac{1}{\sqrt{n}}$ in this definition.) The transformed values
${\hat{x}}_{k}$ are purely real (see also the
C06 Chapter Introduction).
To compute the inverse discrete Fourier transform defined by
this routine should be preceded by forming the complex conjugates of the
${\hat{z}}_{k}$; that is,
$x\left(\mathit{k}\right)=-x\left(\mathit{k}\right)$, for
$\mathit{k}=n/2+2,\dots ,n$.
C06FBF uses the fast Fourier transform (FFT) algorithm (see
Brigham (1974)). There are some restrictions on the value of
$n$ (see
Section 5).
If on entry
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${-{\mathbf{1}}}$, 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).
This example reads in a sequence of real data values which is assumed to be a Hermitian sequence of complex data values stored in Hermitian form. The input sequence is expanded into a full complex sequence and printed alongside the original sequence. The discrete Fourier transform (as computed by C06FBF) is printed out. It then performs an inverse transform using
C06FAF and conjugation, and prints the sequence so obtained alongside the original data values.