1 SUBROUTINE pddblaschk( 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
15 DOUBLE PRECISION ANORM, RESID
18 INTEGER DESCA( * ), DESCX( * )
19 DOUBLE PRECISION A( * ), WORK( * ), X( * )
164 DOUBLE PRECISION ZERO, ONE
165 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+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
179 INTEGER BW, INFO, IPPRODUCT, WORK_MIN
180 DOUBLE PRECISION DIVISOR, EPS, RESID1, NORMX
185 EXTERNAL blacs_gridinfo, dgamx2d, dgebr2d,
186 $ dgebs2d, dgemm, dgerv2d, dgesd2d,
190 INTEGER IDAMAX, NUMROC
191 DOUBLE PRECISION PDLAMCH
192 EXTERNAL idamax, numroc, pdlamch
195 INTRINSIC abs, dble,
max,
min, mod
201 ictxt = desca( ctxt_ )
204 IF( lsame( symm,
'S' ) )
THEN
206 work_min =
max(5,
max(
max(bwl,bwu)*(
max(bwl,bwu)+2),nb))+2*nb
209 work_min =
max(5,
max(
max(bwl,bwu)*(
max(bwl,bwu)+2),nb))+2*nb
212 IF ( worksiz .LT. work_min )
THEN
213 CALL pxerbla( ictxt,
'PDBLASCHK', -18 )
217 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
219 eps = pdlamch( ictxt,
'eps' )
221 divisor = anorm * eps * dble( n )
223 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
225 CALL infog2l( ix, jx, descx, nprow, npcol, myrow, mycol, iix, jjx,
227 np = numroc( (bwl+bwu+1), desca( mb_ ), myrow, 0, nprow )
228 nq = numroc( n, desca( nb_ ), mycol, 0, npcol )
231 ipproduct = 1 + desca( nb_ )
232 ipw = 1 + 2*desca( nb_ )
238 IF( lsame( symm,
'S' ))
THEN
239 CALL pdbmatgen( ictxt, uplo,
'D', bw, bw, n, bw+1,
240 $ desca( nb_ ), a, desca( lld_ ), 0, 0,
241 $ iaseed, myrow, mycol, nprow, npcol )
244 CALL pdbmatgen( ictxt,
'N', uplo, bwl, bwu, n,
245 $ desca( mb_ ), desca( nb_ ), a,
246 $ desca( lld_ ), 0, 0, iaseed, myrow,
247 $ mycol, nprow, npcol )
259 CALL pdgbdcmv( bwl+bwu+1, bwl, bwu, trans, n, a, 1, desca,
260 $ 1, x( 1 + (j-1)*descx( lld_ )), 1, descx,
261 $ work( ipproduct ), work( ipw ),
262 $ (
max(bwl,bwu)+2)*
max(bwl,bwu), info )
267 CALL pdmatgen( descx( ctxt_ ),
'No',
'No', descx( m_ ),
268 $ descx( n_ ), descx( mb_ ), descx( nb_ ),
269 $ work( ipb ), descx( lld_ ), descx( rsrc_ ),
270 $ descx( csrc_ ), ibseed, 0, nq, j-1, 1, mycol,
271 $ myrow, npcol, nprow )
275 CALL pdaxpy( n, -one, work( ipproduct ), 1, 1, descx, 1,
276 $ work( ipb ), 1, 1, descx, 1 )
278 CALL pdnrm2( n, normx,
279 $ x, 1, j, descx, 1 )
281 CALL pdnrm2( n, resid1,
282 $ work( ipb ), 1, 1, descx, 1 )
287 resid1 = resid1 / ( normx*divisor )
289 resid =
max( resid, resid1 )