138 SUBROUTINE spstf2( UPLO, N, A, LDA, PIV, RANK, TOL, WORK,
147 INTEGER INFO, LDA, N, RANK
151 REAL A( LDA, * ), WORK( 2*N )
159 parameter( one = 1.0e+0, zero = 0.0e+0 )
162 REAL AJJ, SSTOP, STEMP
163 INTEGER I, ITEMP, J, PVT
168 LOGICAL LSAME, SISNAN
169 EXTERNAL slamch, lsame, sisnan
175 INTRINSIC max, sqrt, maxloc
182 upper = lsame( uplo,
'U' )
183 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
185 ELSE IF( n.LT.0 )
THEN
187 ELSE IF( lda.LT.max( 1, n ) )
THEN
191 CALL xerbla(
'SPSTF2', -info )
211 IF( a( i, i ).GT.ajj )
THEN
216 IF( ajj.LE.zero.OR.sisnan( ajj ) )
THEN
224 IF( tol.LT.zero )
THEN
225 sstop = real( n ) * slamch(
'Epsilon' ) * ajj
249 work( i ) = work( i ) + a( j-1, i )**2
251 work( n+i ) = a( i, i ) - work( i )
256 itemp = maxloc( work( (n+j):(2*n) ), 1 )
259 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
269 a( pvt, pvt ) = a( j, j )
270 CALL sswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
272 $
CALL sswap( n-pvt, a( j, pvt+1 ), lda,
273 $ a( pvt, pvt+1 ), lda )
274 CALL sswap( pvt-j-1, a( j, j+1 ), lda, a( j+1, pvt ),
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,
339 CALL sswap( pvt-j-1, a( j+1, j ), 1, a( pvt, j+1 ),
345 work( j ) = work( pvt )
348 piv( pvt ) = piv( j )
358 CALL sgemv(
'No Trans', n-j, j-1, -one, a( j+1, 1 ),
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...