1 subroutine dcost1f ( n, inc, x, lenx, wsave, lensav, work, lenwrk, ier )
3 !*****************************************************************************80
5 !! DCOST1F: real double precision forward cosine transform, 1D.
9 ! DCOST1F computes the one-dimensional Fourier transform of an even
10 ! sequence within a real array. This transform is referred to as the
11 ! forward transform or Fourier analysis, transforming the sequence
12 ! from physical to spectral space.
14 ! This transform is normalized since a call to DCOST1F followed by a call
15 ! to DCOST1B (or vice-versa) reproduces the original array within
26 ! Original real single precision by Paul Swarztrauber, Richard Valent.
27 ! Real double precision version by John Burkardt.
32 ! Vectorizing the Fast Fourier Transforms,
33 ! in Parallel Computations,
34 ! edited by G. Rodrigue,
35 ! Academic Press, 1982.
38 ! Fast Fourier Transform Algorithms for Vector Computers,
39 ! Parallel Computing, pages 45-63, 1984.
43 ! Input, integer ( kind = 4 ) N, the length of the sequence to be
44 ! transformed. The transform is most efficient when N-1 is a product of
47 ! Input, integer ( kind = 4 ) INC, the increment between the locations,
48 ! in array R, of two consecutive elements within the sequence.
50 ! Input/output, real ( kind = 8 ) R(LENR), containing the sequence
53 ! Input, integer ( kind = 4 ) LENR, the dimension of the R array.
54 ! LENR must be at least INC*(N-1)+ 1.
56 ! Input, real ( kind = 8 ) WSAVE(LENSAV). WSAVE's contents must be
57 ! initialized with a call to DCOST1I before the first call to routine
58 ! DCOST1F or DCOST1B for a given transform length N. WSAVE's contents
59 ! may be re-used for subsequent calls to DCOST1F and DCOST1B with the same N.
61 ! Input, integer ( kind = 4 ) LENSAV, the dimension of the WSAVE array.
62 ! LENSAV must be at least 2*N + INT(LOG(REAL(N))) + 4.
64 ! Workspace, real ( kind = 8 ) WORK(LENWRK).
66 ! Input, integer ( kind = 4 ) LENWRK, the dimension of the WORK array.
67 ! LENWRK must be at least N-1.
69 ! Output, integer ( kind = 4 ) IER, error flag.
71 ! 1, input parameter LENR not big enough;
72 ! 2, input parameter LENSAV not big enough;
73 ! 3, input parameter LENWRK not big enough;
74 ! 20, input error returned by lower level routine.
78 integer ( kind = 4 ) inc
79 integer ( kind = 4 ) lensav
80 integer ( kind = 4 ) lenwrk
82 integer ( kind = 4 ) ier
83 integer ( kind = 4 ) ier1
84 integer ( kind = 4 ) lenx
85 integer ( kind = 4 ) n
86 real ( kind = 8 ) work(lenwrk)
87 real ( kind = 8 ) wsave(lensav)
88 real ( kind = 8 ) x(inc,*)
92 if ( lenx < inc * ( n - 1 ) + 1 ) then
94 call xerfft ( 'DCOST1F', 6 )
98 if ( lensav < 2 * n + int ( log ( real ( n, kind = 8 ) ) ) + 4 ) then
100 call xerfft ( 'DCOST1F', 8 )
104 if ( lenwrk < n - 1 ) then
106 call xerfft ( 'DCOST1F', 10 )
110 call dcostf1 ( n, inc, x, wsave, work, ier1 )
112 if ( ier1 /= 0 ) then
114 call xerfft ( 'DCOST1F', -5 )