134 SUBROUTINE zlaic1( JOB, J, X, SEST, W, GAMMA, SESTPR, S, C )
142 DOUBLE PRECISION SEST, SESTPR
143 COMPLEX*16 C, GAMMA, S
146 COMPLEX*16 W( J ), X( J )
152 DOUBLE PRECISION ZERO, ONE, TWO
153 parameter( zero = 0.0d0, one = 1.0d0, two = 2.0d0 )
154 DOUBLE PRECISION HALF, FOUR
155 parameter( half = 0.5d0, four = 4.0d0 )
158 DOUBLE PRECISION ABSALP, ABSEST, ABSGAM, B, EPS, NORMA, S1, S2,
159 $ SCL, T, TEST, TMP, ZETA1, ZETA2
160 COMPLEX*16 ALPHA, COSINE, SINE
163 INTRINSIC abs, dconjg, max, sqrt
166 DOUBLE PRECISION DLAMCH
168 EXTERNAL dlamch, zdotc
172 eps = dlamch(
'Epsilon' )
173 alpha = zdotc( 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 = dble( sqrt( s*dconjg( s )+c*dconjg( 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 = dble( c / ( b+sqrt( b*b+c ) ) )
250 t = dble( sqrt( b*b+c ) - b )
253 sine = -( alpha / absest ) / t
254 cosine = -( gamma / absest ) / ( one+t )
255 tmp = dble( sqrt( sine * dconjg( sine )
256 $ + cosine * dconjg( cosine ) ) )
260 sestpr = sqrt( t+one )*absest
264 ELSE IF( job.EQ.2 )
THEN
270 IF( sest.EQ.zero )
THEN
272 IF( max( absgam, absalp ).EQ.zero )
THEN
276 sine = -dconjg( gamma )
277 cosine = dconjg( alpha )
279 s1 = max( abs( sine ), abs( cosine ) )
282 tmp = dble( sqrt( s*dconjg( s )+c*dconjg( c ) ) )
286 ELSE IF( absgam.LE.eps*absest )
THEN
291 ELSE IF( absalp.LE.eps*absest )
THEN
304 ELSE IF( absest.LE.eps*absalp .OR. absest.LE.eps*absgam )
THEN
309 scl = sqrt( one+tmp*tmp )
310 sestpr = absest*( tmp / scl )
311 s = -( dconjg( gamma ) / s2 ) / scl
312 c = ( dconjg( alpha ) / s2 ) / scl
315 scl = sqrt( one+tmp*tmp )
316 sestpr = absest / scl
317 s = -( dconjg( gamma ) / s1 ) / scl
318 c = ( dconjg( alpha ) / s1 ) / scl
325 zeta1 = absalp / absest
326 zeta2 = absgam / absest
328 norma = max( one+zeta1*zeta1+zeta1*zeta2,
329 $ zeta1*zeta2+zeta2*zeta2 )
333 test = one + two*( zeta1-zeta2 )*( zeta1+zeta2 )
334 IF( test.GE.zero )
THEN
338 b = ( zeta1*zeta1+zeta2*zeta2+one )*half
340 t = dble( c / ( b+sqrt( abs( b*b-c ) ) ) )
341 sine = ( alpha / absest ) / ( one-t )
342 cosine = -( gamma / absest ) / t
343 sestpr = sqrt( t+four*eps*eps*norma )*absest
348 b = ( zeta2*zeta2+zeta1*zeta1-one )*half
351 t = dble( -c / ( b+sqrt( b*b+c ) ) )
353 t = dble( b - sqrt( b*b+c ) )
355 sine = -( alpha / absest ) / t
356 cosine = -( gamma / absest ) / ( one+t )
357 sestpr = sqrt( one+t+four*eps*eps*norma )*absest
359 tmp = dble( sqrt( sine * dconjg( sine )
360 $ + cosine * dconjg( cosine ) ) )
subroutine zlaic1(job, j, x, sest, w, gamma, sestpr, s, c)
ZLAIC1 applies one step of incremental condition estimation.