1 REAL FUNCTION sqrt17( 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 REAL 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, slamch, slange
114 IF( lsame(
trans,
'N' ) )
THEN
117 ELSE IF( lsame(
trans,
'T' ) )
THEN
121 CALL
xerbla(
'SQRT17', 1 )
125 IF( lwork.LT.ncols*nrhs )
THEN
126 CALL
xerbla(
'SQRT17', 13 )
130 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.LE.0 )
THEN
134 norma = slange(
'One-norm', m, n, a, lda, rwork )
135 smlnum = slamch(
'Safe minimum' ) / slamch(
'Precision' )
136 bignum = one / smlnum
141 CALL slacpy(
'All', nrows, nrhs, b, ldb, c, ldb )
142 CALL sgemm(
trans,
'No transpose', nrows, nrhs, ncols, -one, a,
143 $ lda, x, ldx, one, c, ldb )
144 normrs = slange(
'Max', nrows, nrhs, c, ldb, rwork )
145 IF( normrs.GT.smlnum )
THEN
147 CALL
slascl(
'General', 0, 0, normrs, one, nrows, nrhs, c, ldb,
153 CALL sgemm(
'Transpose',
trans, nrhs, ncols, nrows, one, c, ldb,
154 $ a, lda, zero, work, nrhs )
158 err = slange(
'One-norm', nrhs, ncols, work, nrhs, rwork )
165 IF( iresid.EQ.1 )
THEN
166 normb = slange(
'One-norm', nrows, nrhs, b, ldb, rwork )
170 normx = slange(
'One-norm', ncols, nrhs, x, ldx, rwork )
175 sqrt17 = err / ( slamch(
'Epsilon' )*
REAL( MAX( M, N, NRHS ) ) )