151 DOUBLE PRECISION FUNCTION zqrt17( TRANS, IRESID, M, N, NRHS, A,
152 $ LDA, X, LDX, B, LDB, C, WORK, LWORK )
160 INTEGER iresid, lda, ldb, ldx, lwork, m, n, nrhs
163 COMPLEX*16 a( lda, * ), b( ldb, * ), c( ldb, * ),
164 $ work( lwork ), x( ldx, * )
170 DOUBLE PRECISION zero, one
171 parameter( zero = 0.0d0, one = 1.0d0 )
174 INTEGER info, iscl, ncols, nrows
175 DOUBLE PRECISION err, norma, normb, normrs, smlnum
178 DOUBLE PRECISION rwork( 1 )
189 INTRINSIC dble, dcmplx, max
195 IF(
lsame( trans,
'N' ) )
THEN
198 ELSE IF(
lsame( trans,
'C' ) )
THEN
202 CALL xerbla(
'ZQRT17', 1 )
206 IF( lwork.LT.ncols*nrhs )
THEN
207 CALL xerbla(
'ZQRT17', 13 )
211 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.LE.0 )
214 norma =
zlange(
'One-norm', m, n, a, lda, rwork )
215 smlnum =
dlamch(
'Safe minimum' ) /
dlamch(
'Precision' )
220 CALL zlacpy(
'All', nrows, nrhs, b, ldb, c, ldb )
221 CALL zgemm( trans,
'No transpose', nrows, nrhs, ncols,
222 $ dcmplx( -one ), a, lda, x, ldx, dcmplx( one ), c,
224 normrs =
zlange(
'Max', nrows, nrhs, c, ldb, rwork )
225 IF( normrs.GT.smlnum )
THEN
227 CALL zlascl(
'General', 0, 0, normrs, one, nrows, nrhs, c, ldb,
233 CALL zgemm(
'Conjugate transpose', trans, nrhs, ncols, nrows,
234 $ dcmplx( one ), c, ldb, a, lda, dcmplx( zero ), work,
239 err =
zlange(
'One-norm', nrhs, ncols, work, nrhs, rwork )
246 IF( iresid.EQ.1 )
THEN
247 normb =
zlange(
'One-norm', nrows, nrhs, b, ldb, rwork )
255 zqrt17 = err / (
dlamch(
'Epsilon' )*dble( max( m, n, nrhs ) ) )
subroutine xerbla(srname, info)
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
double precision function dlamch(cmach)
DLAMCH
double precision function zlange(norm, m, n, a, lda, work)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
logical function lsame(ca, cb)
LSAME
double precision function zqrt17(trans, iresid, m, n, nrhs, a, lda, x, ldx, b, ldb, c, work, lwork)
ZQRT17