NCEPLIBS-sp 2.4.0
spfft.f
Go to the documentation of this file.
1C> @file
2C> @brief Perform multiple fast fourier transforms.
3C> @author Iredell @date 96-02-20
4
5C> This subprogram performs multiple fast fourier transforms
6C> between complex amplitudes in fourier space and real values
7C> in cyclic physical space.
8C>
9C> Subprogram spfft must be invoked first with idir=0
10C> to initialize trigonemetric data. Use subprogram spfft1
11C> to perform an fft without previous initialization.
12C> This version invokes the ibm essl fft.
13C>
14C> The restrictions on imax are that it must be a multiple
15C> of 1 to 25 factors of two, up to 2 factors of three,
16C> and up to 1 factor of five, seven and eleven.
17C>
18C> If IDIR=0, then W and G need not contain any valid data.
19C> the other parameters must be supplied and cannot change
20C> in succeeding calls until the next time it is called with IDIR=0.
21C>
22C> This subprogram is not thread-safe when IDIR=0. On the other hand,
23C> when IDIR is not zero, it can be called from a threaded region.
24C>
25C> @param IMAX number of values in the cyclic physical space
26C> (see limitations on imax in remarks below.)
27C> @param INCW first dimension of the complex amplitude array
28C> (INCW >= IMAX/2+1)
29C> @param INCG first dimension of the real value array
30C> (INCG >= IMAX)
31C> @param KMAX number of transforms to perform
32C> @param[out] W complex amplitudes if IDIR>0
33C> @param[out] G real values if IDIR<0
34C> @param IDIR direction flag
35C> - IDIR=0 to initialize internal trigonometric data
36C> - IDIR>0 TO transform from Fourier to physical space
37C> - IDIR<0 TO transform from physical to fourier space
38C>
39C> @author Iredell @date 96-02-20
40 SUBROUTINE spfft(IMAX,INCW,INCG,KMAX,W,G,IDIR)
41
42 IMPLICIT NONE
43 INTEGER,INTENT(IN):: IMAX,INCW,INCG,KMAX,IDIR
44 COMPLEX,INTENT(INOUT):: W(INCW,KMAX)
45 REAL,INTENT(INOUT):: G(INCG,KMAX)
46 INTEGER,SAVE:: NAUX1=0
47 REAL,SAVE,ALLOCATABLE:: AUX1CR(:),AUX1RC(:)
48 INTEGER:: NAUX2
49 REAL:: AUX2(20000+INT(0.57*IMAX))
50
51 naux2=20000+int(0.57*imax)
52
53C INITIALIZATION.
54C ALLOCATE AND FILL AUXILIARY ARRAYS WITH TRIGONOMETRIC DATA
55 SELECT CASE(idir)
56 CASE(0)
57 IF(naux1.GT.0) DEALLOCATE(aux1cr,aux1rc)
58 naux1=25000+int(0.82*imax)
59 ALLOCATE(aux1cr(naux1),aux1rc(naux1))
60 CALL scrft(1,w,incw,g,incg,imax,kmax,-1,1.,
61 & aux1cr,naux1,aux2,naux2,0.,0)
62 CALL srcft(1,g,incg,w,incw,imax,kmax,+1,1./imax,
63 & aux1rc,naux1,aux2,naux2,0.,0)
64
65C FOURIER TO PHYSICAL TRANSFORM.
66 CASE(1:)
67 CALL scrft(0,w,incw,g,incg,imax,kmax,-1,1.,
68 & aux1cr,naux1,aux2,naux2,0.,0)
69
70C PHYSICAL TO FOURIER TRANSFORM.
71 CASE(:-1)
72 CALL srcft(0,g,incg,w,incw,imax,kmax,+1,1./imax,
73 & aux1rc,naux1,aux2,naux2,0.,0)
74 END SELECT
75 END SUBROUTINE
subroutine scrft(init, x, ldx, y, ldy, n, m, isign, scale, table, n1, wrk, n2, z, nz)
scrft
Definition: fftpack.F:80
subroutine srcft(init, x, ldx, y, ldy, n, m, isign, scale, table, n1, wrk, n2, z, nz)
srcft
Definition: fftpack.F:209
subroutine spfft(IMAX, INCW, INCG, KMAX, W, G, IDIR)
This subprogram performs multiple fast fourier transforms between complex amplitudes in fourier space...
Definition: spfft.f:41