```

CFFTB

SUBROUTINE CFFTB(N,C,WSAVE)

Subroutine CFFTB computes the backward complex discrete Fourier
transform (the Fourier synthesis).  Equivalently, CFFTB computes
a complex periodic sequence from its Fourier coefficients.
The transform is defined below at output parameter C.
A call of CFFTF followed by a call of CFFTB will multiply the
sequence by N.
The array WSAVE which is used by subroutine CFFTB must be
initialized by calling subroutine CFFTI(N,WSAVE).
Input Parameters
N      the length of the complex sequence C.  The method is
more efficient when N is the product of small primes.
C      a complex array of length N which contains the sequence
WSAVE   a real work array which must be dimensioned at least 4*N+15
in the program that calls CFFTB.  The WSAVE array must be
initialized by calling subroutine CFFTI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
The same WSAVE array can be used by CFFTF and CFFTB.
Output Parameters
C      For J=1,...,N
C(J)=the sum from K=1,...,N of
C(K)*EXP(I*(J-1)*(K-1)*2*PI/N)
where I=SQRT(-1)
WSAVE   contains initialization calculations which must not be
destroyed between calls of subroutine CFFTF or CFFTB

CFFTB1

SUBROUTINE CFFTB1(N,C,CH,WA,IFAC)

CFFTF

SUBROUTINE CFFTF(N,C,WSAVE)

Subroutine CFFTF computes the forward complex discrete Fourier
transform (the Fourier analysis).  Equivalently, CFFTF computes
the Fourier coefficients of a complex periodic sequence.
The transform is defined below at output parameter C.
The transform is not normalized.  To obtain a normalized transform
the output must be divided by N.  Otherwise a call of CFFTF
followed by a call of CFFTB will multiply the sequence by N.
The array WSAVE which is used by subroutine CFFTF must be
initialized by calling subroutine CFFTI(N,WSAVE).
Input Parameters
N      the length of the complex sequence C.  The method is
more efficient when N is the product of small primes.
C      a complex array of length N which contains the sequence
WSAVE   a real work array which must be dimensioned at least 4*N+15
in the program that calls CFFTF.  The WSAVE array must be
initialized by calling subroutine CFFTI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
The same WSAVE array can be used by CFFTF and CFFTB.
Output Parameters
C      for J=1,...,N
C(J)=the sum from K=1,...,N of
C(K)*EXP(-I*(J-1)*(K-1)*2*PI/N)
where I=SQRT(-1)
WSAVE   contains initialization calculations which must not be
destroyed between calls of subroutine CFFTF or CFFTB

CFFTF1

SUBROUTINE CFFTF1(N,C,CH,WA,IFAC)

CFFTI

SUBROUTINE CFFTI(N,WSAVE)

Subroutine CFFTI initializes the array WSAVE which is used in
both CFFTF and CFFTB.  The prime factorization of N together with
a tabulation of the trigonometric functions are computed and
stored in WSAVE.
Input Parameter
N       the length of the sequence to be transformed
Output Parameter
WSAVE   a work array which must be dimensioned at least 4*N+15.
The same work array can be used for both CFFTF and CFFTB
as long as N remains unchanged.  Different WSAVE arrays
are required for different values of N.  The contents of
WSAVE must not be changed between calls of CFFTF or CFFTB.

CFFTI1

SUBROUTINE CFFTI1(N,WA,IFAC)

CFOD

SUBROUTINE CFOD(METH,ELCO,TESCO)

COSQB

SUBROUTINE COSQB(N,X,WSAVE)

Subroutine COSQB computes the fast Fourier transform of quarter
wave data. That is, COSQB computes a sequence from its
representation in terms of a cosine series with odd wave numbers.
The transform is defined below at output parameter X.
COSQB is the unnormalized inverse of COSQF since a call of COSQB
followed by a call of COSQF will multiply the input sequence X
by 4*N.
The array WSAVE which is used by subroutine COSQB must be
initialized by calling subroutine COSQI(N,WSAVE).
Input Parameters
N       the length of the array X to be transformed.  The method
is most efficient when N is a product of small primes.
X       an array which contains the sequence to be transformed
WSAVE   a work array that must be dimensioned at least 3*N+15
in the program that calls COSQB.  The WSAVE array must be
initialized by calling subroutine COSQI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
Output Parameters
X       For I=1,...,N
X(I)= the sum from K=1 to K=N of
4*X(K)*COS((2*K-1)*(I-1)*PI/(2*N))
A call of COSQB followed by a call of
COSQF will multiply the sequence X by 4*N.
Therefore COSQF is the unnormalized inverse
of COSQB.
WSAVE   contains initialization calculations which must not
be destroyed between calls of COSQB or COSQF.

COSQB1

SUBROUTINE COSQB1(N,X,W,XH)

COSQF

SUBROUTINE COSQF(N,X,WSAVE)

Subroutine COSQF computes the fast Fourier transform of quarter
wave data. That is, COSQF computes the coefficients in a cosine
series representation with only odd wave numbers.  The transform
is defined below at Output Parameter X
COSQF is the unnormalized inverse of COSQB since a call of COSQF
followed by a call of COSQB will multiply the input sequence X
by 4*N.
The array WSAVE which is used by subroutine COSQF must be
initialized by calling subroutine COSQI(N,WSAVE).
Input Parameters
N       the length of the array X to be transformed.  The method
is most efficient when N is a product of small primes.
X       an array which contains the sequence to be transformed
WSAVE   a work array which must be dimensioned at least 3*N+15
in the program that calls COSQF.  The WSAVE array must be
initialized by calling subroutine COSQI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
Output Parameters
X       For I=1,...,N
X(I) = X(1) plus the sum from K=2 to K=N of
2*X(K)*COS((2*I-1)*(K-1)*PI/(2*N))
A call of COSQF followed by a call of
COSQB will multiply the sequence X by 4*N.
Therefore COSQB is the unnormalized inverse
of COSQF.
WSAVE   contains initialization calculations which must not
be destroyed between calls of COSQF or COSQB.

COSQF1

SUBROUTINE COSQF1(N,X,W,XH)

COSQI

SUBROUTINE COSQI(N,WSAVE)

Subroutine COSQI initializes the array WSAVE which is used in
both COSQF and COSQB.  The prime factorization of N together with
a tabulation of the trigonometric functions are computed and
stored in WSAVE.
Input Parameter
N       the length of the array to be transformed.  The method
is most efficient when N is a product of small primes.
Output Parameter
WSAVE   a work array which must be dimensioned at least 3*N+15.
The same work array can be used for both COSQF and COSQB
as long as N remains unchanged.  Different WSAVE arrays
are required for different values of N.  The contents of
WSAVE must not be changed between calls of COSQF or COSQB.

COST

SUBROUTINE COST(N,X,WSAVE)

Subroutine COST computes the discrete Fourier cosine transform
of an even sequence X(I).  The transform is defined below at output
parameter X.
COST is the unnormalized inverse of itself since a call of COST
followed by another call of COST will multiply the input sequence
X by 2*(N-1).  The transform is defined below at output parameter X.
The array WSAVE which is used by subroutine COST must be
initialized by calling subroutine COSTI(N,WSAVE).
Input Parameters
N       the length of the sequence X.  N must be greater than 1.
The method is most efficient when N-1 is a product of
small primes.
X       an array which contains the sequence to be transformed
WSAVE   a work array which must be dimensioned at least 3*N+15
in the program that calls COST.  The WSAVE array must be
initialized by calling subroutine COSTI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
Output Parameters
X       For I=1,...,N
X(I) = X(1)+(-1)**(I-1)*X(N)
+ the sum from K=2 to K=N-1
2*X(K)*COS((K-1)*(I-1)*PI/(N-1))
A call of COST followed by another call of
COST will multiply the sequence X by 2*(N-1).
Hence COST is the unnormalized inverse
of itself.
WSAVE   contains initialization calculations which must not be
destroyed between calls of COST.

COSTI

SUBROUTINE COSTI(N,WSAVE)

Subroutine COSTI initializes the array WSAVE which is used in
subroutine COST.  The prime factorization of N together with
a tabulation of the trigonometric functions are computed and
stored in WSAVE.
Input Parameter
N       the length of the sequence to be transformed.  The method
is most efficient when N-1 is a product of small primes.
Output Parameter
WSAVE   a work array which must be dimensioned at least 3*N+15.
Different WSAVE arrays are required for different values
of N.  The contents of WSAVE must not be changed between
calls of COST.

EZFFTB

SUBROUTINE EZFFTB(N,R,AZERO,A,B,WSAVE)

Subroutine EZFFTB computes a real perodic sequence from its
Fourier coefficients (Fourier synthesis).  The transform is
defined below at Output Parameter R.  EZFFTB is a simplified
but slower version of RFFTB.
Input Parameters
N       the length of the output array R.  The method is most
efficient when N is the product of small primes.
AZERO   the constant Fourier coefficient
A,B     arrays which contain the remaining Fourier coefficients.
These arrays are not destroyed.
The length of these arrays depends on whether N is even or
odd.
If N is even, N/2    locations are required.
If N is odd, (N-1)/2 locations are required
WSAVE   a work array which must be dimensioned at least 3*N+15
in the program that calls EZFFTB.  The WSAVE array must be
initialized by calling subroutine EZFFTI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
The same WSAVE array can be used by EZFFTF and EZFFTB.
Output Parameters
R       if N is even, define KMAX=N/2
if N is odd,  define KMAX=(N-1)/2
Then for I=1,...,N
R(I)=AZERO plus the sum from K=1 to K=KMAX of
A(K)*COS(K*(I-1)*2*PI/N)+B(K)*SIN(K*(I-1)*2*PI/N)
********************* Complex Notation **************************
For J=1,...,N
R(J) equals the sum from K=-KMAX to K=KMAX of
C(K)*EXP(I*K*(J-1)*2*PI/N)
where
C(K) = .5*CMPLX(A(K),-B(K))   for K=1,...,KMAX
C(-K) = CONJG(C(K))
C(0) = AZERO
and I=SQRT(-1)
*************** Amplitude - Phase Notation ***********************
For I=1,...,N
R(I) equals AZERO plus the sum from K=1 to K=KMAX of
ALPHA(K)*COS(K*(I-1)*2*PI/N+BETA(K))
where
ALPHA(K) = SQRT(A(K)*A(K)+B(K)*B(K))
COS(BETA(K))=A(K)/ALPHA(K)
SIN(BETA(K))=-B(K)/ALPHA(K)

EZFFTF

SUBROUTINE EZFFTF(N,R,AZERO,A,B,WSAVE)

Subroutine EZFFTF computes the Fourier coefficients of a real
perodic sequence (Fourier analysis).  The transform is defined
below at Output Parameters AZERO, A and B.  EZFFTF is a simplified
but slower version of RFFTF.
Input Parameters
N       the length of the array R to be transformed.  The method
is must efficient when N is the product of small primes.
R       a real array of length N which contains the sequence
to be transformed.  R is not destroyed.
WSAVE   a work array which must be dimensioned at least 3*N+15
in the program that calls EZFFTF.  The WSAVE array must be
initialized by calling subroutine EZFFTI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
The same WSAVE array can be used by EZFFTF and EZFFTB.
Output Parameters
AZERO   the sum from I=1 to I=N of R(I)/N
A,B     for N even B(N/2)=0. and A(N/2) is the sum from I=1 to
I=N of (-1)**(I-1)*R(I)/N
for N even define KMAX=N/2-1
for N odd  define KMAX=(N-1)/2
then for  k=1,...,KMAX
A(K) equals the sum from I=1 to I=N of
2./N*R(I)*COS(K*(I-1)*2*PI/N)
B(K) equals the sum from I=1 to I=N of
2./N*R(I)*SIN(K*(I-1)*2*PI/N)

EZFFTI

SUBROUTINE EZFFTI(N,WSAVE)

Subroutine EZFFTI initializes the array WSAVE which is used in
both EZFFTF and EZFFTB.  The prime factorization of N together with
a tabulation of the trigonometric functions are computed and
stored in WSAVE.
Input Parameter
N       the length of the sequence to be transformed.
Output Parameter
WSAVE   a work array which must be dimensioned at least 3*N+15.
The same work array can be used for both EZFFTF and EZFFTB
as long as N remains unchanged.  Different WSAVE arrays
are required for different values of N.

FFTDOC

SUBROUTINE FFTDOC

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Version 3  June 1979
A Package of Fortran Subprograms for The Fast Fourier
Transform of Periodic and Other Symmetric Sequences
By
Paul N Swarztrauber
National Center For Atmospheric Research  Boulder,Colorado 8030
which is sponsored by the National Science Foundation
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This package consists of programs which perform Fast Fourier
Transforms for both complex and real periodic sequences and
certain other symmetric sequences that are listed below.
1.   RFFTI     Initialize RFFTF and RFFTB
2.   RFFTF     Forward transform of a real periodic sequence
3.   RFFTB     Backward transform of a real coefficient array
4.   EZFFTI    Initialize EZFFTF and EZFFTB
5.   EZFFTF    A simplified real periodic forward transform
6.   EZFFTB    A simplified real periodic backward transform
7.   SINTI     Initialize SINT
8.   SINT      Sine transform of a real odd sequence
9.   COSTI     Initialize COST
10.  COST      Cosine transform of a real even sequence
11.  SINQI     Initialize SINQF and SINQB
12.  SINQF     Forward sine transform with odd wave numbers
13.  SINQB     Unnormalized inverse of SINQF
14.  COSQI     Initialize COSQF and COSQB
15.  COSQF     Forward cosine transform with odd wave numbers
16.  COSQB     Unnormalized inverse of COSQF
17.  CFFTI     Initialize CFFTF and CFFTB
18.  CFFTF     Forward transform of a complex periodic sequence
19.  CFFTB     Unnormalized inverse of CFFTF

RFFTB

SUBROUTINE RFFTB(N,R,WSAVE)

Subroutine RFFTB computes the real perodic sequence from its
Fourier coefficients (Fourier synthesis).  The transform is defined
below at output parameter R.
Input Parameters
N       the length of the array R to be transformed.  The method
is most efficient when N is a product of small primes.
N may change so long as different work arrays are provided.
R       a real array of length N which contains the sequence
to be transformed
WSAVE   a work array which must be dimensioned at least 2*N+15
in the program that calls RFFTB.  The WSAVE array must be
initialized by calling subroutine RFFTI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
The same WSAVE array can be used by RFFTF and RFFTB.
Output Parameters
R       For N even and For I = 1,...,N
R(I) = R(1)+(-1)**(I-1)*R(N)
plus the sum from K=2 to K=N/2 of
2.*R(2*K-2)*COS((K-1)*(I-1)*2*PI/N)
-2.*R(2*K-1)*SIN((K-1)*(I-1)*2*PI/N)
For N odd and For I = 1,...,N
R(I) = R(1) plus the sum from K=2 to K=(N+1)/2 of
2.*R(2*K-2)*COS((K-1)*(I-1)*2*PI/N)
-2.*R(2*K-1)*SIN((K-1)*(I-1)*2*PI/N)
*****  Note:
This transform is unnormalized since a call of RFFTF
followed by a call of RFFTB will multiply the input
sequence by N.
WSAVE   contains results which must not be destroyed between
calls of RFFTB or RFFTF.

RFFTB1

SUBROUTINE RFFTB1(N,C,CH,WA,IFAC)

RFFTF

SUBROUTINE RFFTF(N,R,WSAVE)

Subroutine RFFTF computes the Fourier coefficients of a real
perodic sequence (Fourier analysis).  The transform is defined
below at output parameter R.
Input Parameters
N       the length of the array R to be transformed.  The method
is most efficient when N is a product of small primes.
N may change so long as different work arrays are provided
R       a real array of length N which contains the sequence
to be transformed
WSAVE   a work array which must be dimensioned at least 2*N+15
in the program that calls RFFTF.  The WSAVE array must be
initialized by calling subroutine RFFTI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
the same WSAVE array can be used by RFFTF and RFFTB.
Output Parameters
R       R(1) = the sum from I=1 to I=N of R(I)
If N is even set L = N/2; if N is odd set L = (N+1)/2
then for K = 2,...,L
R(2*K-2) = the sum from I = 1 to I = N of
R(I)*COS((K-1)*(I-1)*2*PI/N)
R(2*K-1) = the sum from I = 1 to I = N of
-R(I)*SIN((K-1)*(I-1)*2*PI/N)
If N is even
R(N) = the sum from I = 1 to I = N of
(-1)**(I-1)*R(I)
*****  Note:
This transform is unnormalized since a call of RFFTF
followed by a call of RFFTB will multiply the input
sequence by N.
WSAVE   contains results which must not be destroyed between
calls of RFFTF or RFFTB.

RFFTF1

SUBROUTINE RFFTF1(N,C,CH,WA,IFAC)

RFFTI

SUBROUTINE RFFTI(N,WSAVE)

Subroutine RFFTI initializes the array WSAVE which is used in
both RFFTF and RFFTB.  The prime factorization of N together with
a tabulation of the trigonometric functions are computed and
stored in WSAVE.
Input Parameter
N       the length of the sequence to be transformed.
Output Parameter
WSAVE   a work array which must be dimensioned at least 2*N+15.
The same work array can be used for both RFFTF and RFFTB
as long as N remains unchanged.  Different WSAVE arrays
are required for different values of N.  The contents of
WSAVE must not be changed between calls of RFFTF or RFFTB.

RFFTI1

SUBROUTINE RFFTI1(N,WA,IFAC)

SINQB

SUBROUTINE SINQB(N,X,WSAVE)

Subroutine SINQB computes the fast Fourier transform of quarter
wave data.  That is, SINQB computes a sequence from its
representation in terms of a sine series with odd wave numbers.
the transform is defined below at output parameter X.
SINQF is the unnormalized inverse of SINQB since a call of SINQB
followed by a call of SINQF will multiply the input sequence X
by 4*N.
The array WSAVE which is used by subroutine SINQB must be
initialized by calling subroutine SINQI(N,WSAVE).
Input Parameters
N       the length of the array X to be transformed.  The method
is most efficient when N is a product of small primes.
X       an array which contains the sequence to be transformed
WSAVE   a work array which must be dimensioned at least 3*N+15
in the program that calls SINQB.  The WSAVE array must be
initialized by calling subroutine SINQI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
Output Parameters
X       for I=1,...,N
X(I)= the sum from K=1 to K=N of
4*X(K)*SIN((2k-1)*I*PI/(2*N))
a call of SINQB followed by a call of
SINQF will multiply the sequence X by 4*N.
Therefore SINQF is the unnormalized inverse
of SINQB.
WSAVE   contains initialization calculations which must not
be destroyed between calls of SINQB or SINQF.

SINQF

SUBROUTINE SINQF(N,X,WSAVE)

Subroutine SINQF computes the fast Fourier transform of quarter
wave data.  That is, SINQF computes the coefficients in a sine
series representation with only odd wave numbers.  The transform
is defined below at output parameter X.
SINQB is the unnormalized inverse of SINQF since a call of SINQF
followed by a call of SINQB will multiply the input sequence X
by 4*N.
The array WSAVE which is used by subroutine SINQF must be
initialized by calling subroutine SINQI(N,WSAVE).
Input Parameters
N       the length of the array X to be transformed.  The method
is most efficient when N is a product of small primes.
X       an array which contains the sequence to be transformed
WSAVE   a work array which must be dimensioned at least 3*N+15
in the program that calls SINQF.  The WSAVE array must be
initialized by calling subroutine SINQI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
Output Parameters
X       For I=1,...,N
X(I) = (-1)**(I-1)*X(N)
+ the sum from K=1 to K=N-1 of
2*X(K)*SIN((2*I-1)*K*PI/(2*N))
A call of SINQF followed by a call of
SINQB will multiply the sequence X by 4*N.
Therefore SINQB is the unnormalized inverse
of SINQF.
WSAVE   contains initialization calculations which must not
be destroyed between calls of SINQF or SINQB.

SINQI

SUBROUTINE SINQI(N,WSAVE)

Subroutine SINQI initializes the array WSAVE which is used in
both SINQF and SINQB.  The prime factorization of N together with
a tabulation of the trigonometric functions are computed and
stored in WSAVE.
Input Parameter
N       the length of the sequence to be transformed.  The method
is most efficient when N is a product of small primes.
Output Parameter
WSAVE   a work array which must be dimensioned at least 3*N+15.
The same work array can be used for both SINQF and SINQB
as long as N remains unchanged.  Different WSAVE arrays
are required for different values of N.  The contents of
WSAVE must not be changed between calls of SINQF or SINQB.

SINT

SUBROUTINE SINT(N,X,WSAVE)

Subroutine SINT computes the discrete Fourier sine transform
of an odd sequence X(I).  The transform is defined below at
output parameter X.
SINT is the unnormalized inverse of itself since a call of SINT
followed by another call of SINT will multiply the input sequence
X by 2*(N+1).
The array WSAVE which is used by subroutine SINT must be
initialized by calling subroutine SINTI(N,WSAVE).
Input Parameters
N       the length of the sequence to be transformed.  The method
is most efficient when N+1 is the product of small primes.
X       an array which contains the sequence to be transformed
WSAVE   a work array with dimension at least INT(3.5*N+16)
in the program that calls SINT.  The WSAVE array must be
initialized by calling subroutine SINTI(N,WSAVE), and a
different WSAVE array must be used for each different
value of N.  This initialization does not have to be
repeated so long as N remains unchanged.  Thus subsequent
transforms can be obtained faster than the first.
Output Parameters
X       for I=1,...,N
X(I)= the sum from k=1 to k=N
2*X(K)*SIN(K*I*PI/(N+1))
A call of SINT followed by another call of
SINT will multiply the sequence X by 2*(N+1).
Hence SINT is the unnormalized inverse
of itself.
WSAVE   contains initialization calculations which must not be
destroyed between calls of SINT.

SINTI

SUBROUTINE SINTI(N,WSAVE)

Subroutine SINTI initializes the array WSAVE which is used in
subroutine SINT.  The prime factorization of N together with
a tabulation of the trigonometric functions are computed and
stored in WSAVE.
Input Parameter
N       the length of the sequence to be transformed.  The method
is most efficient when N+1 is a product of small primes.
Output Parameter
WSAVE   a work array with at least INT(3.5*N+16) locations.
Different WSAVE arrays are required for different values
of N.  The contents of WSAVE must not be changed between
calls of SINT.
```
Pittsburgh Supercomputing Center (PSC)
URL: http://www.psc.edu/general/software/packages/slatec/routines/routines-J.html