QCOSB
Computes a sequence from its cosine Fourier coefficients with only odd wave numbers.
Required Arguments
N — Length of the sequence to be transformed. (Input)
COEF — Array of length N containing the Fourier coefficients. (Input)
SEQ — Array of length N containing the sequence. (Output)
FORTRAN 90 Interface
Generic: CALL QCOSB (N, COEF, SEQ)
Specific: The specific interface names are S_QCOSB and D_QCOSB.
FORTRAN 77 Interface
Single: CALL QCOSB (N, COEF, SEQ)
Double: The double precision name is DQCOSB.
Description
The routine QCOSB computes the discrete (unnormalized) inverse 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 c = COEF, QCOSB returns in s = SEQ
Furthermore, a vector x of length N that is first transformed by QCOSF and then by QCOSB will be returned by QCOSB as 4Nx. The routine QCOSB is based on the inverse quarter cosine FFT in FFTPACK. The package FFTPACK was developed by Paul Swarztrauber at the National Center for Atmospheric Research.
Comments
1. Workspace may be explicitly provided, if desired, by use of Q2OSB/DQ2OSB. The reference is:
CALL Q2OSB (N, COEF, SEQ, WQCOS)
The additional argument is:
WQCOS — Array of length 3 * N + 15 initialized by QCOSI. The initialization depends on N. (Input)
2. The routine QCOSB 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.
Example
In this example, we first compute the quarter wave cosine Fourier transform c of the vector x, where xn = n for n = 1 to N. We then compute the inverse quarter wave Fourier transform of c which is 4Nx = s.
 
USE QCOSB_INT
USE QCOSF_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER N
PARAMETER (N=7)
!
INTEGER I, NOUT
REAL FLOAT, SEQ(N), COEF(N), X(N)
INTRINSIC FLOAT
! Get output unit number
CALL UMACH (2, NOUT)
! Fill the data vector X
! with X(I) = I, I=1,N
DO 10 I=1, N
X(I) = FLOAT(I)
10 CONTINUE
! Compute the forward transform of X
CALL QCOSF (N, X, COEF)
! Compute the backward transform of
! COEF
CALL QCOSB (N, COEF, SEQ)
! Print results
WRITE (NOUT,99998)
DO 20 I=1, N
WRITE (NOUT,99999) X(I), COEF(I), SEQ(I)
20 CONTINUE
99998 FORMAT (5X, 'INPUT', 5X, 'FORWARD TRANSFORM', 3X, 'BACKWARD ', &
'TRANSFORM')
99999 FORMAT (3X, F6.2, 10X, F6.2, 15X, F6.2)
END
Output
 
INPUT FORWARD TRANSFORM BACKWARD TRANSFORM
1.00 31.12 28.00
2.00 -27.45 56.00
3.00 10.97 84.00
4.00 -9.00 112.00
5.00 4.33 140.00
6.00 -3.36 168.00
7.00 0.40 196.00
Published date: 03/19/2020
Last modified date: 03/19/2020