158 SUBROUTINE ssptrf( UPLO, N, AP, IPIV, INFO )
178 parameter( zero = 0.0e+0, one = 1.0e+0 )
180 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
184 INTEGER i, imax, j, jmax, k, kc, kk, knc, kp, kpc,
186 REAL absakk, alpha, colmax, d11, d12, d21, d22, r1,
187 $ rowmax, t, wk, wkm1, wkp1
198 INTRINSIC abs, max, sqrt
205 upper =
lsame( uplo,
'U' )
206 IF( .NOT.upper .AND. .NOT.
lsame( uplo,
'L' ) )
THEN
208 ELSE IF( n.LT.0 )
THEN
212 CALL
xerbla(
'SSPTRF', -info )
218 alpha = ( one+sqrt( sevten ) ) / eight
228 kc = ( n-1 )*n / 2 + 1
241 absakk = abs( ap( kc+k-1 ) )
247 imax =
isamax( k-1, ap( kc ), 1 )
248 colmax = abs( ap( kc+imax-1 ) )
253 IF( max( absakk, colmax ).EQ.zero )
THEN
261 IF( absakk.GE.alpha*colmax )
THEN
270 kx = imax*( imax+1 ) / 2 + imax
271 DO 20 j = imax + 1, k
272 IF( abs( ap( kx ) ).GT.rowmax )
THEN
273 rowmax = abs( ap( kx ) )
278 kpc = ( imax-1 )*imax / 2 + 1
280 jmax =
isamax( imax-1, ap( kpc ), 1 )
281 rowmax = max( rowmax, abs( ap( kpc+jmax-1 ) ) )
284 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
289 ELSE IF( abs( ap( kpc+imax-1 ) ).GE.alpha*rowmax )
THEN
313 CALL
sswap( kp-1, ap( knc ), 1, ap( kpc ), 1 )
315 DO 30 j = kp + 1, kk - 1
318 ap( knc+j-1 ) = ap( kx )
322 ap( knc+kk-1 ) = ap( kpc+kp-1 )
324 IF( kstep.EQ.2 )
THEN
326 ap( kc+k-2 ) = ap( kc+kp-1 )
333 IF( kstep.EQ.1 )
THEN
345 r1 = one / ap( kc+k-1 )
346 CALL
sspr( uplo, k-1, -r1, ap( kc ), 1, ap )
350 CALL
sscal( k-1, r1, ap( kc ), 1 )
367 d12 = ap( k-1+( k-1 )*k / 2 )
368 d22 = ap( k-1+( k-2 )*( k-1 ) / 2 ) / d12
369 d11 = ap( k+( k-1 )*k / 2 ) / d12
370 t = one / ( d11*d22-one )
373 DO 50 j = k - 2, 1, -1
374 wkm1 = d12*( d11*ap( j+( k-2 )*( k-1 ) / 2 )-
375 $ ap( j+( k-1 )*k / 2 ) )
376 wk = d12*( d22*ap( j+( k-1 )*k / 2 )-
377 $ ap( j+( k-2 )*( k-1 ) / 2 ) )
379 ap( i+( j-1 )*j / 2 ) = ap( i+( j-1 )*j / 2 ) -
380 $ ap( i+( k-1 )*k / 2 )*wk -
381 $ ap( i+( k-2 )*( k-1 ) / 2 )*wkm1
383 ap( j+( k-1 )*k / 2 ) = wk
384 ap( j+( k-2 )*( k-1 ) / 2 ) = wkm1
394 IF( kstep.EQ.1 )
THEN
429 absakk = abs( ap( kc ) )
435 imax = k +
isamax( n-k, ap( kc+1 ), 1 )
436 colmax = abs( ap( kc+imax-k ) )
441 IF( max( absakk, colmax ).EQ.zero )
THEN
449 IF( absakk.GE.alpha*colmax )
THEN
461 DO 70 j = k, imax - 1
462 IF( abs( ap( kx ) ).GT.rowmax )
THEN
463 rowmax = abs( ap( kx ) )
468 kpc = npp - ( n-imax+1 )*( n-imax+2 ) / 2 + 1
470 jmax = imax +
isamax( n-imax, ap( kpc+1 ), 1 )
471 rowmax = max( rowmax, abs( ap( kpc+jmax-imax ) ) )
474 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
479 ELSE IF( abs( ap( kpc ) ).GE.alpha*rowmax )
THEN
497 $ knc = knc + n - k + 1
504 $ CALL
sswap( n-kp, ap( knc+kp-kk+1 ), 1, ap( kpc+1 ),
507 DO 80 j = kk + 1, kp - 1
510 ap( knc+j-kk ) = ap( kx )
514 ap( knc ) = ap( kpc )
516 IF( kstep.EQ.2 )
THEN
518 ap( kc+1 ) = ap( kc+kp-k )
525 IF( kstep.EQ.1 )
THEN
540 CALL
sspr( uplo, n-k, -r1, ap( kc+1 ), 1,
545 CALL
sscal( n-k, r1, ap( kc+1 ), 1 )
566 d21 = ap( k+1+( k-1 )*( 2*n-k ) / 2 )
567 d11 = ap( k+1+k*( 2*n-k-1 ) / 2 ) / d21
568 d22 = ap( k+( k-1 )*( 2*n-k ) / 2 ) / d21
569 t = one / ( d11*d22-one )
573 wk = d21*( d11*ap( j+( k-1 )*( 2*n-k ) / 2 )-
574 $ ap( j+k*( 2*n-k-1 ) / 2 ) )
575 wkp1 = d21*( d22*ap( j+k*( 2*n-k-1 ) / 2 )-
576 $ ap( j+( k-1 )*( 2*n-k ) / 2 ) )
579 ap( i+( j-1 )*( 2*n-j ) / 2 ) = ap( i+( j-1 )*
580 $ ( 2*n-j ) / 2 ) - ap( i+( k-1 )*( 2*n-k ) /
581 $ 2 )*wk - ap( i+k*( 2*n-k-1 ) / 2 )*wkp1
584 ap( j+( k-1 )*( 2*n-k ) / 2 ) = wk
585 ap( j+k*( 2*n-k-1 ) / 2 ) = wkp1
594 IF( kstep.EQ.1 )
THEN