Previous Next Contents Generated Index Doc Set Home



Initialize Cosine Quarter-Wave Transform and Synthesis

The subroutines described in this section initialize the array xWSAVE, which is used in both xCOSQF and xCOSQB.

Calling Sequence

CALL COSQI 
(N, RWSAVE)
CALL DCOSQI 
(N, DWSAVE)
CALL VCOSQI 
(N, RWSAVE)
CALL VDCOSQI 
(N, DWSAVE)
 



void cosqi 
(int n, float *rwsave)
void dcosqi 
(int n, double *dwsave)
void vcosqi 
(int n, float *rwsave)
void vdcosqi 
(int n, double *dwsave)

Arguments

N

Length of the sequence to be transformed. The method is most efficient when N is a product of small primes.

xWSAVE

On entry, an array with a dimension of at least (3 × N + 15) for scalar subroutines or (2 × N + 15) for vector subroutines. The same work array can be used for both xCOSQF and xCOSQB as long as N remains unchanged. Different xWSAVE arrays are required for different values of N. This initialization does not have to be repeated between calls to xCOSQF or xCOSQB as long as N and xWSAVE remain unchanged, thus subsequent transforms can be obtained faster than the first.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER       N
      PARAMETER    (N = 6) 
C
      INTEGER       I
      REAL          PI, WSAVE(3 * N + 15), X(N)
C   
      EXTERNAL      COSQB, COSQF, COSQI
      INTRINSIC     ACOS, COS
C
C     Initialize array X to a real even quarter-wave sequence,
C     that is, it can be expanded in terms of a cosine series
C     with only odd wave numbers.
C
      PI = ACOS (-1.0)
      DO 100, I=1, N
        X(I) = COS((I - 1) * PI / (2.0 * N))
  100 CONTINUE
C
      CALL COSQI (N, WSAVE) 
      PRINT 1000 
      PRINT 1010, (X(I), I = 1, N)
      CALL COSQF (N, X, WSAVE)
      PRINT 1020 
      PRINT 1010, (X(I), I = 1, N)
      CALL COSQB (N, X, WSAVE)
      PRINT 1030 
      PRINT 1010, (X(I), I = 1, N)
C
 1000 FORMAT(1X, 'Original Sequence: ')
 1010 FORMAT(1X, 100(F7.3, 1X))
 1020 FORMAT(1X, 'Transformed Sequence: ')
 1030 FORMAT(1X, 'Recovered Sequence: ')
      END
 

Sample Output

 
 Original Sequence: 
   1.000   0.966   0.866   0.707   0.500   0.259
 Transformed Sequence: 
   6.000   0.000   0.000   0.000   0.000   0.000
 Recovered Sequence: 
  24.000  23.182  20.785  16.971  12.000   6.212






Previous Next Contents Generated Index Doc Set Home