cosq1f

Return to Main Contents

NAME

COSQ1F - real, forward quarter-cosine fast Fourier transform

SYNOPSIS

 SUBROUTINE COSQ1F (N, INC, R, LENR, WSAVE, LENSAV, WORK, LENWRK, IER)

 INTEGER    N, INC, LENR, LENSAV, LENWRK, IER
 REAL       R(LENR), WSAVE(LENSAV), WORK(LENWRK)

DESCRIPTION

 FFTPACK 5.0 routine COSQ1F computes the one-dimensional Fourier 
 transform of a sequence which is a cosine series with odd wave 
 numbers.  This transform is referred to as the forward transform 
 or Fourier analysis, transforming the sequence from physical to 
 spectral space.
 
 This transform is normalized since a call to COSQ1F followed
 by a call to COSQ1B (or vice-versa) reproduces the original
 array  within roundoff error.
 
 Input Arguments
 
 N       Integer length of the sequence to be transformed.  The 
         transform is most efficient when N is a product of 
         small primes.
 
 INC     Integer increment between the locations, in array R,
         of two consecutive elements within the sequence.
 
 R       Real array of length LENR containing the sequence to be 
         transformed.
 
 LENR    Integer dimension of R array.  LENR must be at least
         INC*(N-1)+ 1.


 WSAVE   Real work array with dimension LENSAV.  WSAVE's contents 
         must be initialized with a call to subroutine COSQ1I before 
         the first call to routine COSQ1F or COSQ1B for a given 
         transform length N.  WSAVE's contents may be re-used for 
         subsequent calls to COSQ1F and COSQ1B with the same N.


 LENSAV  Integer dimension of WSAVE array.  LENSAV must be at least 
         2*N + INT(LOG (REAL(N))) +4.


 WORK    Real array of dimension LENWRK.
 
 LENWRK  Integer dimension of WORK array.  LENWRK must be at 
         least N.


 Output Arguments
 
  R      Real output array R.  For purposes of exposition, 
         assume R's range of indices is given by 
         R(0:(N-1)*INC).
 
         The output values of R are written over the input values.
         For J=0,...,N-1
 
          R(J*INC) = 

              R(0)/N 
 
              N-1
            + SUM  2.*R(N1*INC)*COS((2*J+1)*N1*PI/(2*N))/N
              N1=1
 
 
 WSAVE   Contains values initialized by subroutine COSQ1I that
         must not be destroyed between calls to routine COSQ1F
         or COSQ1B.


 IER     Integer error return
         =  0 successful exit
         =  1 input parameter LENR   not big enough
         =  2 input parameter LENSAV not big enough
         =  3 input parameter LENWRK not big enough
         = 20 input error returned by lower level routine