1 SUBROUTINE pdqrt16( TRANS, M, N, NRHS, A, IA, JA, DESCA, X, IX,
2 $ JX, DESCX, B, IB, JB, DESCB, RWORK, RESID )
11 INTEGER IA, IB, IX, JA, JB, JX, M, N, NRHS
12 DOUBLE PRECISION RESID
15 INTEGER DESCA( * ), DESCB( * ), DESCX( * )
16 DOUBLE PRECISION A( * ), B( * ), RWORK( * ), X( * )
180 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
181 $ lld_, mb_, m_, nb_, n_, rsrc_
182 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
183 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
184 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
185 DOUBLE PRECISION ZERO, ONE
186 parameter( zero = 0.0d+0, one = 1.0d+0 )
189 INTEGER ICTXT, IDUMM, J, MYCOL, MYROW, N1, N2, NPCOL,
191 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
194 DOUBLE PRECISION TEMP( 2 )
198 DOUBLE PRECISION PDLAMCH, PDLANGE
199 EXTERNAL lsame, pdlamch, pdlange
202 EXTERNAL blacs_gridinfo, dgamx2d, pdasum, pdgemm
211 ictxt = desca( ctxt_ )
212 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
216 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.EQ.0 )
THEN
221 IF( lsame( trans,
'T' ) .OR. lsame( trans,
'C' ) )
THEN
222 anorm = pdlange(
'I', m, n, a, ia, ja, desca, rwork )
226 anorm = pdlange(
'1', m, n, a, ia, ja, desca, rwork )
231 eps = pdlamch( ictxt,
'Epsilon' )
236 CALL pdgemm( trans,
'No transpose', n1, nrhs, n2, -one, a, ia,
237 $ ja, desca, x, ix, jx, descx, one, b, ib, jb, descb )
246 CALL pdasum( n1, bnorm, b, ib, jb+j-1, descb, 1 )
247 CALL pdasum( n2, xnorm, x, ix, jx+j-1, descx, 1 )
255 CALL dgamx2d( ictxt,
'All',
' ', 2, 1, temp, 2, idumm, idumm,
262 IF( anorm.EQ.zero .AND. bnorm.EQ.zero )
THEN
264 ELSE IF( anorm.LE.zero .OR. xnorm.LE.zero )
THEN
267 resid =
max( resid, ( ( bnorm / anorm ) / xnorm ) /
268 $ (
max( m, n )*eps ) )