1 SUBROUTINE pcptlaschk( 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
18 INTEGER DESCA( * ), DESCX( * )
19 COMPLEX A( * ), WORK( * ), X( * )
162 PARAMETER ( ONE = ( 1.0e+0, 0.0e+0 ),
163 $ zero = ( 0.0e+0, 0.0e+0 ) )
164 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
165 $ LLD_, MB_, M_, NB_, N_, RSRC_
166 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
167 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
168 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
170 PARAMETER ( INT_ONE = 1 )
173 INTEGER IACOL, IAROW, ICTXT,
174 $ IIA, IIX, IPB, IPW,
175 $ ixcol, ixrow, j, jja, jjx, lda,
176 $ mycol, myrow, nb, np, npcol, nprow, nq
178 INTEGER BW, INFO, IPPRODUCT, WORK_MIN
179 REAL DIVISOR, EPS, RESID1, NORMX
184 EXTERNAL blacs_gridinfo, cgamx2d, cgemm, cgsum2d,
186 $ sgebs2d, sgerv2d, sgesd2d
189 INTEGER ICAMAX, NUMROC
191 EXTERNAL icamax, numroc, pslamch
194 INTRINSIC abs,
max,
min, mod, real
200 ictxt = desca( ctxt_ )
203 IF( lsame( symm,
'H' ) )
THEN
206 work_min =
max(5,nb)+2*nb
209 IF( lsame( uplo,
'D' ))
THEN
214 work_min =
max(5,nb)+2*nb
217 IF ( worksiz .LT. work_min )
THEN
218 CALL pxerbla( ictxt,
'PCTLASCHK', -18 )
222 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
224 eps = pslamch( ictxt,
'eps' )
226 divisor = anorm * eps * real( n )
228 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
230 CALL infog2l( ix, jx, descx, nprow, npcol, myrow, mycol, iix, jjx,
232 np = numroc( (2), desca( mb_ ), myrow, 0, nprow )
233 nq = numroc( n, desca( nb_ ), mycol, 0, npcol )
236 ipproduct = 1 + desca( nb_ )
237 ipw = 1 + 2*desca( nb_ )
243 IF( lsame( symm,
'H' ))
THEN
244 CALL pcbmatgen( ictxt, uplo,
'D', bw, bw, n, bw+1,
245 $ desca( nb_ ), a, desca( lld_ ), 0, 0,
246 $ iaseed, myrow, mycol, nprow, npcol )
249 CALL pcbmatgen( ictxt,
'N', uplo, bwl, bwu, n,
250 $ desca( mb_ ), desca( nb_ ), a,
251 $ desca( lld_ ), 0, 0, iaseed, myrow,
252 $ mycol, nprow, npcol )
254 IF( lsame( uplo,
'U' ) )
THEN
262 IF( mycol.LT.npcol-1 )
THEN
263 CALL cgesd2d( ictxt, 1, 1,
264 $ a( start+( desca( nb_ )-1 )*lda ),
265 $ lda, myrow, mycol+1 )
270 DO 230 i=desca( nb_ )-1,0,-1
271 a( start+(i+1)*lda ) = a( start+(i)*lda )
276 IF( mycol.GT.0 )
THEN
277 CALL cgerv2d( ictxt, 1, 1, a( start), lda,
292 CALL pcpbdcmv( bw+1, bw, uplo, n, a, 1, desca,
293 $ 1, x( 1 + (j-1)*descx( lld_ )), 1, descx,
294 $ work( ipproduct ), work( ipw ), (bw+2)*bw, info )
299 CALL pcmatgen( descx( ctxt_ ),
'No',
'No', descx( m_ ),
300 $ descx( n_ ), descx( mb_ ), descx( nb_ ),
301 $ work( ipb ), descx( lld_ ), descx( rsrc_ ),
302 $ descx( csrc_ ), ibseed, 0, nq, j-1, 1, mycol,
303 $ myrow, npcol, nprow )
307 CALL pcaxpy( n, -one, work( ipproduct ), 1, 1, descx, 1,
308 $ work( ipb ), 1, 1, descx, 1 )
310 CALL pscnrm2( n, normx,
311 $ x, 1, j, descx, 1 )
313 CALL pscnrm2( n, resid1,
314 $ work( ipb ), 1, 1, descx, 1 )
319 resid1 = resid1 / ( normx*divisor )
321 resid =
max( resid, resid1 )