1 subroutine cost1i ( n, wsave, lensav, ier )
3 !*****************************************************************************80
5 !! COST1I: initialization for COST1B and COST1F.
9 ! COST1I initializes array WSAVE for use in its companion routines
10 ! COST1F and COST1B. The prime factorization of N together with a
11 ! tabulation of the trigonometric functions are computed and stored
12 ! in array WSAVE. Separate WSAVE arrays are required for different
16 ! Copyright (C) 1995-2004, Scientific Computing Division,
17 ! University Corporation for Atmospheric Research
31 ! Vectorizing the Fast Fourier Transforms,
32 ! in Parallel Computations,
33 ! edited by G. Rodrigue,
34 ! Academic Press, 1982.
37 ! Fast Fourier Transform Algorithms for Vector Computers,
38 ! Parallel Computing, pages 45-63, 1984.
42 ! Input, integer ( kind = 4 ) N, the length of the sequence to be
43 ! transformed. The transform is most efficient when N-1 is a product
46 ! Input, integer ( kind = 4 ) LENSAV, dimension of WSAVE array.
47 ! LENSAV must be at least 2*N + INT(LOG(REAL(N))) + 4.
49 ! Output, real ( kind = 4 ) WSAVE(LENSAV), containing the prime factors of
50 ! N and also containing certain trigonometric values which will be used in
51 ! routines COST1B or COST1F.
53 ! Output, integer ( kind = 4 ) IER, error flag.
55 ! 2, input parameter LENSAV not big enough;
56 ! 20, input error returned by lower level routine.
60 integer ( kind = 4 ) lensav
64 integer ( kind = 4 ) ier
65 integer ( kind = 4 ) ier1
66 integer ( kind = 4 ) k
67 integer ( kind = 4 ) kc
68 integer ( kind = 4 ) lnsv
69 integer ( kind = 4 ) n
70 integer ( kind = 4 ) nm1
71 integer ( kind = 4 ) np1
72 integer ( kind = 4 ) ns2
74 real ( kind = 4 ) wsave(lensav)
78 if ( lensav < 2 * n + int ( log ( real ( n, kind = 4 ) ) ) + 4 ) then
80 call xerfft ( 'COST1I', 3 )
91 pi = 4.0E+00 * atan ( 1.0E+00 )
92 dt = pi / real ( nm1, kind = 4 )
97 wsave(k) = 2.0E+00 * sin ( fk * dt )
98 wsave(kc) = 2.0E+00 * cos ( fk * dt )
101 lnsv = nm1 + int ( log ( real ( nm1, kind = 4 ) ) ) + 4
103 call rfft1i ( nm1, wsave(n+1), lnsv, ier1 )
105 if ( ier1 /= 0 ) then
107 call xerfft ( 'COST1I', -5 )