141 SUBROUTINE cpstrf( UPLO, N, A, LDA, PIV, RANK, TOL, WORK, INFO )
149 INTEGER INFO, LDA, N, RANK
162 parameter( one = 1.0e+0, zero = 0.0e+0 )
164 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
168 REAL AJJ, SSTOP, STEMP
169 INTEGER I, ITEMP, J, JB, K, NB, PVT
175 LOGICAL LSAME, SISNAN
176 EXTERNAL slamch, ilaenv, lsame, sisnan
183 INTRINSIC conjg, max, min, real, 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(
'CPSTRF', -info )
210 nb = ilaenv( 1,
'CPOTRF', uplo, n, -1, -1, -1 )
211 IF( nb.LE.1 .OR. nb.GE.n )
THEN
215 CALL cpstf2( uplo, n, a( 1, 1 ), lda, piv, rank, tol, work,
230 work( i ) = real( a( i, i ) )
232 pvt = maxloc( work( 1:n ), 1 )
233 ajj = real( a( pvt, pvt ) )
234 IF( ajj.LE.zero.OR.sisnan( ajj ) )
THEN
242 IF( tol.LT.zero )
THEN
243 sstop = n * slamch(
'Epsilon' ) * ajj
257 jb = min( nb, n-k+1 )
266 DO 150 j = k, k + jb - 1
275 work( i ) = work( i ) +
276 $ real( conjg( a( j-1, i ) )*
279 work( n+i ) = real( a( i, i ) ) - work( i )
284 itemp = maxloc( work( (n+j):(2*n) ), 1 )
287 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
297 a( pvt, pvt ) = a( j, j )
298 CALL cswap( j-1, a( 1, j ), 1, a( 1, pvt ), 1 )
300 $
CALL cswap( n-pvt, a( j, pvt+1 ), lda,
301 $ a( pvt, pvt+1 ), lda )
302 DO 140 i = j + 1, pvt - 1
303 ctemp = conjg( a( j, i ) )
304 a( j, i ) = conjg( a( i, pvt ) )
307 a( j, pvt ) = conjg( a( j, pvt ) )
312 work( j ) = work( pvt )
315 piv( pvt ) = piv( j )
325 CALL clacgv( j-1, a( 1, j ), 1 )
326 CALL cgemv(
'Trans', j-k, n-j, -cone, a( k, j+1 ),
327 $ lda, a( k, j ), 1, cone, a( j, j+1 ),
329 CALL clacgv( j-1, a( 1, j ), 1 )
330 CALL csscal( n-j, one / ajj, a( j, j+1 ), lda )
338 CALL cherk(
'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 $ real( conjg( a( i, j-1 ) )*
374 work( n+i ) = real( a( i, i ) ) - work( i )
379 itemp = maxloc( work( (n+j):(2*n) ), 1 )
382 IF( ajj.LE.sstop.OR.sisnan( ajj ) )
THEN
392 a( pvt, pvt ) = a( j, j )
393 CALL cswap( j-1, a( j, 1 ), lda, a( pvt, 1 ), lda )
395 $
CALL cswap( n-pvt, a( pvt+1, j ), 1,
396 $ a( pvt+1, pvt ), 1 )
397 DO 190 i = j + 1, pvt - 1
398 ctemp = conjg( a( i, j ) )
399 a( i, j ) = conjg( a( pvt, i ) )
402 a( pvt, j ) = conjg( a( pvt, j ) )
407 work( j ) = work( pvt )
410 piv( pvt ) = piv( j )
420 CALL clacgv( j-1, a( j, 1 ), lda )
421 CALL cgemv(
'No Trans', n-j, j-k, -cone,
422 $ a( j+1, k ), lda, a( j, k ), lda, cone,
424 CALL clacgv( j-1, a( j, 1 ), lda )
425 CALL csscal( n-j, one / ajj, a( j+1, j ), 1 )
433 CALL cherk(
'Lower',
'No Trans', n-j+1, jb, -one,
434 $ a( j, k ), lda, one, a( j, j ), lda )
subroutine xerbla(srname, info)
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
subroutine cherk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
CHERK
subroutine clacgv(n, x, incx)
CLACGV conjugates a complex vector.
subroutine cpstf2(uplo, n, a, lda, piv, rank, tol, work, info)
CPSTF2 computes the Cholesky factorization with complete pivoting of complex Hermitian positive semid...
subroutine cpstrf(uplo, n, a, lda, piv, rank, tol, work, info)
CPSTRF computes the Cholesky factorization with complete pivoting of complex Hermitian positive semid...
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP