FFTRB

 


   more...

Computes the real periodic sequence from its Fourier coefficients.

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 periodic sequence. (Output)

FORTRAN 90 Interface

Generic: CALL FFTRB (N, COEF, SEQ [])

Specific: The specific interface names are S_FFTRB and D_FFTRB.

FORTRAN 77 Interface

Single: CALL FFTRB (N, COEF, SEQ)

Double: The double precision name is DFFTRB.

Description

The routine FFTRB is the unnormalized inverse of the routine FFTRF. This routine computes the discrete inverse Fourier transform of a real vector of size N. It uses the Intel® Math Kernel Library or IBM Engineering and Scientific Subroutine Library for the computation, if available. Otherwise, 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, FFTRB returns in s = SEQ, if N is even:

 

If N is odd:

 

The routine FFTRB is based on the inverse real 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 F2TRB/DF2TRB. The reference is:

CALL F2TRB (N, COEF, SEQ, WFFTR)

The additional argument is

WFFTR — Array of length 2N + 15 initialized by FFTRI. (Input)
The initialization depends on N.

If the Intel® Math Kernel Library or IBM Engineering and Scientific Subroutine Library is used, WFFTR is not referenced.

2. The routine FFTRB is most efficient when N is the product of small primes.

3. The arrays COEF and SEQ may be the same.

4. If FFTRF/FFTRB is used repeatedly with the same value of N, then call FFTRI followed by repeated calls to F2TRF/F2TRB. This is more efficient than repeated calls to FFTRF/FFTRB.

If the Intel® Math Kernel Library or IBM Engineering and Scientific Subroutine Library is used, parameters computed by FFTRI are not used. In this case, there is no need to call FFTRI.

Example

We compute the forward real FFT followed by the inverse operation. In this example, we first compute the Fourier transform

 

of the vector x, where xj = (-1)j for j = 1 to N. This vector

 

is now input into FFTRB with the resulting output s = Nx, that is, sj = (-1)j N for j = 1 to N.

 

USE FFTRB_INT

USE CONST_INT

USE FFTRF_INT

USE UMACH_INT

 

IMPLICIT NONE

INTEGER N

PARAMETER (N=7)

!

INTEGER I, NOUT

REAL COEF(N), FLOAT, SEQ(N), TWOPI, X(N)

INTRINSIC FLOAT

TWOPI = CONST('PI')

!

TWOPI = TWOPI

! Get output unit number

CALL UMACH (2, NOUT)

! Fill the data vector

DO 10 I=1, N

X(I) = FLOAT((-1)**I)

10 CONTINUE

! Compute the forward transform of X

CALL FFTRF (N, X, COEF)

! Print results

WRITE (NOUT,99994)

WRITE (NOUT,99995)

99994 FORMAT (9X, 'Result after forward transform')

99995 FORMAT (9X, 'INDEX', 5X, 'X', 8X, 'COEF')

WRITE (NOUT,99996) (I, X(I), COEF(I), I=1,N)

99996 FORMAT (1X, I11, 5X, F5.2, 5X, F5.2)

! Compute the backward transform of

! COEF

CALL FFTRB (N, COEF, SEQ)

! Print results

WRITE (NOUT,99997)

WRITE (NOUT,99998)

99997 FORMAT (/, 9X, 'Result after backward transform')

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

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

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

END

Output

 

Result after forward transform

INDEX X COEF

1 -1.00 -1.00

2 1.00 -1.00

3 -1.00 -0.48

4 1.00 -1.00

5 -1.00 -1.25

6 1.00 -1.00

7 -1.00 -4.38

 

Result after backward transform

INDEX COEF SEQ

1 -1.00 -7.00

2 -1.00 7.00

3 -0.48 -7.00

4 -1.00 7.00

5 -1.25 -7.00

6 -1.00 7.00

7 -4.38 -7.00