134 SUBROUTINE cpst01( UPLO, N, A, LDA, AFAC, LDAFAC, PERM, LDPERM,
135 $ PIV, RWORK, RESID, RANK )
143 INTEGER LDA, LDAFAC, LDPERM, N, RANK
147 COMPLEX A( LDA, * ), AFAC( LDAFAC, * ),
157 parameter( zero = 0.0e+0, one = 1.0e+0 )
159 parameter( czero = ( 0.0e+0, 0.0e+0 ) )
170 EXTERNAL cdotc, clanhe, slamch, lsame
176 INTRINSIC aimag, conjg, real
189 eps = slamch(
'Epsilon' )
190 anorm = clanhe(
'1', uplo, n, a, lda, rwork )
191 IF( anorm.LE.zero )
THEN
200 IF( aimag( afac( j, j ) ).NE.zero )
THEN
208 IF( lsame( uplo,
'U' ) )
THEN
211 DO 120 j = rank + 1, n
212 DO 110 i = rank + 1, j
222 tr = real( cdotc( k, afac( 1, k ), 1, afac( 1, k ), 1 ) )
227 CALL ctrmv(
'Upper',
'Conjugate',
'Non-unit', k-1, afac,
228 $ ldafac, afac( 1, k ), 1 )
237 DO 150 j = rank + 1, n
249 $
CALL cher(
'Lower', n-k, one, afac( k+1, k ), 1,
250 $ afac( k+1, k+1 ), ldafac )
255 CALL cscal( n-k+1, tc, afac( k, k ), 1 )
262 IF( lsame( uplo,
'U' ) )
THEN
266 IF( piv( i ).LE.piv( j ) )
THEN
268 perm( piv( i ), piv( j ) ) = afac( i, j )
270 perm( piv( i ), piv( j ) ) = conjg( afac( j, i ) )
281 IF( piv( i ).GE.piv( j ) )
THEN
283 perm( piv( i ), piv( j ) ) = afac( i, j )
285 perm( piv( i ), piv( j ) ) = conjg( afac( j, i ) )
295 IF( lsame( uplo,
'U' ) )
THEN
298 perm( i, j ) = perm( i, j ) - a( i, j )
300 perm( j, j ) = perm( j, j ) - real( a( j, j ) )
304 perm( j, j ) = perm( j, j ) - real( a( j, j ) )
306 perm( i, j ) = perm( i, j ) - a( i, j )
314 resid = clanhe(
'1', uplo, n, perm, ldafac, rwork )
316 resid = ( ( resid / real( n ) ) / anorm ) / eps
subroutine cpst01(uplo, n, a, lda, afac, ldafac, perm, ldperm, piv, rwork, resid, rank)
CPST01