1 SUBROUTINE pzqrt16( 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 RWORK( * )
17 COMPLEX*16 A( * ), B( * ), X( * )
181 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
182 $ lld_, mb_, m_, nb_, n_, rsrc_
183 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
184 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
185 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
186 DOUBLE PRECISION ZERO, ONE
187 parameter( zero = 0.0d+0, one = 1.0d+0 )
189 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
192 INTEGER ICTXT, IDUMM, J, MYCOL, MYROW, N1, N2, NPCOL,
194 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
197 DOUBLE PRECISION TEMP( 2 )
201 DOUBLE PRECISION PDLAMCH, PZLANGE
202 EXTERNAL lsame, pdlamch,
pdlange
205 EXTERNAL blacs_gridinfo, dgamx2d, pdzasum,
215 ictxt = desca( ctxt_ )
216 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
220 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.EQ.0 )
THEN
225 IF( lsame( trans,
'T' ) .OR. lsame( trans,
'C' ) )
THEN
226 anorm = pzlange(
'I', m, n, a, ia, ja, desca, rwork )
230 anorm = pzlange(
'1', m, n, a, ia, ja, desca, rwork )
235 eps = pdlamch( ictxt,
'Epsilon' )
240 CALL pzgemm( trans,
'No transpose', n1, nrhs, n2, -cone, a, ia,
241 $ ja, desca, x, ix, jx, descx, cone, b, ib, jb, descb )
250 CALL pdzasum( n1, bnorm, b, ib, jb+j-1, descb, 1 )
251 CALL pdzasum( n2, xnorm, x, ix, jx+j-1, descx, 1 )
259 CALL dgamx2d( ictxt,
'All',
' ', 2, 1, temp, 2, idumm, idumm,
266 IF( anorm.EQ.zero .AND. bnorm.EQ.zero )
THEN
268 ELSE IF( anorm.LE.zero .OR. xnorm.LE.zero )
THEN
271 resid =
max( resid, ( ( bnorm / anorm ) / xnorm ) /
272 $ (
max( m, n )*eps ) )