These subroutines compute the two-dimensional discrete Fourier transform of
complex data.
| X, Y | scale | Subroutine |
| Short-precision complex | Short-precision real | SCFT2 |
| Long-precision complex | Long-precision real | DCFT2 |
| Fortran | CALL SCFT2 | DCFT2 (init, x, inc1x, inc2x, y, inc1y, inc2y, n1, n2, isign, scale, aux1, naux1, aux2, naux2) |
| C and C++ | scft2 | dcft2 (init, x, inc1x, inc2x, y, inc1y, inc2y, n1, n2, isign, scale, aux1, naux1, aux2, naux2); |
| PL/I | CALL SCFT2 | DCFT2 (init, x, inc1x, inc2x, y, inc1y, inc2y, n1, n2, isign, scale, aux1, naux1, aux2, naux2); |
If init <> 0, trigonometric functions and other parameters, depending on arguments other than x, are computed and saved in aux1. The contents of x and y are not used or changed.
If init = 0, the discrete Fourier transform of the given array is computed. The only arguments that may change after initialization are x, y, and aux2. All scalar arguments must be the same as when the subroutine was called for initialization with init <> 0.
Specified as: a fullword integer. It can have any value.
Specified as: an array of (at least) length 1+(n1-1)inc1x+(n2-1)inc2x, containing numbers of the data type indicated in Table 136. This array must be aligned on a doubleword boundary, and:
If inc1x = 1, the input array is stored in normal form, and inc2x >= n1.
If inc2x = 1, the input array is stored in transposed form, and inc1x >= n2.
See Notes for more details.
If the array is stored in the normal form, inc1x = 1.
If the array is stored in the transposed form, inc1x is the leading dimension of the array and inc1x >= n2.
Specified as: a fullword integer; inc1x > 0. If inc2x = 1, then inc1x >= n2.
If the array is stored in the transposed form, inc2x = 1.
If the array is stored in the normal form, inc2x is the leading dimension of the array and inc2x >= n1.
Specified as: a fullword integer; inc2x > 0. If inc1x = 1, then inc2x >= n1.
If the array is stored in the normal form, inc1y = 1.
If the array is stored in the transposed form, inc1y is the leading dimension of the array and inc1y >= n2.
Specified as: a fullword integer; inc1y > 0. If inc2y = 1, then inc1y >= n2.
If the array is stored in the transposed form, inc2y = 1.
If the array is stored in the normal form, inc2y is the leading dimension of the array and inc2y >= n1.
Specified as: a fullword integer; inc2y > 0. If inc1y = 1, then inc2y >= n1.
If isign = positive value, Isign = + (transforming time to frequency).
If isign = negative value, Isign = - (transforming frequency to time).
Specified as: a fullword integer; isign > 0 or isign < 0.
If init <> 0, the working storage is computed.
If init = 0, the working storage is used in the computation of the Fourier transforms.
Specified as: an area of storage, containing naux1 long-precision real numbers.
If naux2 = 0 and error 2015 is unrecoverable, aux2 is ignored.
Otherwise, it is the working storage used by this subroutine, which is available for use by the calling program between calls to this subroutine.
Specified as: an area of storage, containing naux2 long-precision real numbers. On output, the contents are overwritten.
If naux2 = 0 and error 2015 is unrecoverable, SCFT2 and DCFT2 dynamically allocate the work area used by the subroutine. The work area is deallocated before control is returned to the calling program.
Otherwise, naux2 >= (minimum value required for successful processing). To determine a sufficient value, use the processor-independent formulas. For all other values specified less than the minimum value, you have the option of having the minimum value returned in this argument. For details, see Using Auxiliary Storage in ESSL.
If init <> 0, this argument is not used, and its contents remain unchanged.
If init = 0, this is array Y, containing the elements resulting from the two-dimensional discrete Fourier transform of the data in X. Each element yk1,k2, using zero-based indexing, is stored in Y(k1(inc1y)+k2(inc2y)) for k1 = 0, 1, ..., n1-1 and k2 = 0, 1, ..., n2-1.
Returned as: an array of (at least) length 1+(n1-1)inc1y+(n2-1)inc2y, containing numbers of the data type indicated in Table 136. This array must be aligned on a doubleword boundary, and:
If inc1y = 1, the output array is stored in normal form, and inc2y >= n1.
If inc2y = 1, the output array is stored in transposed form, and inc1y >= n2.
See Notes for more details.
If init <> 0, it contains information ready to be passed in a subsequent invocation of this subroutine.
If init = 0, its contents are unchanged.
Returned as: the contents are not relevant.
The required values of naux1 and naux2 depend on n1 and n2.
The required values of naux1 and naux2 depend on n1 and n2.
The two-dimensional discrete Fourier transform of complex data in array X, with results going into array Y, is expressed as follows:

for:
where:

and where:
For scale = 1.0 and isign being positive, you obtain the discrete Fourier transform, a function of frequency. The inverse Fourier transform is obtained with scale = 1.0/((n1)(n2)) and isign being negative. See references [1], [4], and [20].
Two invocations of this subroutine are necessary:
Error 2015 is unrecoverable, naux2 = 0, and unable to allocate work area.
None
This example shows how to compute a two-dimensional transform where both input and output are stored in normal form (inc1x = inc1y = 1). Also, inc2x = inc2y so the same array can be used for both input and output. The arrays are declared as follows:
COMPLEX*8 X(6,8),Y(6,8)
REAL*8 AUX1(20000), AUX2(10000)
Arrays X and Y are made equivalent by the following statement, making them occupy the same storage: EQUIVALENCE (X,Y). First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation.
INIT X INC1X INC2X Y INC1Y INC2Y N1 N2 ISIGN SCALE AUX1 NAUX1 AUX2 NAUX2
| | | | | | | | | | | | | | |
CALL SCFT2(INIT, X , 1 , 6 , Y , 1 , 6 , 6 , 8 , 1 , SCALE, AUX1, 20000 , AUX2, 10000)
Y is an array with 6 rows and 8 columns having (48.0, 0.0) in location Y(1,1) and (0.0, 0.0) in all others.
This example shows how to compute a two-dimensional inverse Fourier transform. For this example, X is stored in normal untransposed form (inc1x = 1), and Y is stored in transposed form (inc2y = 1). The arrays are declared as follows:
COMPLEX*16 X(6,8),Y(8,6)
REAL*8 AUX1(20000), AUX2(10000)
First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation.
INIT X INC1X INC2X Y INC1Y INC2Y N1 N2 ISIGN SCALE AUX1 NAUX1 AUX2 NAUX2
| | | | | | | | | | | | | | |
CALL DCFT2(INIT, X , 1 , 6 , Y , 8 , 1 , 6 , 8 , -1 , SCALE, AUX1 , 20000 , AUX2 , 10000)
Y is an array with 8 rows and 6 columns with (1.0, 0.0) in all locations.