156 SUBROUTINE ssptrf( UPLO, N, AP, IPIV, INFO )
175 parameter( zero = 0.0e+0, one = 1.0e+0 )
177 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
181 INTEGER I, IMAX, J, JMAX, K, KC, KK, KNC, KP, KPC,
183 REAL ABSAKK, ALPHA, COLMAX, D11, D12, D21, D22, R1,
184 $ ROWMAX, T, WK, WKM1, WKP1
189 EXTERNAL lsame, isamax
195 INTRINSIC abs, max, sqrt
202 upper = lsame( uplo,
'U' )
203 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
205 ELSE IF( n.LT.0 )
THEN
209 CALL xerbla(
'SSPTRF', -info )
215 alpha = ( one+sqrt( sevten ) ) / eight
225 kc = ( n-1 )*n / 2 + 1
238 absakk = abs( ap( kc+k-1 ) )
244 imax = isamax( k-1, ap( kc ), 1 )
245 colmax = abs( ap( kc+imax-1 ) )
250 IF( max( absakk, colmax ).EQ.zero )
THEN
258 IF( absakk.GE.alpha*colmax )
THEN
267 kx = imax*( imax+1 ) / 2 + imax
268 DO 20 j = imax + 1, k
269 IF( abs( ap( kx ) ).GT.rowmax )
THEN
270 rowmax = abs( ap( kx ) )
275 kpc = ( imax-1 )*imax / 2 + 1
277 jmax = isamax( imax-1, ap( kpc ), 1 )
278 rowmax = max( rowmax, abs( ap( kpc+jmax-1 ) ) )
281 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
286 ELSE IF( abs( ap( kpc+imax-1 ) ).GE.alpha*rowmax )
THEN
310 CALL sswap( kp-1, ap( knc ), 1, ap( kpc ), 1 )
312 DO 30 j = kp + 1, kk - 1
315 ap( knc+j-1 ) = ap( kx )
319 ap( knc+kk-1 ) = ap( kpc+kp-1 )
321 IF( kstep.EQ.2 )
THEN
323 ap( kc+k-2 ) = ap( kc+kp-1 )
330 IF( kstep.EQ.1 )
THEN
342 r1 = one / ap( kc+k-1 )
343 CALL sspr( uplo, k-1, -r1, ap( kc ), 1, ap )
347 CALL sscal( k-1, r1, ap( kc ), 1 )
364 d12 = ap( k-1+( k-1 )*k / 2 )
365 d22 = ap( k-1+( k-2 )*( k-1 ) / 2 ) / d12
366 d11 = ap( k+( k-1 )*k / 2 ) / d12
367 t = one / ( d11*d22-one )
370 DO 50 j = k - 2, 1, -1
371 wkm1 = d12*( d11*ap( j+( k-2 )*( k-1 ) / 2 )-
372 $ ap( j+( k-1 )*k / 2 ) )
373 wk = d12*( d22*ap( j+( k-1 )*k / 2 )-
374 $ ap( j+( k-2 )*( k-1 ) / 2 ) )
376 ap( i+( j-1 )*j / 2 ) = ap( i+( j-1 )*j / 2 ) -
377 $ ap( i+( k-1 )*k / 2 )*wk -
378 $ ap( i+( k-2 )*( k-1 ) / 2 )*wkm1
380 ap( j+( k-1 )*k / 2 ) = wk
381 ap( j+( k-2 )*( k-1 ) / 2 ) = wkm1
391 IF( kstep.EQ.1 )
THEN
426 absakk = abs( ap( kc ) )
432 imax = k + isamax( n-k, ap( kc+1 ), 1 )
433 colmax = abs( ap( kc+imax-k ) )
438 IF( max( absakk, colmax ).EQ.zero )
THEN
446 IF( absakk.GE.alpha*colmax )
THEN
458 DO 70 j = k, imax - 1
459 IF( abs( ap( kx ) ).GT.rowmax )
THEN
460 rowmax = abs( ap( kx ) )
465 kpc = npp - ( n-imax+1 )*( n-imax+2 ) / 2 + 1
467 jmax = imax + isamax( n-imax, ap( kpc+1 ), 1 )
468 rowmax = max( rowmax, abs( ap( kpc+jmax-imax ) ) )
471 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
476 ELSE IF( abs( ap( kpc ) ).GE.alpha*rowmax )
THEN
494 $ knc = knc + n - k + 1
501 $
CALL sswap( n-kp, ap( knc+kp-kk+1 ), 1, ap( kpc+1 ),
504 DO 80 j = kk + 1, kp - 1
507 ap( knc+j-kk ) = ap( kx )
511 ap( knc ) = ap( kpc )
513 IF( kstep.EQ.2 )
THEN
515 ap( kc+1 ) = ap( kc+kp-k )
522 IF( kstep.EQ.1 )
THEN
537 CALL sspr( uplo, n-k, -r1, ap( kc+1 ), 1,
542 CALL sscal( n-k, r1, ap( kc+1 ), 1 )
563 d21 = ap( k+1+( k-1 )*( 2*n-k ) / 2 )
564 d11 = ap( k+1+k*( 2*n-k-1 ) / 2 ) / d21
565 d22 = ap( k+( k-1 )*( 2*n-k ) / 2 ) / d21
566 t = one / ( d11*d22-one )
570 wk = d21*( d11*ap( j+( k-1 )*( 2*n-k ) / 2 )-
571 $ ap( j+k*( 2*n-k-1 ) / 2 ) )
572 wkp1 = d21*( d22*ap( j+k*( 2*n-k-1 ) / 2 )-
573 $ ap( j+( k-1 )*( 2*n-k ) / 2 ) )
576 ap( i+( j-1 )*( 2*n-j ) / 2 ) = ap( i+( j-1 )*
577 $ ( 2*n-j ) / 2 ) - ap( i+( k-1 )*( 2*n-k ) /
578 $ 2 )*wk - ap( i+k*( 2*n-k-1 ) / 2 )*wkp1
581 ap( j+( k-1 )*( 2*n-k ) / 2 ) = wk
582 ap( j+k*( 2*n-k-1 ) / 2 ) = wkp1
591 IF( kstep.EQ.1 )
THEN
subroutine xerbla(srname, info)
subroutine sspr(uplo, n, alpha, x, incx, ap)
SSPR
subroutine ssptrf(uplo, n, ap, ipiv, info)
SSPTRF
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sswap(n, sx, incx, sy, incy)
SSWAP