nag_fft_complex (c06ecc) calculates the discrete Fourier transform of a sequence of complex data values.
Given a sequence of
complex data values
, for
, nag_fft_complex (c06ecc) calculates their discrete Fourier transform defined by
(Note the scale factor of
in this definition.)
To compute the inverse discrete Fourier transform defined by
this function should be preceded and followed by calls of
nag_conjugate_complex (c06gcc) to form the complex conjugates of the
and the
.
nag_fft_complex (c06ecc) uses the fast Fourier transform (FFT) algorithm (see
Brigham (1974)). There are some restrictions on the value of
(see
Section 5).
- 1:
n – IntegerInput
On entry: , the number of data values.
Constraints:
- ;
- The largest prime factor of n must not exceed 19, and the total number of prime factors of n, counting repetitions, must not exceed 20.
- 2:
x[n] – doubleInput/Output
-
On entry: must contain , the real part of , for .
On exit: the real parts of the components of the discrete Fourier transform. is contained in , for .
- 3:
y[n] – doubleInput/Output
-
On entry: must contain , the imaginary part of , for .
On exit: the imaginary parts of the components of the discrete Fourier transform. is contained in , for .
- 4:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
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).
Not applicable.
This example reads in a sequence of complex data values and prints their discrete Fourier transform. It then performs an inverse transform using nag_fft_complex (c06ecc) and
nag_conjugate_complex (c06gcc), and prints the sequence so obtained alongside the original data values.