QSINI

Computes parameters needed by QSINF and QSINB.

Required Arguments

N — Length of the sequence to be transformed. (Input)

WQSIN — Array of length 3N + 15 containing parameters needed by QSINF and QSINB. (Output)

FORTRAN 90 Interface

Generic: CALL QSINI (N, WQSIN)

Specific: The specific interface names are S_QSINI and D_QSINI.

FORTRAN 77 Interface

Single: CALL QSINI (N, WQSIN)

Double: The double precision name is DQSINI.

Description

The routine QSINI initializes the functions QSINF and QSINB. An efficient way to make multiple calls for the same N to IMSL routine QSINF or QSINB is to use routine QSINI for initialization. (In this case, replace QSINF or QSINB with Q2INF or Q2INB, respectively.) The routine QSINI is based on the routine SINQI in FFTPACK. The package FFTPACK was developed by Paul Swarztrauber at the National Center for Atmospheric Research.

Comments

Different WQSIN arrays are needed for different values of N.

Example

In this example, we compute three distinct quarter sine transforms by calling QSINI once and then calling Q2INF three times.

 

USE QSINI_INT

USE CONST_INT

USE Q2INF_INT

USE UMACH_INT

 

IMPLICIT NONE

INTEGER N

PARAMETER (N=7)

!

INTEGER I, K, NOUT

REAL COEF(N), FLOAT, PI, SIN, WQSIN(36), SEQ(N)

INTRINSIC FLOAT, SIN

! Get output unit number

CALL UMACH (2, NOUT)

! Initialize the work vector WQSIN

CALL QSINI (N, WQSIN)

! Different frequencies of the same

! wave will be transformed

PI = CONST('PI')

DO 20 K=1, 3

! Fill the data vector SEQ

! with a pure sine wave

DO 10 I=1, N

SEQ(I) = SIN(FLOAT((2*K-1)*I)*(PI/2.0)/FLOAT(N))

10 CONTINUE

! Compute the transform of SEQ

CALL Q2INF (N, SEQ, COEF, WQSIN)

! Print results

WRITE (NOUT,99998)

WRITE (NOUT,99999) (I, SEQ(I), COEF(I), I=1,N)

20 CONTINUE

99998 FORMAT (/, 9X, 'INDEX', 6X, 'SEQ', 7X, 'COEF')

99999 FORMAT (1X, I11, 5X, F6.2, 5X, F6.2)

END

Output

 

INDEX SEQ COEF

1 0.22 7.00

2 0.43 0.00

3 0.62 0.00

4 0.78 0.00

5 0.90 0.00

6 0.97 0.00

7 1.00 0.00

 

INDEX SEQ COEF

1 0.62 0.00

2 0.97 7.00

3 0.90 0.00

4 0.43 0.00

5 -0.22 0.00

6 -0.78 0.00

7 -1.00 0.00

 

INDEX SEQ COEF

1 0.90 0.00

2 0.78 0.00

3 -0.22 7.00

4 -0.97 0.00

5 -0.62 0.00

6 0.43 0.00

7 1.00 0.00