NAG Library Function Document
nag_fft_2d_complex (c06fuc)
1 Purpose
nag_fft_2d_complex (c06fuc) computes the two-dimensional discrete Fourier transform of a bivariate sequence of complex data values.
2 Specification
#include <nag.h> |
#include <nagc06.h> |
void |
nag_fft_2d_complex (Integer m,
Integer n,
double x[],
double y[],
const double trigm[],
const double trign[],
NagError *fail) |
|
3 Description
nag_fft_2d_complex (c06fuc) computes the two-dimensional discrete Fourier transform of a bivariate sequence of complex data values , where , .
The discrete Fourier transform is here defined by
for
;
.
(Note the scale factor of in this definition.)
The first call of nag_fft_2d_complex (c06fuc) must be preceded by calls to
nag_fft_init_trig (c06gzc) to initialize the
trigm and
trign arrays with trigonometric coefficients according to the value of
m and
n respectively.
To compute the inverse discrete Fourier transform, defined with
in the above formula instead of
, this function should be preceded and followed by calls of
nag_conjugate_complex (c06gcc) to form the complex conjugates of the data values and the transform.
This function calls
nag_fft_multiple_complex (c06frc) to perform multiple one-dimensional discrete Fourier transforms by the fast Fourier transform algorithm in
Brigham (1974).
4 References
Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
Temperton C (1983) Self-sorting mixed-radix fast Fourier transforms J. Comput. Phys. 52 1–23
5 Arguments
- 1:
– IntegerInput
-
On entry: the number of rows, , of the bivariate data sequence.
Constraint:
.
- 2:
– IntegerInput
-
On entry: the number of columns, , of the bivariate data sequence.
Constraint:
.
- 3:
– doubleInput/Output
- 4:
– doubleInput/Output
-
On entry: the real and imaginary parts of the complex data values must be stored in arrays
x and
y respectively. Each row of the data must be stored consecutively; hence if the real parts of
are denoted by
, for
,
, then the
elements of
x must contain the values
The imaginary parts must be ordered similarly in
y.
On exit: the real and imaginary parts respectively of the corresponding elements of the computed transform.
- 5:
– const doubleInput
- 6:
– const doubleInput
-
On entry:
trigm and
trign must contain trigonometric coefficients as returned by calls of
nag_fft_init_trig (c06gzc). nag_fft_2d_complex (c06fuc) performs a simple check to ensure that both arrays have been initialized and that they are compatible with
m and
n. If
the same array may be supplied for
trigm and
trign.
- 7:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
- NE_C06_NOT_TRIG
-
Value of
m and
trigm array are incompatible or
trigm array not initialized.
Value of
n and
trign array are incompatible or
trign array not initialized.
- NE_INT_ARG_LT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
7 Accuracy
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
Not applicable.
The time taken is approximately proportional to , but also depends on the factorization of the individual dimensions and . The function is somewhat faster than average if their only prime factors are 2, 3 or 5; and fastest of all if they are powers of 2; it is particularly slow if or is a large prime, or has large prime factors.
10 Example
This program reads in a bivariate sequence of complex data values and prints the two-dimensional Fourier transform. It then performs an inverse transform and prints the sequence so obtained, which may be compared to the original data values.
10.1 Program Text
Program Text (c06fuce.c)
10.2 Program Data
Program Data (c06fuce.d)
10.3 Program Results
Program Results (c06fuce.r)