Computes the coefficients of the cosine Fourier transform with only odd wave numbers.
N — Length of the sequence to be transformed. (Input)
SEQ — Array of length N containing the sequence. (Input)
COEF — Array of length N containing the Fourier coefficients. (Output)
Generic: CALL QCOSF (N, SEQ, COEF [,…])
Specific: The specific interface names are S_QCOSF and D_QCOSF.
Single: CALL QCOSF (N, SEQ, COEF)
Double: The double precision name is DQCOSF.
The routine QCOSF computes the discrete Fourier quarter cosine transform of a real vector of size N. The method used is a variant of the Cooley-Tukey algorithm, which is most efficient when N is a product of small prime factors. If N satisfies this condition, then the computational effort is proportional to N log N.
Specifically, given an N-vector s = SEQ, QCOSF returns in c = COEF
Finally, note that the Fourier quarter cosine transform has an (unnormalized) inverse which is implemented in QCOSB. The routine QCOSF is based on the quarter cosine FFT in FFTPACK. The package FFTPACK was developed by Paul Swarztrauber at the National Center for Atmospheric Research.
1. Workspace may be explicitly provided, if desired, by use of Q2OSF/DQ2OSF. The reference is:
CALL Q2OSF (N, SEQ, COEF, WQCOS)
WQCOS — Array of length 3 * N + 15 initialized by QCOSI. The initialization depends on N. (Input)
2. The routine QCOSF is most efficient when N is the product of small primes.
3. The arrays COEF and SEQ may be the same.
4. If QCOSF/QCOSB is used repeatedly with the same value of N, then call QCOSI followed by repeated calls to Q2OSF/Q2OSB. This is more efficient than repeated calls to QCOSF/QCOSB.
In this example, we input a pure quarter cosine wave as a data vector and recover its Fourier quarter cosine series.
REAL COEF(N), COS, FLOAT, PI, SEQ(N)
SEQ(I) = COS(FLOAT(I-1)*(PI/2.0)/FLOAT(N))
! Compute the transform of SEQ
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
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |