140 SUBROUTINE dpstf2( UPLO, N, A, LDA, PIV, RANK, TOL, WORK, INFO )
148 INTEGER INFO, LDA, N, RANK
152 DOUBLE PRECISION A( LDA, * ), WORK( 2*N )
159 DOUBLE PRECISION ONE, ZERO
160 parameter( one = 1.0d+0, zero = 0.0d+0 )
163 DOUBLE PRECISION AJJ, DSTOP, DTEMP
164 INTEGER I, ITEMP, J, PVT
168 DOUBLE PRECISION DLAMCH
169 LOGICAL LSAME, DISNAN
170 EXTERNAL dlamch, lsame, disnan
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(
'DPSTF2', -info )
212 IF( a( i, i ).GT.ajj )
THEN
217 IF( ajj.LE.zero.OR.disnan( ajj ) )
THEN
225 IF( tol.LT.zero )
THEN
226 dstop = n * dlamch(
'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.dstop.OR.disnan( ajj ) )
THEN
270 a( pvt, pvt ) = a( j, j )
271 CALL dswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
273 $
CALL dswap( n-pvt, a( j, pvt+1 ), lda,
274 $ a( pvt, pvt+1 ), lda )
275 CALL dswap( 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 dgemv(
'Trans', j-1, n-j, -one, a( 1, j+1 ), lda,
294 $ a( 1, j ), 1, one, a( j, j+1 ), lda )
295 CALL dscal( 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.dstop.OR.disnan( ajj ) )
THEN
333 a( pvt, pvt ) = a( j, j )
334 CALL dswap( j-1, a( j, 1 ), lda, a( pvt, 1 ), lda )
336 $
CALL dswap( n-pvt, a( pvt+1, j ), 1, a( pvt+1, pvt ),
338 CALL dswap( 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 dgemv(
'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 dscal( n-j, one / ajj, a( j+1, j ), 1 )
subroutine xerbla(srname, info)
subroutine dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
DGEMV
subroutine dpstf2(uplo, n, a, lda, piv, rank, tol, work, info)
DPSTF2 computes the Cholesky factorization with complete pivoting of a real symmetric positive semide...
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine dswap(n, dx, incx, dy, incy)
DSWAP