Computes parameters needed by FCOST.
N — Length of the sequence to be transformed. N must be greater than 1. (Input)
WFCOS — Array of length 3N + 15 containing parameters needed by FCOST. (Output)
Generic: CALL FCOSI (N, WFCOS)
Specific: The specific interface names are S_FCOSI and D_FCOSI.
Double: The double precision name is DFCOSI.
The routine FCOSI initializes the routine FCOST. An efficient way to make multiple calls for the same N to IMSL routine FCOST is to use routine FCOSI for initialization. (In this case, replace FCOST with F2OST.) The routine FCOSI is based on the routine COSTI in FFTPACK. The package FFTPACK was developed by Paul Swarztrauber at the National Center for Atmospheric Research.
Different WFCOS arrays are needed for different values of N.
In this example, we compute three distinct cosine FFTs by calling FCOSI once and then calling F2OST three times.
REAL COEF(N), COS, FLOAT, PI, WFCOS(36), SEQ(N)
! Initialize the work vector WFCOS
! Different frequencies of the same
SEQ(I) = COS(FLOAT(K*(I-1))*PI/FLOAT(N-1))
! Compute the transform of SEQ
CALL F2OST (N, SEQ, COEF, WFCOS)
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
0.00
2
0.87 6.00
3 0.50
0.00
4
0.00 0.00
5 -0.50
0.00
6
-0.87 0.00
7 -1.00
0.00
INDEX
SEQ COEF
1 1.00
0.00
2
0.50 0.00
3 -0.50
6.00
4
-1.00 0.00
5 -0.50
0.00
6
0.50 0.00
7 1.00
0.00
INDEX
SEQ COEF
1 1.00
0.00
2
0.00 0.00
3 -1.00
0.00
4
0.00 6.00
5 1.00
0.00
6
0.00 0.00
7 -1.00 0.00
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |