149 SUBROUTINE ctpt02( UPLO, TRANS, DIAG, N, NRHS, AP, X, LDX, B, LDB,
150 $ work, rwork, resid )
158 CHARACTER diag, trans, uplo
159 INTEGER ldb, ldx, n, nrhs
164 COMPLEX ap( * ), b( ldb, * ), work( * ), x( ldx, * )
171 parameter( zero = 0.0e+0, one = 1.0e+0 )
175 REAL anorm, bnorm, eps, xnorm
192 IF( n.LE.0 .OR. nrhs.LE.0 )
THEN
199 IF(
lsame( trans,
'N' ) )
THEN
200 anorm =
clantp(
'1', uplo, diag, n, ap, rwork )
202 anorm =
clantp(
'I', uplo, diag, n, ap, rwork )
208 IF( anorm.LE.zero )
THEN
218 CALL
ccopy( n, x( 1, j ), 1, work, 1 )
219 CALL
ctpmv( uplo, trans, diag, n, ap, work, 1 )
220 CALL
caxpy( n, cmplx( -one ), b( 1, j ), 1, work, 1 )
221 bnorm =
scasum( n, work, 1 )
222 xnorm =
scasum( n, x( 1, j ), 1 )
223 IF( xnorm.LE.zero )
THEN
226 resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )