1 REAL FUNCTION cqrt17( TRANS, IRESID, M, N, NRHS, A,
2 $ lda, x, ldx, b, ldb, c, work, lwork )
10 INTEGER iresid, lda, ldb, ldx, lwork, m, n, nrhs
13 COMPLEX a( lda, * ), b( ldb, * ), c( ldb, * ),
14 $ work( lwork ), x( ldx, * )
89 parameter( zero = 0.0e0, one = 1.0e0 )
92 INTEGER info, iscl, ncols, nrows
93 REAL bignum, err, norma, normb, normrs, normx,
102 EXTERNAL lsame, clange, slamch
108 INTRINSIC cmplx,
max, real
114 IF( lsame(
trans,
'N' ) )
THEN
117 ELSE IF( lsame(
trans,
'C' ) )
THEN
121 CALL
xerbla(
'CQRT17', 1 )
125 IF( lwork.LT.ncols*nrhs )
THEN
126 CALL
xerbla(
'CQRT17', 13 )
130 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.LE.0 )
133 norma = clange(
'One-norm', m, n, a, lda, rwork )
134 smlnum = slamch(
'Safe minimum' ) / slamch(
'Precision' )
135 bignum = one / smlnum
140 CALL clacpy(
'All', nrows, nrhs, b, ldb, c, ldb )
141 CALL cgemm(
trans,
'No transpose', nrows, nrhs, ncols,
142 $ cmplx( -one ), a, lda, x, ldx, cmplx( one ), c, ldb )
143 normrs = clange(
'Max', nrows, nrhs, c, ldb, rwork )
144 IF( normrs.GT.smlnum )
THEN
146 CALL
clascl(
'General', 0, 0, normrs, one, nrows, nrhs, c, ldb,
152 CALL cgemm(
'Conjugate transpose',
trans, nrhs, ncols, nrows,
153 $ cmplx( one ), c, ldb, a, lda, cmplx( zero ), work,
158 err = clange(
'One-norm', nrhs, ncols, work, nrhs, rwork )
165 IF( iresid.EQ.1 )
THEN
166 normb = clange(
'One-norm', nrows, nrhs, b, ldb, rwork )
170 normx = clange(
'One-norm', ncols, nrhs, x, ldx, rwork )
175 cqrt17 = err / ( slamch(
'Epsilon' )*
REAL( MAX( M, N, NRHS ) ) )