1 SUBROUTINE pdptlaschk( SYMM, UPLO, N, BWL, BWU, NRHS, X, IX, JX,
2 $ DESCX, IASEED, A, IA, JA, DESCA, IBSEED,
3 $ ANORM, RESID, WORK, WORKSIZ )
13 INTEGER BWL, BWU, IA, IASEED, IBSEED,
14 $ ix, ja, jx, n, nrhs, worksiz
15 DOUBLE PRECISION ANORM, RESID
18 INTEGER DESCA( * ), DESCX( * )
19 DOUBLE PRECISION A( * ), WORK( * ), X( * )
161 DOUBLE PRECISION ZERO, ONE
162 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0 )
163 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
164 $ lld_, mb_, m_, nb_, n_, rsrc_
165 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
166 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
167 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
169 PARAMETER ( INT_ONE = 1 )
172 INTEGER IACOL, IAROW, ICTXT,
173 $ IIA, IIX, IPB, IPW,
174 $ ixcol, ixrow, j, jja, jjx, lda,
175 $ mycol, myrow, nb, np, npcol, nprow, nq
177 INTEGER BW, INFO, IPPRODUCT, WORK_MIN
178 DOUBLE PRECISION DIVISOR, EPS, RESID1, NORMX
183 EXTERNAL blacs_gridinfo, dgamx2d, dgebr2d,
184 $ dgebs2d, dgemm, dgerv2d, dgesd2d,
188 INTEGER IDAMAX, NUMROC
189 DOUBLE PRECISION PDLAMCH
190 EXTERNAL idamax, numroc, pdlamch
193 INTRINSIC abs, dble,
max,
min, mod
199 ictxt = desca( ctxt_ )
202 IF( lsame( symm,
'S' ) )
THEN
205 work_min =
max(5,nb)+2*nb
208 IF( lsame( uplo,
'D' ))
THEN
213 work_min =
max(5,nb)+2*nb
216 IF ( worksiz .LT. work_min )
THEN
217 CALL pxerbla( ictxt,
'PDTLASCHK', -18 )
221 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
223 eps = pdlamch( ictxt,
'eps' )
225 divisor = anorm * eps * dble( n )
227 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
229 CALL infog2l( ix, jx, descx, nprow, npcol, myrow, mycol, iix, jjx,
231 np = numroc( (2), desca( mb_ ), myrow, 0, nprow )
232 nq = numroc( n, desca( nb_ ), mycol, 0, npcol )
235 ipproduct = 1 + desca( nb_ )
236 ipw = 1 + 2*desca( nb_ )
242 IF( lsame( symm,
'S' ))
THEN
243 CALL pdbmatgen( ictxt, uplo,
'D', bw, bw, n, bw+1,
244 $ desca( nb_ ), a, desca( lld_ ), 0, 0,
245 $ iaseed, myrow, mycol, nprow, npcol )
248 CALL pdbmatgen( ictxt,
'N', uplo, bwl, bwu, n,
249 $ desca( mb_ ), desca( nb_ ), a,
250 $ desca( lld_ ), 0, 0, iaseed, myrow,
251 $ mycol, nprow, npcol )
253 IF( lsame( uplo,
'U' ) )
THEN
261 IF( mycol.LT.npcol-1 )
THEN
262 CALL dgesd2d( ictxt, 1, 1,
263 $ a( start+( desca( nb_ )-1 )*lda ),
264 $ lda, myrow, mycol+1 )
269 DO 230 i=desca( nb_ )-1,0,-1
270 a( start+(i+1)*lda ) = a( start+(i)*lda )
275 IF( mycol.GT.0 )
THEN
276 CALL dgerv2d( ictxt, 1, 1, a( start), lda,
291 CALL pdpbdcmv( bw+1, bw, uplo, n, a, 1, desca,
292 $ 1, x( 1 + (j-1)*descx( lld_ )), 1, descx,
293 $ work( ipproduct ), work( ipw ), (bw+2)*bw, info )
298 CALL pdmatgen( descx( ctxt_ ),
'No',
'No', descx( m_ ),
299 $ descx( n_ ), descx( mb_ ), descx( nb_ ),
300 $ work( ipb ), descx( lld_ ), descx( rsrc_ ),
301 $ descx( csrc_ ), ibseed, 0, nq, j-1, 1, mycol,
302 $ myrow, npcol, nprow )
306 CALL pdaxpy( n, -one, work( ipproduct ), 1, 1, descx, 1,
307 $ work( ipb ), 1, 1, descx, 1 )
309 CALL pdnrm2( n, normx,
310 $ x, 1, j, descx, 1 )
312 CALL pdnrm2( n, resid1,
313 $ work( ipb ), 1, 1, descx, 1 )
318 resid1 = resid1 / ( normx*divisor )
320 resid =
max( resid, resid1 )