1 SUBROUTINE pcdtlaschk( 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 COMPLEX A( * ), WORK( * ), X( * )
165 PARAMETER ( ONE = ( 1.0e+0, 0.0e+0 ),
166 $ zero = ( 0.0e+0, 0.0e+0 ) )
167 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
168 $ LLD_, MB_, M_, NB_, N_, RSRC_
169 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
170 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
171 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
173 PARAMETER ( INT_ONE = 1 )
176 INTEGER IACOL, IAROW, ICTXT,
177 $ IIA, IIX, IPB, IPW,
178 $ ixcol, ixrow, j, jja, jjx, lda,
179 $ mycol, myrow, nb, np, npcol, nprow, nq
181 INTEGER BW, INFO, IPPRODUCT, WORK_MIN
182 REAL DIVISOR, EPS, RESID1, NORMX
187 EXTERNAL blacs_gridinfo, cgamx2d, cgemm, cgsum2d,
189 $ sgebs2d, sgerv2d, sgesd2d
192 INTEGER ICAMAX, NUMROC
194 EXTERNAL icamax, numroc, pslamch
197 INTRINSIC abs,
max,
min, mod, real
203 ictxt = desca( ctxt_ )
206 IF( lsame( symm,
'H' ) )
THEN
209 work_min =
max(5,nb)+2*nb
212 IF( lsame( uplo,
'D' ))
THEN
217 work_min =
max(5,nb)+2*nb
220 IF ( worksiz .LT. work_min )
THEN
221 CALL pxerbla( ictxt,
'PCTLASCHK', -18 )
225 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
227 eps = pslamch( ictxt,
'eps' )
229 divisor = anorm * eps * real( n )
231 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
233 CALL infog2l( ix, jx, descx, nprow, npcol, myrow, mycol, iix, jjx,
235 np = numroc( (3), desca( mb_ ), myrow, 0, nprow )
236 nq = numroc( n, desca( nb_ ), mycol, 0, npcol )
239 ipproduct = 1 + desca( nb_ )
240 ipw = 1 + 2*desca( nb_ )
246 IF( lsame( symm,
'H' ))
THEN
247 CALL pcbmatgen( ictxt, uplo,
'D', bw, bw, n, bw+1,
248 $ desca( nb_ ), a, desca( lld_ ), 0, 0,
249 $ iaseed, myrow, mycol, nprow, npcol )
252 CALL pcbmatgen( ictxt,
'N', uplo, bwl, bwu, n,
253 $ desca( mb_ ), desca( nb_ ), a,
254 $ desca( lld_ ), 0, 0, iaseed, myrow,
255 $ mycol, nprow, npcol )
263 IF( mycol.GT.0 )
THEN
264 CALL cgesd2d( ictxt, 1, 1, a( start+2), lda,
268 IF( mycol.LT.npcol-1 )
THEN
269 CALL cgesd2d( ictxt, 1, 1,
270 $ a( start+( desca( nb_ )-1 )*lda ),
271 $ lda, myrow, mycol+1 )
276 DO 220 i=0,desca( nb_ )-1
277 a( start+2+(i)*lda ) = a( start+2+(i+1)*lda )
280 DO 230 i=desca( nb_ )-1,0,-1
281 a( start+(i+1)*lda ) = a( start+(i)*lda )
286 IF( mycol.LT.npcol-1 )
THEN
287 CALL cgerv2d( ictxt, 1, 1,
288 $ a( start+2+( desca( nb_ )-1 )*lda ),
289 $ lda, myrow, mycol+1 )
292 IF( mycol.GT.0 )
THEN
293 CALL cgerv2d( ictxt, 1, 1, a( start), lda,
306 CALL pcgbdcmv( bwl+bwu+1, bwl, bwu, trans, n, a, 1, desca,
307 $ 1, x( 1 + (j-1)*descx( lld_ )), 1, descx,
308 $ work( ipproduct ), work( ipw ),
309 $ (int_one+2)*int_one, info )
314 CALL pcmatgen( descx( ctxt_ ),
'No',
'No', descx( m_ ),
315 $ descx( n_ ), descx( mb_ ), descx( nb_ ),
316 $ work( ipb ), descx( lld_ ), descx( rsrc_ ),
317 $ descx( csrc_ ), ibseed, 0, nq, j-1, 1, mycol,
318 $ myrow, npcol, nprow )
322 CALL pcaxpy( n, -one, work( ipproduct ), 1, 1, descx, 1,
323 $ work( ipb ), 1, 1, descx, 1 )
325 CALL pscnrm2( n, normx,
326 $ x, 1, j, descx, 1 )
328 CALL pscnrm2( n, resid1,
329 $ work( ipb ), 1, 1, descx, 1 )
334 resid1 = resid1 / ( normx*divisor )
336 resid =
max( resid, resid1 )