Computes Fourier coefficients of a complex periodic two-dimensional array.
A — NRA by NCA complex matrix containing the periodic data to be transformed. (Input)
COEF — NRA by NCA complex matrix containing the Fourier coefficients of A. (Output)
NRA — The number
of rows of A.
(Input)
Default: NRA = size (A,1).
NCA — The number
of columns of A.
(Input)
Default: NCA = size (A,2).
LDA — Leading
dimension of A exactly as specified
in the dimension statement of the calling program.
(Input)
Default: LDA = size (A,1).
LDCOEF — Leading
dimension of COEF exactly as
specified in the dimension statement of the calling program.
(Input)
Default: LDCOEF = size (COEF,1).
Generic: CALL FFT2D (A, COEF [,…])
Specific: The specific interface names are S_FFT2D and D_FFT2D.
Single: CALL FFT2D (NRA, NCA, A, LDA, COEF, LDCOEF)
Double: The double precision name is DFFT2D.
The routine FFT2D computes the discrete complex Fourier transform of a complex two dimensional array of size (NRA = N) ´ (NCA = M). The method used is a variant of the Cooley-Tukey algorithm , which is most efficient when N and M are each products of small prime factors. If N and M satisfy this condition, then the computational effort is proportional to N M log N M. This considerable savings has historically led people to refer to this algorithm as the “fast Fourier transform” or FFT.
Specifically, given an N ´ M array a, FFT2D returns in c = COEF
Furthermore, a vector of Euclidean norm S is mapped into a vector of norm
Finally, note that an unnormalized inverse is implemented in FFT2B. The routine FFT2D is based on the complex FFT in FFTPACK. The package FFTPACK was developed by Paul Swarztrauber at the National Center for Atmospheric Research.
1. Workspace may be explicitly provided, if desired, by use of F2T2D/DF2T2D. The reference is:
CALL F2T2D (NRA, NCA, A, LDA, COEF, LDCOEF, WFF1, WFF2, CWK, CPY)
The additional arguments are as follows:
WFF1 — Real array of length 4 * NRA + 15 initialized by FFTCI. The initialization depends on NRA. (Input)
WFF2 — Real array of length 4 * NCA + 15 initialized by FFTCI. The initialization depends on NCA. (Input)
CWK — Complex array of length 1. (Workspace)
CPY — Real array of length 2 * MAX(NRA, NCA). (Workspace)
2. The routine FFT2D is most efficient when NRA and NCA are the product of small primes.
3. The arrays COEF and A may be the same.
4. If FFT2D/FFT2B is used repeatedly, with the same values for NRA and NCA, then use FFTCI to fill WFF1(N = NRA) and WFF2(N = NCA). Follow this with repeated calls to F2T2D/F2T2B. This is more efficient than repeated calls to FFT2D/FFT2B.
In this example, we compute the Fourier transform of the pure frequency input for a 5 ´ 4 array
for 1 ≤ n ≤ 5 and 1 ≤ m ≤ 4 using the IMSL routine FFT2D. The result
has all zeros except in the (3, 4) position.
INTEGER I, IR, IS, J, NCA, NRA
COMPLEX A(5,4), C, CEXP, CMPLX, COEF(5,4), H
CHARACTER TITLE1*26, TITLE2*26
TITLE1 = 'The input matrix is below '
TITLE2 = 'The output matrix is below'
A(I,J) = CEXP(TWOPI*C*((FLOAT((I-1)*(IR-1))/FLOAT(NRA)+ &
FLOAT((J-1)*(IS-1))/FLOAT(NCA))))
The
input matrix is
below
1
2
3
4
1 ( 1.000, 0.000) ( 0.000,-1.000) (-1.000, 0.000) (
0.000, 1.000)
2 (-0.809, 0.588) ( 0.588, 0.809) (
0.809,-0.588) (-0.588,-0.809)
3 ( 0.309,-0.951)
(-0.951,-0.309) (-0.309, 0.951) ( 0.951, 0.309)
4 ( 0.309,
0.951) ( 0.951,-0.309) (-0.309,-0.951) (-0.951,
0.309)
5 (-0.809,-0.588) (-0.588, 0.809) ( 0.809,
0.588) (
0.588,-0.809)
The Output matrix is
below
1
2
3
4
1 ( 0.00, 0.00) ( 0.00, 0.00)
( 0.00, 0.00) ( 0.00, 0.00)
2 (
0.00, 0.00) ( 0.00, 0.00) ( 0.00,
0.00) ( 0.00, 0.00)
3 ( 0.00, 0.00)
( 0.00, 0.00) ( 0.00, 0.00) ( 20.00,
0.00)
4 ( 0.00, 0.00) ( 0.00, 0.00)
( 0.00, 0.00) ( 0.00, 0.00)
5 (
0.00, 0.00) ( 0.00, 0.00) ( 0.00,
0.00) ( 0.00, 0.00)
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |