141 SUBROUTINE zpstrf( UPLO, N, A, LDA, PIV, RANK, TOL, WORK, INFO )
149 INTEGER INFO, LDA, N, RANK
153 COMPLEX*16 A( LDA, * )
154 DOUBLE PRECISION WORK( 2*N )
161 DOUBLE PRECISION ONE, ZERO
162 parameter( one = 1.0d+0, zero = 0.0d+0 )
164 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
168 DOUBLE PRECISION AJJ, DSTOP, DTEMP
169 INTEGER I, ITEMP, J, JB, K, NB, PVT
173 DOUBLE PRECISION DLAMCH
175 LOGICAL LSAME, DISNAN
176 EXTERNAL dlamch, ilaenv, lsame, disnan
183 INTRINSIC dble, dconjg, max, min, sqrt, maxloc
190 upper = lsame( uplo,
'U' )
191 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
193 ELSE IF( n.LT.0 )
THEN
195 ELSE IF( lda.LT.max( 1, n ) )
THEN
199 CALL xerbla(
'ZPSTRF', -info )
210 nb = ilaenv( 1,
'ZPOTRF', uplo, n, -1, -1, -1 )
211 IF( nb.LE.1 .OR. nb.GE.n )
THEN
215 CALL zpstf2( uplo, n, a( 1, 1 ), lda, piv, rank, tol, work,
230 work( i ) = dble( a( i, i ) )
232 pvt = maxloc( work( 1:n ), 1 )
233 ajj = dble( a( pvt, pvt ) )
234 IF( ajj.LE.zero.OR.disnan( ajj ) )
THEN
242 IF( tol.LT.zero )
THEN
243 dstop = n * dlamch(
'Epsilon' ) * ajj
257 jb = min( nb, n-k+1 )
266 DO 150 j = k, k + jb - 1
275 work( i ) = work( i ) +
276 $ dble( dconjg( a( j-1, i ) )*
279 work( n+i ) = dble( a( i, i ) ) - work( i )
284 itemp = maxloc( work( (n+j):(2*n) ), 1 )
287 IF( ajj.LE.dstop.OR.disnan( ajj ) )
THEN
297 a( pvt, pvt ) = a( j, j )
298 CALL zswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
300 $
CALL zswap( n-pvt, a( j, pvt+1 ), lda,
301 $ a( pvt, pvt+1 ), lda )
302 DO 140 i = j + 1, pvt - 1
303 ztemp = dconjg( a( j, i ) )
304 a( j, i ) = dconjg( a( i, pvt ) )
307 a( j, pvt ) = dconjg( a( j, pvt ) )
312 work( j ) = work( pvt )
315 piv( pvt ) = piv( j )
325 CALL zlacgv( j-1, a( 1, j ), 1 )
326 CALL zgemv(
'Trans', j-k, n-j, -cone, a( k, j+1 ),
327 $ lda, a( k, j ), 1, cone, a( j, j+1 ),
329 CALL zlacgv( j-1, a( 1, j ), 1 )
330 CALL zdscal( n-j, one / ajj, a( j, j+1 ), lda )
338 CALL zherk(
'Upper',
'Conj Trans', n-j+1, jb, -one,
339 $ a( k, j ), lda, one, a( j, j ), lda )
352 jb = min( nb, n-k+1 )
361 DO 200 j = k, k + jb - 1
370 work( i ) = work( i ) +
371 $ dble( dconjg( a( i, j-1 ) )*
374 work( n+i ) = dble( a( i, i ) ) - work( i )
379 itemp = maxloc( work( (n+j):(2*n) ), 1 )
382 IF( ajj.LE.dstop.OR.disnan( ajj ) )
THEN
392 a( pvt, pvt ) = a( j, j )
393 CALL zswap( j-1, a( j, 1 ), lda, a( pvt, 1 ), lda )
395 $
CALL zswap( n-pvt, a( pvt+1, j ), 1,
396 $ a( pvt+1, pvt ), 1 )
397 DO 190 i = j + 1, pvt - 1
398 ztemp = dconjg( a( i, j ) )
399 a( i, j ) = dconjg( a( pvt, i ) )
402 a( pvt, j ) = dconjg( a( pvt, j ) )
408 work( j ) = work( pvt )
411 piv( pvt ) = piv( j )
421 CALL zlacgv( j-1, a( j, 1 ), lda )
422 CALL zgemv(
'No Trans', n-j, j-k, -cone,
423 $ a( j+1, k ), lda, a( j, k ), lda, cone,
425 CALL zlacgv( j-1, a( j, 1 ), lda )
426 CALL zdscal( n-j, one / ajj, a( j+1, j ), 1 )
434 CALL zherk(
'Lower',
'No Trans', n-j+1, jb, -one,
435 $ a( j, k ), lda, one, a( j, j ), lda )
subroutine xerbla(srname, info)
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
subroutine zherk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
ZHERK
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
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 zdscal(n, da, zx, incx)
ZDSCAL
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP