Previous Next Contents Generated Index Doc Set Home



Three-Dimensional Fourier Transform

The subroutines described in this section compute the Fourier coefficients of a real periodic sequence. The xFFT3 operations are unnormalized, so a call of xFFT3F followed by a call of xFFT3B will multiply the input sequence by M*N*K.

Calling Sequence

CALL RFFT3F
(PLACE, FULL, M, N, K, RX, LDX, LD2X, RY, LDY, LD2Y, 
RWSAVE, LWSAVE)
CALL DFFT3F
(PLACE, FULL, M, N, K, DX, LDX, LD2X, DY, LDY, LD2Y, 
DWSAVE, LWSAVE)
CALL CFFT3F
(M, N, K, CX, LDX, LD2X, CWSAVE, LWSAVE)
CALL ZFFT3F
(M, N, K, ZX, LDX, LD2X, ZWSAVE, LWSAVE)






void rfft3f
(char place, char full, int m, int n, int k, float *rx, 
int ldx, float *ry, int ldy, float *rwsave, int lwsave)
void dfft3f
(char place, char full, int m, int n, int k, double 
*dx, int ldx, double *dy, int ldy, double *dwsave, int 
lwsave)
void cfft3f
(int m, int n, int k, complex *cx, int ldx, int ld2x, 
complex *cwsave, int lwsave)
void zfft3f
(int m, int n, int k, doublecomplex *zx, int ldx, int 
ld2x, doublecomplex *zwsave, int lwsave)

Arguments

PLACE

ndicates whether the transform should be performed in place or out-of-place. The legal values for PLACE are listed below. Any values not listed below are illegal.

`I' or `i' In-place. Input is supplied in xX and the transformed input is returned in xX. xY is not referenced.

`O' or `o' Out-of-place. Input is supplied in xX and the transformed input is returned in xY.

FULL

Select a full (`F' or `f') or partial (`N` or `n') representation of the results. If the caller selects full representation then an MxNxK real array will transform to produce an MxNxK complex array. If the caller does not select full representation then an MxNxK real array will transform to a (M/2+1)xNxK complex array that takes advantage of the symmetry properties of a transformed real sequence.

M

Number of rows to be transformed. These subroutines are most efficient when M is a product of small primes. M 0.

N

Number of columns to be transformed. These subroutines are most efficient when N is a product of small primes. N 0.

K

Number of planes to be transformed. These subroutines are most efficient when K is a product of small primes. K 0.

xX

On entry, a three-dimensional array xX(LDX,N,K) that contains the sequences to be transformed. On exit, the transformed sequences if the caller selected an in-place transform.

LDX

Leading dimension of the array containing the data to be transformed. LDX M.

xY

On exit, xY(LDY,N,K) contains the transformed sequences if the caller selected an out of place transform. If the caller selected an in-place transform then this argument is never referenced.

LDY

Leading dimension of the array for an out-of-place transform. LDY M.

xWSAVE

On entry, an array with dimension of at least (M + N + MAX(M,N,K) + 45). The array must have been initialized by xFFT3I.

LWSAVE

Length of the WSAVE array.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LWSAVE, M, N, K
      PARAMETER        (K = 2)
      PARAMETER        (M = 2)
      PARAMETER        (N = 4)
      PARAMETER        (LWORK = 4 * (M + N + N) + 45)
C
      INTEGER           I, J, L
      REAL              PI, WSAVE(LWORK)
      REAL              X, Y
      COMPLEX           C(M,N,K)
C
      EXTERNAL          CFFT3B, CFFT3F, CFFT3I
      INTRINSIC         ACOS, CMPLX, COS, SIN
C
C     Initialize the array C to a complex sequence.
C
      PI = ACOS (-1.0)
      DO 120, L = 1, K
        DO 110, J = 1, N
          DO 100, I = 1, M
            X = SIN ((I - 1.0) * 2.0 * PI / N)
            Y = COS ((J - 1.0) * 2.0 * PI / M)
            C(I,J,L) = CMPLX (X, Y)
  100     CONTINUE
  110   CONTINUE
  120 CONTINUE
C
      PRINT 1000
      DO 210, L = 1, K
        PRINT 1010, L
        DO 200, I = 1, M
          PRINT 1020, (C(I,J,L), J = 1, N)
  200   CONTINUE
  210 CONTINUE
      CALL CFFT3I (M, N, K, WSAVE)
      CALL CFFT3F (M, N, K, C, M, N, WSAVE, LWORK)
      PRINT 1030
      DO 310, L = 1, K
        PRINT 1010, L
        DO 300, I = 1, M
          PRINT 1020, (C(I,J,L), J = 1, N)
  300   CONTINUE
  310 CONTINUE
      CALL CFFT3B (M, N, K, C, M, N, WSAVE, LWORK)
      PRINT 1040
      DO 410, L = 1, K
        PRINT 1010, L
        DO 400, I = 1, M
          PRINT 1020, (C(I,J,L), J = 1, N)
  400   CONTINUE
  410 CONTINUE
C
 1000 FORMAT (1X, 'Original Sequences:')
 1010 FORMAT (1X, '  Plane', I2)
 1020 FORMAT (5X, 100(F5.1' +',F5.1,'i  '))
 1030 FORMAT (/1X, 'Transformed Sequences:')
 1040 FORMAT (/1X, 'Recovered Sequences:')
C
      END



Sample Output

 
 Original Sequences:
   Plane 1
       0.0 +  1.0i    0.0 + -1.0i    0.0 +  1.0i    0.0 + -1.0i  
       1.0 +  1.0i    1.0 + -1.0i    1.0 +  1.0i    1.0 + -1.0i  
   Plane 2
       0.0 +  1.0i    0.0 + -1.0i    0.0 +  1.0i    0.0 + -1.0i  
       1.0 +  1.0i    1.0 + -1.0i    1.0 +  1.0i    1.0 + -1.0i  



 Transformed Sequences:
   Plane 1
       8.0 +  0.0i    0.0 +  0.0i    0.0 + 16.0i    0.0 +  0.0i  
      -8.0 +  0.0i    0.0 +  0.0i    0.0 +  0.0i    0.0 +  0.0i  
   Plane 2
       0.0 +  0.0i    0.0 +  0.0i    0.0 +  0.0i    0.0 +  0.0i  
       0.0 +  0.0i    0.0 +  0.0i    0.0 +  0.0i    0.0 +  0.0i  



 Recovered Sequences:
   Plane 1
       0.0 + 16.0i    0.0 +-16.0i    0.0 + 16.0i    0.0 +-16.0i  
      16.0 + 16.0i   16.0 +-16.0i   16.0 + 16.0i   16.0 +-16.0i  
   Plane 2
       0.0 + 16.0i    0.0 +-16.0i    0.0 + 16.0i    0.0 +-16.0i  
      16.0 + 16.0i   16.0 +-16.0i   16.0 + 16.0i   16.0 +-16.0i  






Previous Next Contents Generated Index Doc Set Home