143 SUBROUTINE zpstrf( UPLO, N, A, LDA, PIV, RANK, TOL, WORK, INFO )
152 INTEGER INFO, LDA, N, RANK
156 COMPLEX*16 A( lda, * )
157 DOUBLE PRECISION WORK( 2*n )
164 DOUBLE PRECISION ONE, ZERO
165 parameter ( one = 1.0d+0, zero = 0.0d+0 )
167 parameter ( cone = ( 1.0d+0, 0.0d+0 ) )
171 DOUBLE PRECISION AJJ, DSTOP, DTEMP
172 INTEGER I, ITEMP, J, JB, K, NB, PVT
176 DOUBLE PRECISION DLAMCH
178 LOGICAL LSAME, DISNAN
179 EXTERNAL dlamch, ilaenv, lsame, disnan
186 INTRINSIC dble, dconjg, max, min, sqrt, maxloc
193 upper = lsame( uplo,
'U' )
194 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
196 ELSE IF( n.LT.0 )
THEN
198 ELSE IF( lda.LT.max( 1, n ) )
THEN
202 CALL xerbla(
'ZPSTRF', -info )
213 nb = ilaenv( 1,
'ZPOTRF', uplo, n, -1, -1, -1 )
214 IF( nb.LE.1 .OR. nb.GE.n )
THEN
218 CALL zpstf2( uplo, n, a( 1, 1 ), lda, piv, rank, tol, work,
233 work( i ) = dble( a( i, i ) )
235 pvt = maxloc( work( 1:n ), 1 )
236 ajj = dble( a( pvt, pvt ) )
237 IF( ajj.LE.zero.OR.disnan( ajj ) )
THEN
245 IF( tol.LT.zero )
THEN
246 dstop = n * dlamch(
'Epsilon' ) * ajj
260 jb = min( nb, n-k+1 )
269 DO 150 j = k, k + jb - 1
278 work( i ) = work( i ) +
279 $ dble( dconjg( a( j-1, i ) )*
282 work( n+i ) = dble( a( i, i ) ) - work( i )
287 itemp = maxloc( work( (n+j):(2*n) ), 1 )
290 IF( ajj.LE.dstop.OR.disnan( ajj ) )
THEN
300 a( pvt, pvt ) = a( j, j )
301 CALL zswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
303 $
CALL zswap( n-pvt, a( j, pvt+1 ), lda,
304 $ a( pvt, pvt+1 ), lda )
305 DO 140 i = j + 1, pvt - 1
306 ztemp = dconjg( a( j, i ) )
307 a( j, i ) = dconjg( a( i, pvt ) )
310 a( j, pvt ) = dconjg( a( j, pvt ) )
315 work( j ) = work( pvt )
318 piv( pvt ) = piv( j )
328 CALL zlacgv( j-1, a( 1, j ), 1 )
329 CALL zgemv(
'Trans', j-k, n-j, -cone, a( k, j+1 ),
330 $ lda, a( k, j ), 1, cone, a( j, j+1 ),
332 CALL zlacgv( j-1, a( 1, j ), 1 )
333 CALL zdscal( n-j, one / ajj, a( j, j+1 ), lda )
341 CALL zherk(
'Upper',
'Conj Trans', n-j+1, jb, -one,
342 $ a( k, j ), lda, one, a( j, j ), lda )
355 jb = min( nb, n-k+1 )
364 DO 200 j = k, k + jb - 1
373 work( i ) = work( i ) +
374 $ dble( dconjg( a( i, j-1 ) )*
377 work( n+i ) = dble( a( i, i ) ) - work( i )
382 itemp = maxloc( work( (n+j):(2*n) ), 1 )
385 IF( ajj.LE.dstop.OR.disnan( ajj ) )
THEN
395 a( pvt, pvt ) = a( j, j )
396 CALL zswap( j-1, a( j, 1 ), lda, a( pvt, 1 ), lda )
398 $
CALL zswap( n-pvt, a( pvt+1, j ), 1,
399 $ a( pvt+1, pvt ), 1 )
400 DO 190 i = j + 1, pvt - 1
401 ztemp = dconjg( a( i, j ) )
402 a( i, j ) = dconjg( a( pvt, i ) )
405 a( pvt, j ) = dconjg( a( pvt, j ) )
411 work( j ) = work( pvt )
414 piv( pvt ) = piv( j )
424 CALL zlacgv( j-1, a( j, 1 ), lda )
425 CALL zgemv(
'No Trans', n-j, j-k, -cone,
426 $ a( j+1, k ), lda, a( j, k ), lda, cone,
428 CALL zlacgv( j-1, a( j, 1 ), lda )
429 CALL zdscal( n-j, one / ajj, a( j+1, j ), 1 )
437 CALL zherk(
'Lower',
'No Trans', n-j+1, jb, -one,
438 $ a( j, k ), lda, one, a( j, j ), lda )
subroutine zgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
ZGEMV
subroutine zswap(N, ZX, INCX, ZY, INCY)
ZSWAP
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine zpstf2(UPLO, N, A, LDA, PIV, RANK, TOL, WORK, INFO)
ZPSTF2 computes the Cholesky factorization with complete pivoting of a complex Hermitian positive sem...
subroutine zpstrf(UPLO, N, A, LDA, PIV, RANK, TOL, WORK, INFO)
ZPSTRF computes the Cholesky factorization with complete pivoting of a complex Hermitian positive sem...
subroutine zherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
ZHERK
subroutine zdscal(N, DA, ZX, INCX)
ZDSCAL
subroutine zlacgv(N, X, INCX)
ZLACGV conjugates a complex vector.