Previous Next Contents Generated Index Doc Set Home



Fourier Transform

The subroutines described in this section compute the Fourier coefficients of a perodic sequence. The transform is defined as:

If N is even then let l =n/2, otherwise let l = (n+1)/2. Then,

and for k = 2,...,l

If N is even


Note - The xFFT operations are unnormalized, so a call of xFFTF followed by a call of xFFTB will multiply the input sequence by N. The VxFFT operations are normalized, so a call of VxFFTF followed by a call of VxFFTB will return the original sequence.

Calling Sequence

CALL RFFTF 
(N, RX, RWSAVE)
CALL DFFTF 
(N, DX, DWSAVE)
CALL CFFTF 
(N, CR, CWSAVE)
CALL ZFFTF 
(N, ZR, ZWSAVE)
CALL VRFFTF 
(M, N, RX, RXT, MDIMX, RWSAVE)
CALL VDFFTF 
(M, N, DX, DXT, MDIMX, DWSAVE)






void rfftf 
(int n, float *rx, float *rwsave)
void dfftf 
(int n, double *dx, double *dwsave)
void cfftf 
(int n, complex *cr, complex *wsave)
void zfftf 
(int n, doublecomplex *zr, doublecomplex *wsave)
void vrfftf 
(int m, int n, float *rx, int mdimx, float *rwsave)
void vdfftf 
(int m, int n, double *dx, int mdimx, double *dwsave)

Arguments

M

(For vector operations only.)
The number of sequences to be transformed. M 0.

N

Length of the sequence to be transformed. These subroutines are most efficient when N is a product of small primes. N 0.

xX

On entry, an array of length N containing the sequence to be transformed. For VxFFTF, a real two-dimensional array xX(M,N) whose rows contain the sequences to be transformed.

xXT

(For vector operations only.)
A real two-dimensional work array with dimensions of (MDIMX × N).

MDIMX

(For vector operations only.)
Leading dimension of the arrays xX and xXT as specified in a dimension or type statement. MDIMX M.

xWSAVE

On entry, an array with dimension for scalar subroutines of at least
(2 × N + 15) for real inputs or (4 × N + 15) for complex inputs. For vector subroutines, the dimension is at least (N+15). The array must have been initialized by xFFTI or VxFFTI.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           N
      PARAMETER        (N = 4) 
C
      INTEGER           I
      REAL              PI, WSAVE(4 * N + 15), X, Y 
      COMPLEX           C(N)
C
      EXTERNAL          CFFTB, CFFTF, CFFTI
      INTRINSIC         ACOS, CMPLX, COS, SIN
C
C     Initialize the array C to a complex sequence.
C
      PI = ACOS (-1.0)
      DO 100, I=1, N
        X = SIN ((I - 1.0) * 2.0 * PI / N)
        Y = COS ((I - 1.0) * 2.0 * PI / N)
        C(I) = CMPLX (X, Y)
  100 CONTINUE 
C
      PRINT 1000 
      PRINT 1010, (C(I), I = 1, N)
      CALL CFFTI (N, WSAVE)
      CALL CFFTF (N, C, WSAVE)
      PRINT 1020 
      PRINT 1010, (C(I), I = 1, N)
      CALL CFFTB (N, C, WSAVE)
      PRINT 1030 
      PRINT 1010, (C(I), I = 1, N)
C
 1000 FORMAT (1X, 'Original Sequence:') 
 1010 FORMAT (1X, 100(F5.1' +',F4.1,'i  ')) 
 1020 FORMAT (1X, 'Transformed Sequence:')
 1030 FORMAT (1X, 'Recovered Sequence:')
C
      END
 

Sample Output

 
 Original Sequence:
   0.0 + 1.0i    1.0 + 0.0i    0.0 +-1.0i   -1.0 + 0.0i  
 Transformed Sequence:
   0.0 + 0.0i    0.0 + 0.0i    0.0 + 0.0i    0.0 + 4.0i  
 Recovered Sequence:
   0.0 + 4.0i    4.0 + 0.0i    0.0 +-4.0i   -4.0 + 0.0i  






Previous Next Contents Generated Index Doc Set Home