nag_fft_complex (c06ecc) calculates the discrete Fourier transform of a sequence of complex data values.
2 Specification
#include <nag.h>
#include <nagc06.h>
void
nag_fft_complex (Integer n,
double x[],
double y[],
NagError *fail)
3 Description
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).
4 References
Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
5 Arguments
1:
n – IntegerInput
On entry: , the number of data values.
Constraint:
. 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.
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 Further Comments
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.
9 Example
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.