FSINI

Computes parameters needed by FSINT.

Required Arguments

N — Length of the sequence to be transformed. N must be greater than 1. (Input)

WFSIN — Array of length INT(2.5 * N + 15) containing parameters needed by FSINT. (Output)

FORTRAN 90 Interface

Generic: CALL FSINI (N, WFSIN)

Specific: The specific interface names are S_FSINI and D_FSINI.

FORTRAN 77 Interface

Single: CALL FSINI (N, WFSIN)

Double: The double precision name is DFSINI.

Description

The routine FSINI initializes the routine FSINT. An efficient way to make multiple calls for the same N to IMSL routine FSINT, is to use routine FSINI for initialization. (In this case, replace FSINT with F2INT.) The routine FSINI is based on the routine SINTI in FFTPACK. The package FFTPACK was developed by Paul Swarztrauber at the National Center for Atmospheric Research.

Comments

Different WFSIN arrays are needed for different values of N.

Example

In this example, we compute three distinct sine FFTs by calling FSINI once and then calling F2INT three times.

 

USE FSINI_INT

USE UMACH_INT

USE CONST_INT

USE F2INT_INT

 

IMPLICIT NONE

INTEGER N

PARAMETER (N=7)

!

INTEGER I, K, NOUT

REAL COEF(N+1), FLOAT, PI, SIN, WFSIN(32), SEQ(N)

INTRINSIC FLOAT, SIN

! Get output unit number

CALL UMACH (2, NOUT)

! Initialize the work vector WFSIN

CALL FSINI (N, WFSIN)

! Different frequencies of the same

! wave will be transformed

DO 20 K=1, 3

! Fill the data vector SEQ

! with a pure sine wave

PI = CONST('PI')

DO 10 I=1, N

SEQ(I) = SIN(FLOAT(K*I)*PI/FLOAT(N+1))

10 CONTINUE

! Compute the transform of SEQ

CALL F2INT (N, SEQ, COEF, WFSIN)

! 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.38 8.00

2 0.71 0.00

3 0.92 0.00

4 1.00 0.00

5 0.92 0.00

6 0.71 0.00

7 0.38 0.00

 

INDEX SEQ COEF

1 0.71 0.00

2 1.00 8.00

3 0.71 0.00

4 0.00 0.00

5 -0.71 0.00

6 -1.00 0.00

7 -0.71 0.00

 

INDEX SEQ COEF

1 0.92 0.00

2 0.71 0.00

3 -0.38 8.00

4 -1.00 0.00

5 -0.38 0.00

6 0.71 0.00

7 0.92 0.00