1 subroutine costmb ( lot, jump, n, inc, x, lenx, wsave, lensav, work, &
4 !*****************************************************************************80
6 !! COSTMB: real single precision backward cosine transform, multiple vectors.
10 ! COSTMB computes the one-dimensional Fourier transform of multiple
11 ! even sequences within a real array. This transform is referred to
12 ! as the backward transform or Fourier synthesis, transforming the
13 ! sequences from spectral to physical space.
15 ! This transform is normalized since a call to COSTMB followed
16 ! by a call to COSTMF (or vice-versa) reproduces the original
17 ! array within roundoff error.
20 ! Copyright (C) 1995-2004, Scientific Computing Division,
21 ! University Corporation for Atmospheric Research
35 ! Vectorizing the Fast Fourier Transforms,
36 ! in Parallel Computations,
37 ! edited by G. Rodrigue,
38 ! Academic Press, 1982.
41 ! Fast Fourier Transform Algorithms for Vector Computers,
42 ! Parallel Computing, pages 45-63, 1984.
46 ! Input, integer ( kind = 4 ) LOT, the number of sequences to be transformed
49 ! Input, integer ( kind = 4 ) JUMP, the increment between the locations, in
50 ! array R, of the first elements of two consecutive sequences to be
53 ! Input, integer ( kind = 4 ) N, the length of each sequence to be
54 ! transformed. The transform is most efficient when N-1 is a product of
57 ! Input, integer ( kind = 4 ) INC, the increment between the locations, in
58 ! array R, of two consecutive elements within the same sequence.
60 ! Input/output, real ( kind = 4 ) R(LENR), array containing LOT sequences,
61 ! each having length N. On input, the data to be transformed; on output,
62 ! the transormed data. R can have any number of dimensions, but the total
63 ! number of locations must be at least LENR.
65 ! Input, integer ( kind = 4 ) LENR, the dimension of the R array.
66 ! LENR must be at least (LOT-1)*JUMP + INC*(N-1)+ 1.
68 ! Input, real ( kind = 4 ) WSAVE(LENSAV). WSAVE's contents must be
69 ! initialized with a call to COSTMI before the first call to routine COSTMF
70 ! or COSTMB for a given transform length N. WSAVE's contents may be re-used
71 ! for subsequent calls to COSTMF and COSTMB with the same N.
73 ! Input, integer ( kind = 4 ) LENSAV, the dimension of the WSAVE array.
74 ! LENSAV must be at least 2*N + INT(LOG(REAL(N))) + 4.
76 ! Workspace, real ( kind = 4 ) WORK(LENWRK).
78 ! Input, integer ( kind = 4 ) LENWRK, the dimension of the WORK array.
79 ! LENWRK must be at least LOT*(N+1).
81 ! Output, integer ( kind = 4 ) IER, error flag.
83 ! 1, input parameter LENR not big enough;
84 ! 2, input parameter LENSAV not big enough;
85 ! 3, input parameter LENWRK not big enough;
86 ! 4, input parameters INC,JUMP,N,LOT are not consistent;
87 ! 20, input error returned by lower level routine.
91 integer ( kind = 4 ) inc
92 integer ( kind = 4 ) lensav
93 integer ( kind = 4 ) lenwrk
95 integer ( kind = 4 ) ier
96 integer ( kind = 4 ) ier1
97 integer ( kind = 4 ) iw1
98 integer ( kind = 4 ) jump
99 integer ( kind = 4 ) lenx
100 integer ( kind = 4 ) lot
101 integer ( kind = 4 ) n
102 real ( kind = 4 ) work(lenwrk)
103 real ( kind = 4 ) wsave(lensav)
104 real ( kind = 4 ) x(inc,*)
109 if ( lenx < ( lot - 1 ) * jump + inc * ( n - 1 ) + 1 ) then
111 call xerfft ( 'costmb', 6 )
115 if ( lensav < 2 * n + int ( log ( real ( n, kind = 4 ) ) ) + 4 ) then
117 call xerfft ( 'costmb', 8 )
121 if ( lenwrk < lot * ( n + 1 ) ) then
123 call xerfft ( 'costmb', 10 )
127 if ( .not. xercon ( inc, jump, n, lot ) ) then
129 call xerfft ( 'costmb', -1 )
135 call mcstb1 ( lot, jump, n, inc, x, wsave, work, work(iw1), ier1 )
137 if ( ier1 /= 0 ) then
139 call xerfft ( 'costmb', -5 )