133 SUBROUTINE slaic1( JOB, J, X, SEST, W, GAMMA, SESTPR, S, C )
141 REAL C, GAMMA, S, SEST, SESTPR
151 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0 )
153 parameter( half = 0.5e0, four = 4.0e0 )
156 REAL ABSALP, ABSEST, ABSGAM, ALPHA, B, COSINE, EPS,
157 $ NORMA, S1, S2, SINE, T, TEST, TMP, ZETA1, ZETA2
160 INTRINSIC abs, max, sign, sqrt
164 EXTERNAL sdot, slamch
168 eps = slamch(
'Epsilon' )
169 alpha = sdot( j, x, 1, w, 1 )
171 absalp = abs( alpha )
172 absgam = abs( gamma )
181 IF( sest.EQ.zero )
THEN
182 s1 = max( absgam, absalp )
183 IF( s1.EQ.zero )
THEN
190 tmp = sqrt( s*s+c*c )
196 ELSE IF( absgam.LE.eps*absest )
THEN
199 tmp = max( absest, absalp )
202 sestpr = tmp*sqrt( s1*s1+s2*s2 )
204 ELSE IF( absalp.LE.eps*absest )
THEN
217 ELSE IF( absest.LE.eps*absalp .OR. absest.LE.eps*absgam )
THEN
222 s = sqrt( one+tmp*tmp )
224 c = ( gamma / s2 ) / s
225 s = sign( one, alpha ) / s
228 c = sqrt( one+tmp*tmp )
230 s = ( alpha / s1 ) / c
231 c = sign( one, gamma ) / c
238 zeta1 = alpha / absest
239 zeta2 = gamma / absest
241 b = ( one-zeta1*zeta1-zeta2*zeta2 )*half
244 t = c / ( b+sqrt( b*b+c ) )
246 t = sqrt( b*b+c ) - b
250 cosine = -zeta2 / ( one+t )
251 tmp = sqrt( sine*sine+cosine*cosine )
254 sestpr = sqrt( t+one )*absest
258 ELSE IF( job.EQ.2 )
THEN
264 IF( sest.EQ.zero )
THEN
266 IF( max( absgam, absalp ).EQ.zero )
THEN
273 s1 = max( abs( sine ), abs( cosine ) )
276 tmp = sqrt( s*s+c*c )
280 ELSE IF( absgam.LE.eps*absest )
THEN
285 ELSE IF( absalp.LE.eps*absest )
THEN
298 ELSE IF( absest.LE.eps*absalp .OR. absest.LE.eps*absgam )
THEN
303 c = sqrt( one+tmp*tmp )
304 sestpr = absest*( tmp / c )
305 s = -( gamma / s2 ) / c
306 c = sign( one, alpha ) / c
309 s = sqrt( one+tmp*tmp )
311 c = ( alpha / s1 ) / s
312 s = -sign( one, gamma ) / s
319 zeta1 = alpha / absest
320 zeta2 = gamma / absest
322 norma = max( one+zeta1*zeta1+abs( zeta1*zeta2 ),
323 $ abs( zeta1*zeta2 )+zeta2*zeta2 )
327 test = one + two*( zeta1-zeta2 )*( zeta1+zeta2 )
328 IF( test.GE.zero )
THEN
332 b = ( zeta1*zeta1+zeta2*zeta2+one )*half
334 t = c / ( b+sqrt( abs( b*b-c ) ) )
335 sine = zeta1 / ( one-t )
337 sestpr = sqrt( t+four*eps*eps*norma )*absest
342 b = ( zeta2*zeta2+zeta1*zeta1-one )*half
345 t = -c / ( b+sqrt( b*b+c ) )
347 t = b - sqrt( b*b+c )
350 cosine = -zeta2 / ( one+t )
351 sestpr = sqrt( one+t+four*eps*eps*norma )*absest
353 tmp = sqrt( sine*sine+cosine*cosine )
subroutine slaic1(job, j, x, sest, w, gamma, sestpr, s, c)
SLAIC1 applies one step of incremental condition estimation.