Computes parameters needed by QCOSF and QCOSB.
N — Length of the sequence to be transformed. (Input)
WQCOS — Array of length 3N + 15 containing parameters needed by QCOSF and QCOSB. (Output)
Generic: CALL QCOSI (N, WQCOS)
Specific: The specific interface names are S_QCOSI and D_QCOSI.
Double: The double precision name is DQCOSI.
The routine QCOSI initializes the routines QCOSF and QCOSB. An efficient way to make multiple calls for the same N to IMSL routine QCOSF or QCOSB is to use routine QCOSI for initialization. (In this case, replace QCOSF or QCOSB with Q2OSF or Q2OSB , respectively.) The routine QCOSI is based on the routine COSQI in FFTPACK, which was developed by Paul Swarztrauber at the National Center for Atmospheric Research.
Different WQCOS arrays are needed for different values of N.
In this example, we compute three distinct quarter cosine transforms by calling QCOSI once and then calling Q2OSF three times.
REAL COEF(N), COS, FLOAT, PI, WQCOS(36), SEQ(N)
! Initialize the work vector WQCOS
! Different frequencies of the same
SEQ(I) = COS(FLOAT((2*K-1)*(I-1))*(PI/2.0)/FLOAT(N))
! Compute the transform of SEQ
CALL Q2OSF (N, SEQ, COEF, WQCOS)
WRITE (NOUT,99999) (I, SEQ(I), COEF(I), I=1,N)
99998 FORMAT (/, 9X, 'INDEX', 6X, 'SEQ', 7X, 'COEF')
99999 FORMAT (1X, I11, 5X, F6.2, 5X, F6.2)
INDEX
SEQ COEF
1 1.00
7.00
2
0.97 0.00
3 0.90
0.00
4
0.78 0.00
5 0.62
0.00
6
0.43 0.00
7 0.22
0.00
INDEX
SEQ COEF
1 1.00
0.00
2
0.78 7.00
3 0.22
0.00
4
-0.43 0.00
5 -0.90
0.00
6
-0.97 0.00
7 -0.62
0.00
INDEX
SEQ COEF
1 1.00
0.00
2
0.43 0.00
3 -0.62
7.00
4
-0.97 0.00
5 -0.22
0.00
6
0.78 0.00
7 0.90
0.00
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |