183 SUBROUTINE zhetf2( UPLO, N, A, LDA, IPIV, INFO )
196 COMPLEX*16 a( lda, * )
202 DOUBLE PRECISION zero, one
203 parameter( zero = 0.0d+0, one = 1.0d+0 )
204 DOUBLE PRECISION eight, sevten
205 parameter( eight = 8.0d+0, sevten = 17.0d+0 )
209 INTEGER i, imax, j, jmax, k, kk, kp, kstep
210 DOUBLE PRECISION absakk, alpha, colmax, d, d11, d22, r1, rowmax,
212 COMPLEX*16 d12, d21, t, wk, wkm1, wkp1, zdum
224 INTRINSIC abs, dble, dcmplx, dconjg, dimag, max, sqrt
227 DOUBLE PRECISION cabs1
230 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
237 upper =
lsame( uplo,
'U' )
238 IF( .NOT.upper .AND. .NOT.
lsame( uplo,
'L' ) )
THEN
240 ELSE IF( n.LT.0 )
THEN
242 ELSE IF( lda.LT.max( 1, n ) )
THEN
246 CALL
xerbla(
'ZHETF2', -info )
252 alpha = ( one+sqrt( sevten ) ) / eight
273 absakk = abs( dble( a( k, k ) ) )
279 imax =
izamax( k-1, a( 1, k ), 1 )
280 colmax = cabs1( a( imax, k ) )
285 IF( (max( absakk, colmax ).EQ.zero) .OR.
disnan(absakk) )
THEN
292 a( k, k ) = dble( a( k, k ) )
294 IF( absakk.GE.alpha*colmax )
THEN
304 jmax = imax +
izamax( k-imax, a( imax, imax+1 ), lda )
305 rowmax = cabs1( a( imax, jmax ) )
307 jmax =
izamax( imax-1, a( 1, imax ), 1 )
308 rowmax = max( rowmax, cabs1( a( jmax, imax ) ) )
311 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
316 ELSE IF( abs( dble( a( imax, imax ) ) ).GE.alpha*rowmax )
339 CALL
zswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
340 DO 20 j = kp + 1, kk - 1
341 t = dconjg( a( j, kk ) )
342 a( j, kk ) = dconjg( a( kp, j ) )
345 a( kp, kk ) = dconjg( a( kp, kk ) )
346 r1 = dble( a( kk, kk ) )
347 a( kk, kk ) = dble( a( kp, kp ) )
349 IF( kstep.EQ.2 )
THEN
350 a( k, k ) = dble( a( k, k ) )
352 a( k-1, k ) = a( kp, k )
356 a( k, k ) = dble( a( k, k ) )
358 $ a( k-1, k-1 ) = dble( a( k-1, k-1 ) )
363 IF( kstep.EQ.1 )
THEN
375 r1 = one / dble( a( k, k ) )
376 CALL
zher( uplo, k-1, -r1, a( 1, k ), 1, a, lda )
380 CALL
zdscal( k-1, r1, a( 1, k ), 1 )
397 d =
dlapy2( dble( a( k-1, k ) ),
398 $ dimag( a( k-1, k ) ) )
399 d22 = dble( a( k-1, k-1 ) ) / d
400 d11 = dble( a( k, k ) ) / d
401 tt = one / ( d11*d22-one )
402 d12 = a( k-1, k ) / d
405 DO 40 j = k - 2, 1, -1
406 wkm1 = d*( d11*a( j, k-1 )-dconjg( d12 )*
408 wk = d*( d22*a( j, k )-d12*a( j, k-1 ) )
410 a( i, j ) = a( i, j ) - a( i, k )*dconjg( wk ) -
411 $ a( i, k-1 )*dconjg( wkm1 )
415 a( j, j ) = dcmplx( dble( a( j, j ) ), 0.0d+0 )
425 IF( kstep.EQ.1 )
THEN
456 absakk = abs( dble( a( k, k ) ) )
462 imax = k +
izamax( n-k, a( k+1, k ), 1 )
463 colmax = cabs1( a( imax, k ) )
468 IF( (max( absakk, colmax ).EQ.zero) .OR.
disnan(absakk) )
THEN
475 a( k, k ) = dble( a( k, k ) )
477 IF( absakk.GE.alpha*colmax )
THEN
487 jmax = k - 1 +
izamax( imax-k, a( imax, k ), lda )
488 rowmax = cabs1( a( imax, jmax ) )
490 jmax = imax +
izamax( n-imax, a( imax+1, imax ), 1 )
491 rowmax = max( rowmax, cabs1( a( jmax, imax ) ) )
494 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
499 ELSE IF( abs( dble( a( imax, imax ) ) ).GE.alpha*rowmax )
523 $ CALL
zswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
524 DO 60 j = kk + 1, kp - 1
525 t = dconjg( a( j, kk ) )
526 a( j, kk ) = dconjg( a( kp, j ) )
529 a( kp, kk ) = dconjg( a( kp, kk ) )
530 r1 = dble( a( kk, kk ) )
531 a( kk, kk ) = dble( a( kp, kp ) )
533 IF( kstep.EQ.2 )
THEN
534 a( k, k ) = dble( a( k, k ) )
536 a( k+1, k ) = a( kp, k )
540 a( k, k ) = dble( a( k, k ) )
542 $ a( k+1, k+1 ) = dble( a( k+1, k+1 ) )
547 IF( kstep.EQ.1 )
THEN
561 r1 = one / dble( a( k, k ) )
562 CALL
zher( uplo, n-k, -r1, a( k+1, k ), 1,
563 $ a( k+1, k+1 ), lda )
567 CALL
zdscal( n-k, r1, a( k+1, k ), 1 )
583 d =
dlapy2( dble( a( k+1, k ) ),
584 $ dimag( a( k+1, k ) ) )
585 d11 = dble( a( k+1, k+1 ) ) / d
586 d22 = dble( a( k, k ) ) / d
587 tt = one / ( d11*d22-one )
588 d21 = a( k+1, k ) / d
592 wk = d*( d11*a( j, k )-d21*a( j, k+1 ) )
593 wkp1 = d*( d22*a( j, k+1 )-dconjg( d21 )*
596 a( i, j ) = a( i, j ) - a( i, k )*dconjg( wk ) -
597 $ a( i, k+1 )*dconjg( wkp1 )
601 a( j, j ) = dcmplx( dble( a( j, j ) ), 0.0d+0 )
609 IF( kstep.EQ.1 )
THEN