NAG Library Function Document
nag_fft_complex (c06ecc) calculates the discrete Fourier transform of a sequence of complex data values.
||nag_fft_complex (Integer n,
Given a sequence of
complex data values
, 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
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
Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
n – IntegerInput
On entry: , the number of data values.
- 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.
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 .
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 .
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
At least one of the prime factors of n
is greater than 19.
has more than 20 prime factors.
On entry, .
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).
8 Parallelism and Performance
The time taken is approximately proportional to , but also depends on the factorization of . nag_fft_complex (c06ecc) is somewhat faster than average if the only prime factors of are 2, 3 or 5; and fastest of all if is a power of 2.
On the other hand, nag_fft_complex (c06ecc) is particularly slow if has several unpaired prime factors, i.e., if the ‘square-free’ part of has several factors.
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.
10.1 Program Text
Program Text (c06ecce.c)
10.2 Program Data
Program Data (c06ecce.d)
10.3 Program Results
Program Results (c06ecce.r)