Previous Next Contents Generated Index Doc Set Home



Cosine Quarter-Wave Synthesis

The subroutines described in this section synthesize a Fourier sequence from its representation in terms of a cosine series with odd wave numbers. The transform is defined as:

For i=1,...,n


Note - The xCOSQ operations are unnormalized inverses of themselves, so a call to xCOSQF followed by a call to xCOSQB will multiply the input sequence by 4 × N. The VxCOSQ operations are normalized, so a call of VxCOSQF followed by a call of VxCOSQB will return the original sequence.

Calling Sequence

CALL COSQB 
(N, RX, RWSAVE)
CALL DCOSQB 
(N, DX, DWSAVE)
CALL VCOSQB 
(M, N, RX, RXT, MDIMX, RWSAVE)
CALL VDCOSQB 
(M, N, DX, DXT, MDIMX, DWSAVE)






void cosqb 
(int n, float *rx, float *rwsave)
void dcosqb 
(int n, double *dx, double *dwsave)
void vcosqb 
(int m, int n, float *rx, int mdimx, float *rwsave)
void vdcosqb 
(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 VxCOSQB, a real two-dimensional array with dimensions of (MDIMX × N) whose rows contain the sequences to be transformed. On exit, the quarter-wave cosine synthesis of the input.

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 of at least (3 × N + 15) for scalar subroutines or (2 × N + 15) for vector subroutines, initialized by xCOSQI or VxCOSQI.

Sample Program

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

Sample Output

 
 Original Sequence: 
  40.0  38.6  34.6  28.3  20.0  10.4
 Transformed Sequence: 
  49.0   0.0   0.0   0.0   0.0   0.0
 Recovered Sequence: 
  40.0  38.6  34.6  28.3  20.0  10.4






Previous Next Contents Generated Index Doc Set Home