136 SUBROUTINE zlaic1( JOB, J, X, SEST, W, GAMMA, SESTPR, S, C )
145 DOUBLE PRECISION SEST, SESTPR
146 COMPLEX*16 C, GAMMA, S
149 COMPLEX*16 W( j ), X( j )
155 DOUBLE PRECISION ZERO, ONE, TWO
156 parameter ( zero = 0.0d0, one = 1.0d0, two = 2.0d0 )
157 DOUBLE PRECISION HALF, FOUR
158 parameter ( half = 0.5d0, four = 4.0d0 )
161 DOUBLE PRECISION ABSALP, ABSEST, ABSGAM, B, EPS, NORMA, S1, S2,
162 $ scl, t, test, tmp, zeta1, zeta2
163 COMPLEX*16 ALPHA, COSINE, SINE
166 INTRINSIC abs, dconjg, max, sqrt
169 DOUBLE PRECISION DLAMCH
171 EXTERNAL dlamch, zdotc
175 eps = dlamch(
'Epsilon' )
176 alpha = zdotc( 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*dconjg( s )+c*dconjg( 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*dconjg( sine )+cosine*dconjg( 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 = -dconjg( gamma )
278 cosine = dconjg( alpha )
280 s1 = max( abs( sine ), abs( cosine ) )
283 tmp = sqrt( s*dconjg( s )+c*dconjg( 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 = -( dconjg( gamma ) / s2 ) / scl
313 c = ( dconjg( alpha ) / s2 ) / scl
316 scl = sqrt( one+tmp*tmp )
317 sestpr = absest / scl
318 s = -( dconjg( gamma ) / s1 ) / scl
319 c = ( dconjg( 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*dconjg( sine )+cosine*dconjg( cosine ) )
subroutine zlaic1(JOB, J, X, SEST, W, GAMMA, SESTPR, S, C)
ZLAIC1 applies one step of incremental condition estimation.