185 SUBROUTINE chetf2( UPLO, N, A, LDA, IPIV, INFO )
204 parameter( zero = 0.0e+0, one = 1.0e+0 )
206 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
210 INTEGER I, IMAX, J, JMAX, K, KK, KP, KSTEP
211 REAL ABSAKK, ALPHA, COLMAX, D, D11, D22, R1, ROWMAX,
213 COMPLEX D12, D21, T, WK, WKM1, WKP1, ZDUM
216 LOGICAL LSAME, SISNAN
219 EXTERNAL lsame, icamax, slapy2, sisnan
225 INTRINSIC abs, aimag, cmplx, conjg, max, real, sqrt
231 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
238 upper = lsame( uplo,
'U' )
239 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
241 ELSE IF( n.LT.0 )
THEN
243 ELSE IF( lda.LT.max( 1, n ) )
THEN
247 CALL xerbla(
'CHETF2', -info )
253 alpha = ( one+sqrt( sevten ) ) / eight
274 absakk = abs( real( a( k, k ) ) )
281 imax = icamax( k-1, a( 1, k ), 1 )
282 colmax = cabs1( a( imax, k ) )
287 IF( (max( absakk, colmax ).EQ.zero) .OR. sisnan(absakk) )
THEN
295 a( k, k ) = real( a( k, k ) )
297 IF( absakk.GE.alpha*colmax )
THEN
307 jmax = imax + icamax( k-imax, a( imax, imax+1 ), lda )
308 rowmax = cabs1( a( imax, jmax ) )
310 jmax = icamax( imax-1, a( 1, imax ), 1 )
311 rowmax = max( rowmax, cabs1( a( jmax, imax ) ) )
314 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
319 ELSE IF( abs( real( a( imax, imax ) ) ).GE.alpha*rowmax )
342 CALL cswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
343 DO 20 j = kp + 1, kk - 1
344 t = conjg( a( j, kk ) )
345 a( j, kk ) = conjg( a( kp, j ) )
348 a( kp, kk ) = conjg( a( kp, kk ) )
349 r1 = real( a( kk, kk ) )
350 a( kk, kk ) = real( a( kp, kp ) )
352 IF( kstep.EQ.2 )
THEN
353 a( k, k ) = real( a( k, k ) )
355 a( k-1, k ) = a( kp, k )
359 a( k, k ) = real( a( k, k ) )
361 $ a( k-1, k-1 ) = real( a( k-1, k-1 ) )
366 IF( kstep.EQ.1 )
THEN
378 r1 = one / real( a( k, k ) )
379 CALL cher( uplo, k-1, -r1, a( 1, k ), 1, a, lda )
383 CALL csscal( k-1, r1, a( 1, k ), 1 )
400 d = slapy2( real( a( k-1, k ) ),
401 $ aimag( a( k-1, k ) ) )
402 d22 = real( a( k-1, k-1 ) ) / d
403 d11 = real( a( k, k ) ) / d
404 tt = one / ( d11*d22-one )
405 d12 = a( k-1, k ) / d
408 DO 40 j = k - 2, 1, -1
409 wkm1 = d*( d11*a( j, k-1 )-conjg( d12 )*a( j, k ) )
410 wk = d*( d22*a( j, k )-d12*a( j, k-1 ) )
412 a( i, j ) = a( i, j ) - a( i, k )*conjg( wk ) -
413 $ a( i, k-1 )*conjg( wkm1 )
417 a( j, j ) = cmplx( real( a( j, j ) ), 0.0e+0 )
427 IF( kstep.EQ.1 )
THEN
458 absakk = abs( real( a( k, k ) ) )
465 imax = k + icamax( n-k, a( k+1, k ), 1 )
466 colmax = cabs1( a( imax, k ) )
471 IF( (max( absakk, colmax ).EQ.zero) .OR. sisnan(absakk) )
THEN
479 a( k, k ) = real( a( k, k ) )
481 IF( absakk.GE.alpha*colmax )
THEN
491 jmax = k - 1 + icamax( imax-k, a( imax, k ), lda )
492 rowmax = cabs1( a( imax, jmax ) )
494 jmax = imax + icamax( n-imax, a( imax+1, imax ), 1 )
495 rowmax = max( rowmax, cabs1( a( jmax, imax ) ) )
498 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
503 ELSE IF( abs( real( a( imax, imax ) ) ).GE.alpha*rowmax )
527 $
CALL cswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ), 1 )
528 DO 60 j = kk + 1, kp - 1
529 t = conjg( a( j, kk ) )
530 a( j, kk ) = conjg( a( kp, j ) )
533 a( kp, kk ) = conjg( a( kp, kk ) )
534 r1 = real( a( kk, kk ) )
535 a( kk, kk ) = real( a( kp, kp ) )
537 IF( kstep.EQ.2 )
THEN
538 a( k, k ) = real( a( k, k ) )
540 a( k+1, k ) = a( kp, k )
544 a( k, k ) = real( a( k, k ) )
546 $ a( k+1, k+1 ) = real( a( k+1, k+1 ) )
551 IF( kstep.EQ.1 )
THEN
565 r1 = one / real( a( k, k ) )
566 CALL cher( uplo, n-k, -r1, a( k+1, k ), 1,
567 $ a( k+1, k+1 ), lda )
571 CALL csscal( n-k, r1, a( k+1, k ), 1 )
587 d = slapy2( real( a( k+1, k ) ),
588 $ aimag( a( k+1, k ) ) )
589 d11 = real( a( k+1, k+1 ) ) / d
590 d22 = real( a( k, k ) ) / d
591 tt = one / ( d11*d22-one )
592 d21 = a( k+1, k ) / d
596 wk = d*( d11*a( j, k )-d21*a( j, k+1 ) )
597 wkp1 = d*( d22*a( j, k+1 )-conjg( d21 )*a( j, k ) )
599 a( i, j ) = a( i, j ) - a( i, k )*conjg( wk ) -
600 $ a( i, k+1 )*conjg( wkp1 )
604 a( j, j ) = cmplx( real( a( j, j ) ), 0.0e+0 )
612 IF( kstep.EQ.1 )
THEN
subroutine xerbla(srname, info)
subroutine cher(uplo, n, alpha, x, incx, a, lda)
CHER
subroutine chetf2(uplo, n, a, lda, ipiv, info)
CHETF2 computes the factorization of a complex Hermitian matrix, using the diagonal pivoting method (...
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP