140 SUBROUTINE spstf2( UPLO, N, A, LDA, PIV, RANK, TOL, WORK, INFO )
148 INTEGER INFO, LDA, N, RANK
152 REAL A( LDA, * ), WORK( 2*N )
160 parameter( one = 1.0e+0, zero = 0.0e+0 )
163 REAL AJJ, SSTOP, STEMP
164 INTEGER I, ITEMP, J, PVT
169 LOGICAL LSAME, SISNAN
170 EXTERNAL slamch, lsame, sisnan
176 INTRINSIC max, sqrt, maxloc
183 upper = lsame( uplo,
'U' )
184 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
186 ELSE IF( n.LT.0 )
THEN
188 ELSE IF( lda.LT.max( 1, n ) )
THEN
192 CALL xerbla(
'SPSTF2', -info )
212 IF( a( i, i ).GT.ajj )
THEN
217 IF( ajj.LE.zero.OR.sisnan( ajj ) )
THEN
225 IF( tol.LT.zero )
THEN
226 sstop = n * slamch(
'Epsilon' ) * ajj
250 work( i ) = work( i ) + a( j-1, i )**2
252 work( n+i ) = a( i, i ) - work( i )
257 itemp = maxloc( work( (n+j):(2*n) ), 1 )
260 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
270 a( pvt, pvt ) = a( j, j )
271 CALL sswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
273 $
CALL sswap( n-pvt, a( j, pvt+1 ), lda,
274 $ a( pvt, pvt+1 ), lda )
275 CALL sswap( pvt-j-1, a( j, j+1 ), lda, a( j+1, pvt ), 1 )
280 work( j ) = work( pvt )
283 piv( pvt ) = piv( j )
293 CALL sgemv(
'Trans', j-1, n-j, -one, a( 1, j+1 ), lda,
294 $ a( 1, j ), 1, one, a( j, j+1 ), lda )
295 CALL sscal( n-j, one / ajj, a( j, j+1 ), lda )
313 work( i ) = work( i ) + a( i, j-1 )**2
315 work( n+i ) = a( i, i ) - work( i )
320 itemp = maxloc( work( (n+j):(2*n) ), 1 )
323 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
333 a( pvt, pvt ) = a( j, j )
334 CALL sswap( j-1, a( j, 1 ), lda, a( pvt, 1 ), lda )
336 $
CALL sswap( n-pvt, a( pvt+1, j ), 1, a( pvt+1, pvt ),
338 CALL sswap( pvt-j-1, a( j+1, j ), 1, a( pvt, j+1 ), lda )
343 work( j ) = work( pvt )
346 piv( pvt ) = piv( j )
356 CALL sgemv(
'No Trans', n-j, j-1, -one, a( j+1, 1 ), lda,
357 $ a( j, 1 ), lda, one, a( j+1, j ), 1 )
358 CALL sscal( n-j, one / ajj, a( j+1, j ), 1 )
subroutine xerbla(srname, info)
subroutine sgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
SGEMV
subroutine spstf2(uplo, n, a, lda, piv, rank, tol, work, info)
SPSTF2 computes the Cholesky factorization with complete pivoting of a real symmetric positive semide...
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sswap(n, sx, incx, sy, incy)
SSWAP