1 subroutine cost1f ( n, inc, x, lenx, wsave, lensav, work, lenwrk, ier )
3 !*****************************************************************************80
5 !! COST1F: real single precision forward cosine transform, 1D.
9 ! COST1F 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 COST1F followed by a call
15 ! to COST1B (or vice-versa) reproduces the original array within
19 ! Copyright (C) 1995-2004, Scientific Computing Division,
20 ! University Corporation for Atmospheric Research
34 ! Vectorizing the Fast Fourier Transforms,
35 ! in Parallel Computations,
36 ! edited by G. Rodrigue,
37 ! Academic Press, 1982.
40 ! Fast Fourier Transform Algorithms for Vector Computers,
41 ! Parallel Computing, pages 45-63, 1984.
45 ! Input, integer ( kind = 4 ) N, the length of the sequence to be
46 ! transformed. The transform is most efficient when N-1 is a product of
49 ! Input, integer ( kind = 4 ) INC, the increment between the locations,
50 ! in array R, of two consecutive elements within the sequence.
52 ! Input/output, real ( kind = 4 ) R(LENR), containing the sequence to
55 ! Input, integer ( kind = 4 ) LENR, the dimension of the R array.
56 ! LENR must be at least INC*(N-1)+ 1.
58 ! Input, real ( kind = 4 ) WSAVE(LENSAV). WSAVE's contents must be
59 ! initialized with a call to COST1I before the first call to routine COST1F
60 ! or COST1B for a given transform length N. WSAVE's contents may be re-used
61 ! for subsequent calls to COST1F and COST1B with the same N.
63 ! Input, integer ( kind = 4 ) LENSAV, the dimension of the WSAVE array.
64 ! LENSAV must be at least 2*N + INT(LOG(REAL(N))) + 4.
66 ! Workspace, real ( kind = 4 ) WORK(LENWRK).
68 ! Input, integer ( kind = 4 ) LENWRK, the dimension of the WORK array.
69 ! LENWRK must be at least N-1.
71 ! Output, integer ( kind = 4 ) IER, error flag.
73 ! 1, input parameter LENR not big enough;
74 ! 2, input parameter LENSAV not big enough;
75 ! 3, input parameter LENWRK not big enough;
76 ! 20, input error returned by lower level routine.
80 integer ( kind = 4 ) inc
81 integer ( kind = 4 ) lensav
82 integer ( kind = 4 ) lenwrk
84 integer ( kind = 4 ) ier
85 integer ( kind = 4 ) ier1
86 integer ( kind = 4 ) lenx
87 integer ( kind = 4 ) n
88 real ( kind = 4 ) work(lenwrk)
89 real ( kind = 4 ) wsave(lensav)
90 real ( kind = 4 ) x(inc,*)
94 if ( lenx < inc * ( n - 1 ) + 1 ) then
96 call xerfft ( 'COST1F', 6 )
100 if ( lensav < 2 * n + int ( log ( real ( n, kind = 4 ) ) ) + 4 ) then
102 call xerfft ( 'COST1F', 8 )
106 if ( lenwrk < n - 1 ) then
108 call xerfft ( 'COST1F', 10 )
112 call costf1 ( n, inc, x, wsave, work, ier1 )
114 if ( ier1 /= 0 ) then
116 call xerfft ( 'COST1F', -5 )