1 subroutine cosqmb ( lot, jump, n, inc, x, lenx, wsave, lensav, work, &
4 !*****************************************************************************80
6 !! COSQMB: real single precision backward cosine quarter wave, multiple vectors.
10 ! COSQMB computes the one-dimensional Fourier transform of multiple
11 ! sequences, each of which is a cosine series with odd wave numbers.
12 ! This transform is referred to as the backward transform or Fourier
13 ! synthesis, transforming the sequences from spectral to physical space.
15 ! This transform is normalized since a call to COSQMB followed
16 ! by a call to COSQMF (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,
50 ! in 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 is a product of
57 ! Input, integer ( kind = 4 ) INC, the increment between the locations,
58 ! in 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. R can have any number of dimensions, but the total
62 ! number of locations must be at least LENR. On input, R contains the data
63 ! to be transformed, and on output, the transformed data.
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 COSQMI before the first call to routine COSQMF
70 ! or COSQMB for a given transform length N. WSAVE's contents may be re-used
71 ! for subsequent calls to COSQMF and COSQMB 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.
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 ) jump
98 integer ( kind = 4 ) lenx
99 integer ( kind = 4 ) lj
100 integer ( kind = 4 ) lot
101 integer ( kind = 4 ) m
102 integer ( kind = 4 ) n
103 real ( kind = 4 ) ssqrt2
104 real ( kind = 4 ) work(lenwrk)
105 real ( kind = 4 ) wsave(lensav)
106 real ( kind = 4 ) x(inc,*)
112 if ( lenx < ( lot - 1 ) * jump + inc * ( n - 1 ) + 1 ) then
114 call xerfft ( 'cosqmb', 6 )
118 if ( lensav < 2 * n + int ( log ( real ( n, kind = 4 ) ) ) + 4 ) then
120 call xerfft ( 'cosqmb', 8 )
124 if ( lenwrk < lot * n ) then
126 call xerfft ( 'cosqmb', 10 )
130 if ( .not. xercon ( inc, jump, n, lot ) ) then
132 call xerfft ( 'cosqmb', -1 )
136 lj = ( lot - 1 ) * jump + 1
146 ssqrt2 = 1.0E+00 / sqrt ( 2.0E+00 )
149 x(m,2) = ssqrt2 * ( x(m,1) - x(m,2) )
155 call mcsqb1 ( lot, jump, n, inc, x, wsave, work, ier1 )
157 if ( ier1 /= 0 ) then
159 call xerfft ( 'cosqmb', -5 )