138 SUBROUTINE dpstf2( UPLO, N, A, LDA, PIV, RANK, TOL, WORK,
147 INTEGER INFO, LDA, N, RANK
151 DOUBLE PRECISION A( LDA, * ), WORK( 2*N )
158 DOUBLE PRECISION ONE, ZERO
159 parameter( one = 1.0d+0, zero = 0.0d+0 )
162 DOUBLE PRECISION AJJ, DSTOP, DTEMP
163 INTEGER I, ITEMP, J, PVT
167 DOUBLE PRECISION DLAMCH
168 LOGICAL LSAME, DISNAN
169 EXTERNAL dlamch, lsame, disnan
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(
'DPSTF2', -info )
211 IF( a( i, i ).GT.ajj )
THEN
216 IF( ajj.LE.zero.OR.disnan( ajj ) )
THEN
224 IF( tol.LT.zero )
THEN
225 dstop = n * dlamch(
'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.dstop.OR.disnan( ajj ) )
THEN
269 a( pvt, pvt ) = a( j, j )
270 CALL dswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
272 $
CALL dswap( n-pvt, a( j, pvt+1 ), lda,
273 $ a( pvt, pvt+1 ), lda )
274 CALL dswap( pvt-j-1, a( j, j+1 ), lda, a( j+1, pvt ),
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,
339 CALL dswap( pvt-j-1, a( j+1, j ), 1, a( pvt, j+1 ),
345 work( j ) = work( pvt )
348 piv( pvt ) = piv( j )
358 CALL dgemv(
'No Trans', n-j, j-1, -one, a( j+1, 1 ),
360 $ a( j, 1 ), lda, one, a( j+1, j ), 1 )
361 CALL dscal( n-j, one / ajj, a( j+1, j ), 1 )
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...