134 SUBROUTINE claic1( JOB, J, X, SEST, W, GAMMA, SESTPR, S, C )
146 COMPLEX W( J ), X( J )
153 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0 )
155 parameter( half = 0.5e0, four = 4.0e0 )
158 REAL ABSALP, ABSEST, ABSGAM, B, EPS, NORMA, S1, S2,
159 $ SCL, T, TEST, TMP, ZETA1, ZETA2
160 COMPLEX ALPHA, COSINE, SINE
163 INTRINSIC abs, conjg, max, sqrt
168 EXTERNAL slamch, cdotc
172 eps = slamch(
'Epsilon' )
173 alpha = cdotc( j, x, 1, w, 1 )
175 absalp = abs( alpha )
176 absgam = abs( gamma )
185 IF( sest.EQ.zero )
THEN
186 s1 = max( absgam, absalp )
187 IF( s1.EQ.zero )
THEN
194 tmp = real( sqrt( s*conjg( s )+c*conjg( c ) ) )
200 ELSE IF( absgam.LE.eps*absest )
THEN
203 tmp = max( absest, absalp )
206 sestpr = tmp*sqrt( s1*s1+s2*s2 )
208 ELSE IF( absalp.LE.eps*absest )
THEN
221 ELSE IF( absest.LE.eps*absalp .OR. absest.LE.eps*absgam )
THEN
226 scl = sqrt( one+tmp*tmp )
228 s = ( alpha / s2 ) / scl
229 c = ( gamma / s2 ) / scl
232 scl = sqrt( one+tmp*tmp )
234 s = ( alpha / s1 ) / scl
235 c = ( gamma / s1 ) / scl
242 zeta1 = absalp / absest
243 zeta2 = absgam / absest
245 b = ( one-zeta1*zeta1-zeta2*zeta2 )*half
248 t = real( c / ( b+sqrt( b*b+c ) ) )
250 t = real( sqrt( b*b+c ) - b )
253 sine = -( alpha / absest ) / t
254 cosine = -( gamma / absest ) / ( one+t )
255 tmp = real( sqrt( sine * conjg( sine )
256 $ + cosine * conjg( cosine ) ) )
259 sestpr = sqrt( t+one )*absest
263 ELSE IF( job.EQ.2 )
THEN
269 IF( sest.EQ.zero )
THEN
271 IF( max( absgam, absalp ).EQ.zero )
THEN
275 sine = -conjg( gamma )
276 cosine = conjg( alpha )
278 s1 = max( abs( sine ), abs( cosine ) )
281 tmp = real( sqrt( s*conjg( s )+c*conjg( c ) ) )
285 ELSE IF( absgam.LE.eps*absest )
THEN
290 ELSE IF( absalp.LE.eps*absest )
THEN
303 ELSE IF( absest.LE.eps*absalp .OR. absest.LE.eps*absgam )
THEN
308 scl = sqrt( one+tmp*tmp )
309 sestpr = absest*( tmp / scl )
310 s = -( conjg( gamma ) / s2 ) / scl
311 c = ( conjg( alpha ) / s2 ) / scl
314 scl = sqrt( one+tmp*tmp )
315 sestpr = absest / scl
316 s = -( conjg( gamma ) / s1 ) / scl
317 c = ( conjg( alpha ) / s1 ) / scl
324 zeta1 = absalp / absest
325 zeta2 = absgam / absest
327 norma = max( one+zeta1*zeta1+zeta1*zeta2,
328 $ zeta1*zeta2+zeta2*zeta2 )
332 test = one + two*( zeta1-zeta2 )*( zeta1+zeta2 )
333 IF( test.GE.zero )
THEN
337 b = ( zeta1*zeta1+zeta2*zeta2+one )*half
339 t = real( c / ( b+sqrt( abs( b*b-c ) ) ) )
340 sine = ( alpha / absest ) / ( one-t )
341 cosine = -( gamma / absest ) / t
342 sestpr = sqrt( t+four*eps*eps*norma )*absest
347 b = ( zeta2*zeta2+zeta1*zeta1-one )*half
350 t = real( -c / ( b+sqrt( b*b+c ) ) )
352 t = real( b - sqrt( b*b+c ) )
354 sine = -( alpha / absest ) / t
355 cosine = -( gamma / absest ) / ( one+t )
356 sestpr = sqrt( one+t+four*eps*eps*norma )*absest
358 tmp = real( sqrt( sine * conjg( sine )
359 $ + cosine * conjg( cosine ) ) )
subroutine claic1(job, j, x, sest, w, gamma, sestpr, s, c)
CLAIC1 applies one step of incremental condition estimation.