250 REAL A( LDA, * ), E( * )
257 parameter( zero = 0.0e+0, one = 1.0e+0 )
259 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
263 INTEGER I, IMAX, J, JMAX, ITEMP, K, KK, KP, KSTEP,
265 REAL ABSAKK, ALPHA, COLMAX, D11, D12, D21, D22,
266 $ ROWMAX, STEMP, T, WK, WKM1, WKP1, SFMIN
272 EXTERNAL lsame, isamax, slamch
278 INTRINSIC abs, max, sqrt
285 upper = lsame( uplo,
'U' )
286 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
288 ELSE IF( n.LT.0 )
THEN
290 ELSE IF( lda.LT.max( 1, n ) )
THEN
294 CALL xerbla(
'SSYTF2_RK', -info )
300 alpha = ( one+sqrt( sevten ) ) / eight
304 sfmin = slamch(
'S' )
331 absakk = abs( a( k, k ) )
338 imax = isamax( k-1, a( 1, k ), 1 )
339 colmax = abs( a( imax, k ) )
344 IF( (max( absakk, colmax ).EQ.zero) )
THEN
364 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
385 jmax = imax + isamax( k-imax, a( imax, imax+1 ),
387 rowmax = abs( a( imax, jmax ) )
393 itemp = isamax( imax-1, a( 1, imax ), 1 )
394 stemp = abs( a( itemp, imax ) )
395 IF( stemp.GT.rowmax )
THEN
404 IF( .NOT.( abs( a( imax, imax ) ).LT.alpha*rowmax ) )
416 ELSE IF( ( p.EQ.jmax ).OR.( rowmax.LE.colmax ) )
THEN
435 IF( .NOT. done )
GOTO 12
443 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
449 $
CALL sswap( p-1, a( 1, k ), 1, a( 1, p ), 1 )
451 $
CALL sswap( k-p-1, a( p+1, k ), 1, a( p, p+1 ),
454 a( k, k ) = a( p, p )
461 $
CALL sswap( n-k, a( k, k+1 ), lda, a( p, k+1 ),
475 $
CALL sswap( kp-1, a( 1, kk ), 1, a( 1, kp ), 1 )
476 IF( ( kk.GT.1 ) .AND. ( kp.LT.(kk-1) ) )
477 $
CALL sswap( kk-kp-1, a( kp+1, kk ), 1, a( kp,
481 a( kk, kk ) = a( kp, kp )
483 IF( kstep.EQ.2 )
THEN
485 a( k-1, k ) = a( kp, k )
493 $
CALL sswap( n-k, a( kk, k+1 ), lda, a( kp, k+1 ),
500 IF( kstep.EQ.1 )
THEN
513 IF( abs( a( k, k ) ).GE.sfmin )
THEN
519 d11 = one / a( k, k )
520 CALL ssyr( uplo, k-1, -d11, a( 1, k ), 1, a,
525 CALL sscal( k-1, d11, a( 1, k ), 1 )
532 a( ii, k ) = a( ii, k ) / d11
540 CALL ssyr( uplo, k-1, -d11, a( 1, k ), 1, a,
569 d22 = a( k-1, k-1 ) / d12
570 d11 = a( k, k ) / d12
571 t = one / ( d11*d22-one )
573 DO 30 j = k - 2, 1, -1
575 wkm1 = t*( d11*a( j, k-1 )-a( j, k ) )
576 wk = t*( d22*a( j, k )-a( j, k-1 ) )
579 a( i, j ) = a( i, j ) - (a( i, k ) / d12 )*wk -
580 $ ( a( i, k-1 ) / d12 )*wkm1
586 a( j, k-1 ) = wkm1 / d12
607 IF( kstep.EQ.1 )
THEN
645 absakk = abs( a( k, k ) )
652 imax = k + isamax( n-k, a( k+1, k ), 1 )
653 colmax = abs( a( imax, k ) )
658 IF( ( max( absakk, colmax ).EQ.zero ) )
THEN
678 IF( .NOT.( absakk.LT.alpha*colmax ) )
THEN
699 jmax = k - 1 + isamax( imax-k, a( imax, k ),
701 rowmax = abs( a( imax, jmax ) )
707 itemp = imax + isamax( n-imax, a( imax+1,
710 stemp = abs( a( itemp, imax ) )
711 IF( stemp.GT.rowmax )
THEN
720 IF( .NOT.( abs( a( imax, imax ) ).LT.alpha*rowmax ) )
732 ELSE IF( ( p.EQ.jmax ).OR.( rowmax.LE.colmax ) )
THEN
751 IF( .NOT. done )
GOTO 42
759 IF( ( kstep.EQ.2 ) .AND. ( p.NE.k ) )
THEN
765 $
CALL sswap( n-p, a( p+1, k ), 1, a( p+1, p ), 1 )
767 $
CALL sswap( p-k-1, a( k+1, k ), 1, a( p, k+1 ),
770 a( k, k ) = a( p, p )
777 $
CALL sswap( k-1, a( k, 1 ), lda, a( p, 1 ), lda )
790 $
CALL sswap( n-kp, a( kp+1, kk ), 1, a( kp+1, kp ),
792 IF( ( kk.LT.n ) .AND. ( kp.GT.(kk+1) ) )
793 $
CALL sswap( kp-kk-1, a( kk+1, kk ), 1, a( kp,
797 a( kk, kk ) = a( kp, kp )
799 IF( kstep.EQ.2 )
THEN
801 a( k+1, k ) = a( kp, k )
809 $
CALL sswap( k-1, a( kk, 1 ), lda, a( kp, 1 ), lda )
815 IF( kstep.EQ.1 )
THEN
828 IF( abs( a( k, k ) ).GE.sfmin )
THEN
834 d11 = one / a( k, k )
835 CALL ssyr( uplo, n-k, -d11, a( k+1, k ), 1,
836 $ a( k+1, k+1 ), lda )
840 CALL sscal( n-k, d11, a( k+1, k ), 1 )
847 a( ii, k ) = a( ii, k ) / d11
855 CALL ssyr( uplo, n-k, -d11, a( k+1, k ), 1,
856 $ a( k+1, k+1 ), lda )
885 d11 = a( k+1, k+1 ) / d21
886 d22 = a( k, k ) / d21
887 t = one / ( d11*d22-one )
893 wk = t*( d11*a( j, k )-a( j, k+1 ) )
894 wkp1 = t*( d22*a( j, k+1 )-a( j, k ) )
899 a( i, j ) = a( i, j ) - ( a( i, k ) / d21 )*wk -
900 $ ( a( i, k+1 ) / d21 )*wkp1
906 a( j, k+1 ) = wkp1 / d21
927 IF( kstep.EQ.1 )
THEN