136 SUBROUTINE claic1( JOB, J, X, SEST, W, GAMMA, SESTPR, S, C )
149 COMPLEX w( j ), x( j )
156 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0 )
158 parameter( half = 0.5e0, four = 4.0e0 )
161 REAL absalp, absest, absgam, b, eps, norma, s1, s2,
162 $ scl, t, test, tmp, zeta1, zeta2
163 COMPLEX alpha, cosine, sine
166 INTRINSIC abs, conjg, max, sqrt
176 alpha =
cdotc( j, x, 1, w, 1 )
178 absalp = abs( alpha )
179 absgam = abs( gamma )
188 IF( sest.EQ.zero )
THEN
189 s1 = max( absgam, absalp )
190 IF( s1.EQ.zero )
THEN
197 tmp = sqrt( s*conjg( s )+c*conjg( c ) )
203 ELSE IF( absgam.LE.eps*absest )
THEN
206 tmp = max( absest, absalp )
209 sestpr = tmp*sqrt( s1*s1+s2*s2 )
211 ELSE IF( absalp.LE.eps*absest )
THEN
224 ELSE IF( absest.LE.eps*absalp .OR. absest.LE.eps*absgam )
THEN
229 scl = sqrt( one+tmp*tmp )
231 s = ( alpha / s2 ) / scl
232 c = ( gamma / s2 ) / scl
235 scl = sqrt( one+tmp*tmp )
237 s = ( alpha / s1 ) / scl
238 c = ( gamma / s1 ) / scl
245 zeta1 = absalp / absest
246 zeta2 = absgam / absest
248 b = ( one-zeta1*zeta1-zeta2*zeta2 )*half
251 t = c / ( b+sqrt( b*b+c ) )
253 t = sqrt( b*b+c ) - b
256 sine = -( alpha / absest ) / t
257 cosine = -( gamma / absest ) / ( one+t )
258 tmp = sqrt( sine*conjg( sine )+cosine*conjg( cosine ) )
261 sestpr = sqrt( t+one )*absest
265 ELSE IF( job.EQ.2 )
THEN
271 IF( sest.EQ.zero )
THEN
273 IF( max( absgam, absalp ).EQ.zero )
THEN
277 sine = -conjg( gamma )
278 cosine = conjg( alpha )
280 s1 = max( abs( sine ), abs( cosine ) )
283 tmp = sqrt( s*conjg( s )+c*conjg( c ) )
287 ELSE IF( absgam.LE.eps*absest )
THEN
292 ELSE IF( absalp.LE.eps*absest )
THEN
305 ELSE IF( absest.LE.eps*absalp .OR. absest.LE.eps*absgam )
THEN
310 scl = sqrt( one+tmp*tmp )
311 sestpr = absest*( tmp / scl )
312 s = -( conjg( gamma ) / s2 ) / scl
313 c = ( conjg( alpha ) / s2 ) / scl
316 scl = sqrt( one+tmp*tmp )
317 sestpr = absest / scl
318 s = -( conjg( gamma ) / s1 ) / scl
319 c = ( conjg( alpha ) / s1 ) / scl
326 zeta1 = absalp / absest
327 zeta2 = absgam / absest
329 norma = max( one+zeta1*zeta1+zeta1*zeta2,
330 $ zeta1*zeta2+zeta2*zeta2 )
334 test = one + two*( zeta1-zeta2 )*( zeta1+zeta2 )
335 IF( test.GE.zero )
THEN
339 b = ( zeta1*zeta1+zeta2*zeta2+one )*half
341 t = c / ( b+sqrt( abs( b*b-c ) ) )
342 sine = ( alpha / absest ) / ( one-t )
343 cosine = -( gamma / absest ) / t
344 sestpr = sqrt( t+four*eps*eps*norma )*absest
349 b = ( zeta2*zeta2+zeta1*zeta1-one )*half
352 t = -c / ( b+sqrt( b*b+c ) )
354 t = b - sqrt( b*b+c )
356 sine = -( alpha / absest ) / t
357 cosine = -( gamma / absest ) / ( one+t )
358 sestpr = sqrt( one+t+four*eps*eps*norma )*absest
360 tmp = sqrt( sine*conjg( sine )+cosine*conjg( cosine ) )