rfft2f

Return to Main Contents

NAME

RFFT2F - real to complex, two-dimensional forward fast Fourier transform

SYNOPSIS

 SUBROUTINE RFFT2F (LDIM, L, M, R, WSAVE, LENSAV, WORK, LENWRK, IER)
 INTEGER    LDIM, L, M,  LENSAV, LENWRK, IER
 REAL       R(LDIM,M), WSAVE(LENSAV), WORK(LENWRK)
 

DESCRIPTION

 FFTPACK 5.0 routine RFFT2F computes the two-dimensional discrete
 Fourier transform of a real periodic array.  This transform is
 known as the forward transform or Fourier analysis, transforming
 from physical to spectral space.
 
 Routine RFFT2F is normalized: a call to RFFT2F followed by a
 call to RFFT2B (or vice-versa) reproduces the original array
 within roundoff error.
 
 Input Arguments
 
 LDIM    Integer first dimension of the two-dimensional real
         array R, which must be at least 2*(L/2+1).
 
 L       Integer number of elements to be transformed in the first 
         dimension of the two-dimensional real array R.  The value 
         of L must be less than or equal to that of LDIM.  The 
         transform is most efficient when L is a product of small 
         primes.
 
 M       Integer number of elements to be transformed in the second 
         dimension of the two-dimensional real array R.  The 
         transform is most efficient when M is a product of small 
         primes.
 
 R       Real array of two dimensions containing the L-by-M subarray
         to be transformed.  R's first dimension is LDIM and its 
         second dimension must be at least as large as M.
 


 WSAVE   Real work array of length LENSAV.  WSAVE's contents must 
         be initialized with a call to subroutine RFFT2I before the 
         first call to routine RFFT2F or RFFT2B with lengths L 
         and M.  WSAVE's contents may be re-used for subsequent calls 
         to RFFT2F and RFFT2B with the same transform lengths.


 LENSAV  Integer number of elements in the WSAVE array.  LENSAV must
         be at least L + M + INT(LOG(REAL(L))) + INT(LOG(REAL(M))) +8.


 WORK    Real array of dimension LENWRK which is defined below.
         WORK provides workspace, and its contents need not be saved 
         between calls to routines RFFT2F and RFFT2B.
 
 LENWRK  Integer number of elements in the WORK array.  LENWRK must
         be at least LDIM*M.

 Output Arguments
 
 R       Real output array of two dimensions.  Only half of the 
         Fourier spectrum of R is computed and stored as a 
         L/2+1-by- M complex array.  The L wavenumbers stored are
         0 through L/2+1.  The leading dimension of R LDIM must
         be at least 2*(L/2+1).

         For purposes of exposition, assume the index ranges of 
         a complex array C are defined by C(0:L/2,0:M-1).

         For I=0,...,L/2 and J=0,...,M-1, the C(I,J)'s are given
         in the traditional aliased form by

                            L-1  M-1
         C(I,J) =   1/(L*M)*SUM  SUM  C(L1,M1)*
                            L1=0 M1=0

                    EXP(-SQRT(-1)*2*PI*(I*L1/L + J*M1/M))

         The complex C(I,J), I=0,...,L/2 and J=0,...,M-1 are stored 
         in the real array R as:

             Re(C(I,J)) = R(2*I+1,J+1)
             Im(C(I,J)) = R(2*I+2,J+1).

 IER     Integer error return
         =  0 successful exit
         =  2 input parameter LENSAV not big enough
         =  3 input parameter LENWRK not big enough
         =  6 input parameter LDIM < 2*(L+1)
         = 20 input error returned by lower level routine