1 SUBROUTINE psdtlaschk( SYMM, UPLO, TRANS, N, BWL, BWU, NRHS, X,
2 $ IX, JX, DESCX, IASEED, A, IA, JA, DESCA,
3 $ IBSEED, ANORM, RESID, WORK, WORKSIZ )
12 CHARACTER SYMM, TRANS, UPLO
13 INTEGER BWL, BWU, IA, IASEED, IBSEED,
14 $ ix, ja, jx, n, nrhs, worksiz
18 INTEGER DESCA( * ), DESCX( * )
19 REAL A( * ), WORK( * ), X( * )
165 PARAMETER ( ONE = 1.0e+0, zero = 0.0e+0 )
166 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
167 $ lld_, mb_, m_, nb_, n_, rsrc_
168 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
169 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
170 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
172 PARAMETER ( INT_ONE = 1 )
175 INTEGER IACOL, IAROW, ICTXT,
176 $ IIA, IIX, IPB, IPW,
177 $ ixcol, ixrow, j, jja, jjx, lda,
178 $ mycol, myrow, nb, np, npcol, nprow, nq
180 INTEGER BW, INFO, IPPRODUCT, WORK_MIN
181 REAL DIVISOR, EPS, RESID1, NORMX
187 $ sgamx2d, sgebr2d, sgebs2d, sgemm,
188 $ sgerv2d, sgesd2d, sgsum2d, slaset
191 INTEGER ISAMAX, NUMROC
193 EXTERNAL isamax, numroc, pslamch
196 INTRINSIC abs,
max,
min, mod, real
202 ictxt = desca( ctxt_ )
205 IF( lsame( symm,
'S' ) )
THEN
208 work_min =
max(5,nb)+2*nb
211 IF( lsame( uplo,
'D' ))
THEN
216 work_min =
max(5,nb)+2*nb
219 IF ( worksiz .LT. work_min )
THEN
220 CALL pxerbla( ictxt,
'PSTLASCHK', -18 )
224 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
226 eps = pslamch( ictxt,
'eps' )
228 divisor = anorm * eps * real( n )
230 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
232 CALL infog2l( ix, jx, descx, nprow, npcol, myrow, mycol, iix, jjx,
234 np = numroc( (3), desca( mb_ ), myrow, 0, nprow )
235 nq = numroc( n, desca( nb_ ), mycol, 0, npcol )
238 ipproduct = 1 + desca( nb_ )
239 ipw = 1 + 2*desca( nb_ )
245 IF( lsame( symm,
'S' ))
THEN
246 CALL psbmatgen( ictxt, uplo,
'D', bw, bw, n, bw+1,
247 $ desca( nb_ ), a, desca( lld_ ), 0, 0,
248 $ iaseed, myrow, mycol, nprow, npcol )
251 CALL psbmatgen( ictxt,
'N', uplo, bwl, bwu, n,
252 $ desca( mb_ ), desca( nb_ ), a,
253 $ desca( lld_ ), 0, 0, iaseed, myrow,
254 $ mycol, nprow, npcol )
262 IF( mycol.GT.0 )
THEN
263 CALL sgesd2d( ictxt, 1, 1, a( start+2), lda,
267 IF( mycol.LT.npcol-1 )
THEN
268 CALL sgesd2d( ictxt, 1, 1,
269 $ a( start+( desca( nb_ )-1 )*lda ),
270 $ lda, myrow, mycol+1 )
275 DO 220 i=0,desca( nb_ )-1
276 a( start+2+(i)*lda ) = a( start+2+(i+1)*lda )
279 DO 230 i=desca( nb_ )-1,0,-1
280 a( start+(i+1)*lda ) = a( start+(i)*lda )
285 IF( mycol.LT.npcol-1 )
THEN
286 CALL sgerv2d( ictxt, 1, 1,
287 $ a( start+2+( desca( nb_ )-1 )*lda ),
288 $ lda, myrow, mycol+1 )
291 IF( mycol.GT.0 )
THEN
292 CALL sgerv2d( ictxt, 1, 1, a( start), lda,
305 CALL psgbdcmv( bwl+bwu+1, bwl, bwu, trans, n, a, 1, desca,
306 $ 1, x( 1 + (j-1)*descx( lld_ )), 1, descx,
307 $ work( ipproduct ), work( ipw ),
308 $ (int_one+2)*int_one, info )
313 CALL psmatgen( descx( ctxt_ ),
'No',
'No', descx( m_ ),
314 $ descx( n_ ), descx( mb_ ), descx( nb_ ),
315 $ work( ipb ), descx( lld_ ), descx( rsrc_ ),
316 $ descx( csrc_ ), ibseed, 0, nq, j-1, 1, mycol,
317 $ myrow, npcol, nprow )
321 CALL psaxpy( n, -one, work( ipproduct ), 1, 1, descx, 1,
322 $ work( ipb ), 1, 1, descx, 1 )
324 CALL psnrm2( n, normx,
325 $ x, 1, j, descx, 1 )
327 CALL psnrm2( n, resid1,
328 $ work( ipb ), 1, 1, descx, 1 )
333 resid1 = resid1 / ( normx*divisor )
335 resid =
max( resid, resid1 )