1 subroutine cost1b ( n, inc, x, lenx, wsave, lensav, work, lenwrk, ier )
3 !*****************************************************************************80
5 !! COST1B: real single precision backward cosine transform, 1D.
9 ! COST1B computes the one-dimensional Fourier transform of an even
10 ! sequence within a real array. This transform is referred to as
11 ! the backward transform or Fourier synthesis, transforming the sequence
12 ! from spectral to physical space.
14 ! This transform is normalized since a call to COST1B followed
15 ! by a call to COST1F (or vice-versa) reproduces the original array
16 ! within roundoff error.
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 ( 'cost1b', 6 )
100 if ( lensav < 2 * n + int ( log ( real ( n, kind = 4 ) ) ) + 4 ) then
102 call xerfft ( 'cost1b', 8 )
106 if ( lenwrk < n - 1 ) then
108 call xerfft ( 'cost1b', 10 )
112 call costb1 ( n, inc, x, wsave, work, ier1 )
114 if ( ier1 /= 0 ) then
116 call xerfft ( 'cost1b', -5 )