140 SUBROUTINE spstrf( 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, JB, K, NB, PVT
170 LOGICAL LSAME, SISNAN
171 EXTERNAL slamch, ilaenv, lsame, sisnan
177 INTRINSIC max, min, sqrt, maxloc
184 upper = lsame( uplo,
'U' )
185 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
187 ELSE IF( n.LT.0 )
THEN
189 ELSE IF( lda.LT.max( 1, n ) )
THEN
193 CALL xerbla(
'SPSTRF', -info )
204 nb = ilaenv( 1,
'SPOTRF', uplo, n, -1, -1, -1 )
205 IF( nb.LE.1 .OR. nb.GE.n )
THEN
209 CALL spstf2( uplo, n, a( 1, 1 ), lda, piv, rank, tol, work,
226 IF( a( i, i ).GT.ajj )
THEN
231 IF( ajj.LE.zero.OR.sisnan( ajj ) )
THEN
239 IF( tol.LT.zero )
THEN
240 sstop = n * slamch(
'Epsilon' ) * ajj
254 jb = min( nb, n-k+1 )
263 DO 130 j = k, k + jb - 1
272 work( i ) = work( i ) + a( j-1, i )**2
274 work( n+i ) = a( i, i ) - work( i )
279 itemp = maxloc( work( (n+j):(2*n) ), 1 )
282 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
292 a( pvt, pvt ) = a( j, j )
293 CALL sswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
295 $
CALL sswap( n-pvt, a( j, pvt+1 ), lda,
296 $ a( pvt, pvt+1 ), lda )
297 CALL sswap( pvt-j-1, a( j, j+1 ), lda,
303 work( j ) = work( pvt )
306 piv( pvt ) = piv( j )
316 CALL sgemv(
'Trans', j-k, n-j, -one, a( k, j+1 ),
317 $ lda, a( k, j ), 1, one, a( j, j+1 ),
319 CALL sscal( n-j, one / ajj, a( j, j+1 ), lda )
327 CALL ssyrk(
'Upper',
'Trans', n-j+1, jb, -one,
328 $ a( k, j ), lda, one, a( j, j ), lda )
341 jb = min( nb, n-k+1 )
350 DO 170 j = k, k + jb - 1
359 work( i ) = work( i ) + a( i, j-1 )**2
361 work( n+i ) = a( i, i ) - work( i )
366 itemp = maxloc( work( (n+j):(2*n) ), 1 )
369 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
379 a( pvt, pvt ) = a( j, j )
380 CALL sswap( j-1, a( j, 1 ), lda, a( pvt, 1 ), lda )
382 $
CALL sswap( n-pvt, a( pvt+1, j ), 1,
383 $ a( pvt+1, pvt ), 1 )
384 CALL sswap( pvt-j-1, a( j+1, j ), 1, a( pvt, j+1 ),
390 work( j ) = work( pvt )
393 piv( pvt ) = piv( j )
403 CALL sgemv(
'No Trans', n-j, j-k, -one,
404 $ a( j+1, k ), lda, a( j, k ), lda, one,
406 CALL sscal( n-j, one / ajj, a( j+1, j ), 1 )
414 CALL ssyrk(
'Lower',
'No Trans', n-j+1, jb, -one,
415 $ a( j, k ), lda, one, a( j, j ), lda )
subroutine xerbla(srname, info)
subroutine sgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
SGEMV
subroutine ssyrk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
SSYRK
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 spstrf(uplo, n, a, lda, piv, rank, tol, work, info)
SPSTRF 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