142 SUBROUTINE spstf2( UPLO, N, A, LDA, PIV, RANK, TOL, WORK, INFO )
151 INTEGER INFO, LDA, N, RANK
155 REAL A( lda, * ), WORK( 2*n )
163 parameter ( one = 1.0e+0, zero = 0.0e+0 )
166 REAL AJJ, SSTOP, STEMP
167 INTEGER I, ITEMP, J, PVT
172 LOGICAL LSAME, SISNAN
173 EXTERNAL slamch, lsame, sisnan
179 INTRINSIC max, sqrt, maxloc
186 upper = lsame( uplo,
'U' )
187 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
189 ELSE IF( n.LT.0 )
THEN
191 ELSE IF( lda.LT.max( 1, n ) )
THEN
195 CALL xerbla(
'SPSTF2', -info )
215 IF( a( i, i ).GT.ajj )
THEN
220 IF( ajj.LE.zero.OR.sisnan( ajj ) )
THEN
228 IF( tol.LT.zero )
THEN
229 sstop = n * slamch(
'Epsilon' ) * ajj
253 work( i ) = work( i ) + a( j-1, i )**2
255 work( n+i ) = a( i, i ) - work( i )
260 itemp = maxloc( work( (n+j):(2*n) ), 1 )
263 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
273 a( pvt, pvt ) = a( j, j )
274 CALL sswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
276 $
CALL sswap( n-pvt, a( j, pvt+1 ), lda,
277 $ a( pvt, pvt+1 ), lda )
278 CALL sswap( pvt-j-1, a( j, j+1 ), lda, a( j+1, pvt ), 1 )
283 work( j ) = work( pvt )
286 piv( pvt ) = piv( j )
296 CALL sgemv(
'Trans', j-1, n-j, -one, a( 1, j+1 ), lda,
297 $ a( 1, j ), 1, one, a( j, j+1 ), lda )
298 CALL sscal( n-j, one / ajj, a( j, j+1 ), lda )
316 work( i ) = work( i ) + a( i, j-1 )**2
318 work( n+i ) = a( i, i ) - work( i )
323 itemp = maxloc( work( (n+j):(2*n) ), 1 )
326 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
336 a( pvt, pvt ) = a( j, j )
337 CALL sswap( j-1, a( j, 1 ), lda, a( pvt, 1 ), lda )
339 $
CALL sswap( n-pvt, a( pvt+1, j ), 1, a( pvt+1, pvt ),
341 CALL sswap( pvt-j-1, a( j+1, j ), 1, a( pvt, j+1 ), lda )
346 work( j ) = work( pvt )
349 piv( pvt ) = piv( j )
359 CALL sgemv(
'No Trans', n-j, j-1, -one, a( j+1, 1 ), lda,
360 $ a( j, 1 ), lda, one, a( j+1, j ), 1 )
361 CALL sscal( n-j, one / ajj, a( j+1, j ), 1 )
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 xerbla(SRNAME, INFO)
XERBLA
subroutine sgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGEMV
subroutine sscal(N, SA, SX, INCX)
SSCAL
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP