1 subroutine zfft2b ( ldim, l, m, c, wsave, lensav, work, lenwrk, ier )
3 !*****************************************************************************80
5 !! ZFFT2B: complex double precision backward fast Fourier transform, 2D.
9 ! ZFFT2B computes the two-dimensional discrete Fourier transform of a
10 ! complex periodic array. This transform is known as the backward
11 ! transform or Fourier synthesis, transforming from spectral to
12 ! physical space. Routine ZFFT2B is normalized, in that a call to
13 ! ZFFT2B followed by a call to ZFFT2F (or vice-versa) reproduces the
14 ! original array within roundoff error.
16 ! On 10 May 2010, this code was modified by changing the value
17 ! of an index into the WSAVE array.
27 ! Original complex single precision by Paul Swarztrauber, Richard Valent.
28 ! Complex double precision version by John Burkardt.
33 ! Vectorizing the Fast Fourier Transforms,
34 ! in Parallel Computations,
35 ! edited by G. Rodrigue,
36 ! Academic Press, 1982.
39 ! Fast Fourier Transform Algorithms for Vector Computers,
40 ! Parallel Computing, pages 45-63, 1984.
44 ! Input, integer ( kind = 4 ) LDIM, the first dimension of C.
46 ! Input, integer ( kind = 4 ) L, the number of elements to be transformed
47 ! in the first dimension of the two-dimensional complex array C. The value
48 ! of L must be less than or equal to that of LDIM. The transform is
49 ! most efficient when L is a product of small primes.
51 ! Input, integer ( kind = 4 ) M, the number of elements to be transformed
52 ! in the second dimension of the two-dimensional complex array C. The
53 ! transform is most efficient when M is a product of small primes.
55 ! Input/output, complex ( kind = 8 ) C(LDIM,M), on intput, the array of two
56 ! dimensions containing the (L,M) subarray to be transformed. On output,
57 ! the transformed data.
59 ! Input, real ( kind = 8 ) WSAVE(LENSAV). WSAVE's contents must be
60 ! initialized with a call to ZFFT2I before the first call to routine ZFFT2F
61 ! or ZFFT2B with transform lengths L and M. WSAVE's contents may be
62 ! re-used for subsequent calls to ZFFT2F and ZFFT2B with the same
63 ! transform lengths L and M.
65 ! Input, integer ( kind = 4 ) LENSAV, the dimension of the WSAVE array.
66 ! LENSAV must be at least 2*(L+M) + INT(LOG(REAL(L)))
67 ! + INT(LOG(REAL(M))) + 8.
69 ! Workspace, real ( kind = 8 ) WORK(LENWRK).
71 ! Input, integer ( kind = 4 ) LENWRK, the dimension of the WORK array.
72 ! LENWRK must be at least 2*L*M.
74 ! Output, integer ( kind = 4 ) IER, the error flag.
76 ! 2, input parameter LENSAV not big enough;
77 ! 3, input parameter LENWRK not big enough;
78 ! 5, input parameter LDIM < L;
79 ! 20, input error returned by lower level routine.
83 integer ( kind = 4 ) m
84 integer ( kind = 4 ) ldim
85 integer ( kind = 4 ) lensav
86 integer ( kind = 4 ) lenwrk
88 complex ( kind = 8 ) c(ldim,m)
89 integer ( kind = 4 ) ier
90 integer ( kind = 4 ) ier1
91 integer ( kind = 4 ) iw
92 integer ( kind = 4 ) l
93 real ( kind = 8 ) work(lenwrk)
94 real ( kind = 8 ) wsave(lensav)
100 call xerfft ( 'ZFFT2B', -2 )
104 if ( lensav < 2 * l + int ( log ( real ( l, kind = 8 ) ) ) + &
105 2 * m + int ( log ( real ( m, kind = 8 ) ) ) + 8 ) then
107 call xerfft ( 'ZFFT2B', 6 )
111 if ( lenwrk < 2 * l * m ) then
113 call xerfft ( 'ZFFT2B', 8 )
117 ! Transform the X lines of the C array.
119 ! On 10 May 2010, the value of IW was modified.
121 iw = 2 * l + int ( log ( real ( l, kind = 8 ) ) ) + 5
123 call zfftmb ( l, 1, m, ldim, c, (l-1)+ldim*(m-1) +1, &
124 wsave(iw), 2*m + int(log(real ( m, kind = 8 ))) + 4, work, 2*l*m, ier1 )
126 if ( ier1 /= 0 ) then
128 call xerfft ( 'ZFFT2B', -5 )
132 ! Transform the Y lines of the C array.
135 call zfftmb ( m, ldim, l, 1, c, (m-1)*ldim + l, wsave(iw), &
136 2*l + int(log(real ( l, kind = 8 ))) + 4, work, 2*m*l, ier1 )
138 if ( ier1 /= 0 ) then
140 call xerfft ( 'ZFFT2B', -5 )