1 SUBROUTINE pdsdpsubtst( WKNOWN, UPLO, N, THRESH, ABSTOL, A,
2 $ COPYA, Z, IA, JA, DESCA, WIN, WNEW,
3 $ IPREPAD, IPOSTPAD, WORK, LWORK, LWORK1,
5 $ RESULT, TSTNRM, QTQNRM, NOUT )
15 INTEGER IA, IPOSTPAD, IPREPAD, JA, LWORK, LWORK1, N,
16 $ NOUT, RESULT, LIWORK
17 DOUBLE PRECISION ABSTOL, QTQNRM, THRESH, TSTNRM
20 INTEGER DESCA( * ), IWORK( * )
21 DOUBLE PRECISION A( * ), COPYA( * ), WIN( * ), WNEW( * ),
146 INTEGER BLOCK_CYCLIC_2D, DLEN_, DT_, CTXT_, M_, N_,
147 $ MB_, NB_, RSRC_, CSRC_, LLD_
148 PARAMETER ( BLOCK_CYCLIC_2D = 1, dlen_ = 9, dt_ = 1,
149 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
150 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
151 DOUBLE PRECISION FIVE, NEGONE, PADVAL, ZERO
152 parameter( padval = 13.5285d+0, five = 5.0d+0,
153 $ negone = -1.0d+0, zero = 0.0d+0 )
156 INTEGER I, IAM, INFO, ISIZESUBTST, ISIZESYEVX,
157 $ ISIZETST, J, MINSIZE, MQ, MYCOL, MYROW,
158 $ NP, NPCOL, NPROW, NQ, RESAQ, RESQTQ,
159 $ SIZECHK, SIZEMQRLEFT, SIZEMQRRIGHT, SIZEQRF,
160 $ sizeqtq, sizesubtst, sizesyev, sizesyevx,
161 $ sizetms, sizetst, sizesyevd, isizesyevd,
163 DOUBLE PRECISION EPS, EPSNORMA, ERROR, MAXERROR, MINERROR,
167 INTEGER DESCZ( DLEN_ ), ITMP( 2 )
173 DOUBLE PRECISION PDLAMCH, PDLANSY
174 EXTERNAL LSAME, NUMROC, PDLAMCH, PDLANSY
177 EXTERNAL blacs_gridinfo,
descinit, igamn2d, igamx2d,
183 INTRINSIC abs,
max,
min, mod
187 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dt_*lld_*mb_*m_*nb_*n_*
189 CALL pdlasizesqp( desca, iprepad, ipostpad, sizemqrleft,
190 $ sizemqrright, sizeqrf, sizetms, sizeqtq,
191 $ sizechk, sizesyevx, isizesyevx, sizesyev,
192 $ sizesyevd, isizesyevd, sizesubtst, isizesubtst,
193 $ sizetst, isizetst )
197 eps = pdlamch( desca( ctxt_ ),
'Eps' )
198 safmin = pdlamch( desca( ctxt_ ),
'Safe min' )
200 normwin = safmin / eps
202 $ normwin =
max( abs( win( 1+iprepad ) ),
203 $ abs( win( n+iprepad ) ), normwin )
207 DO 10 i = 1, lwork1, 1
208 work( i+iprepad ) = 14.3d+0
212 wnew( i+iprepad ) = 3.14159d+0
215 CALL descinit( descz, desca( m_ ), desca( n_ ), desca( mb_ ),
216 $ desca( nb_ ), desca( rsrc_ ), desca( csrc_ ),
217 $ desca( ctxt_ ), desca( lld_ ), info )
219 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
222 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
227 IF( myrow.GE.nprow .OR. myrow.LT.0 )
231 np = numroc( n, desca( mb_ ), myrow, 0, nprow )
232 nq = numroc( n, desca( nb_ ), mycol, 0, npcol )
233 mq = numroc( n, desca( nb_ ), mycol, 0, npcol )
237 trilwmin = 3*n +
max( desca( nb_ )*( np+1 ), 3*desca( nb_ ) )
238 minsize =
max( 1 + 6*n + 2*np*nq, trilwmin ) + 2*n
240 CALL dlacpy(
'A', np, nq, copya, desca( lld_ ), a( 1+iprepad ),
243 CALL pdfillpad( desca( ctxt_ ), np, nq, a, desca( lld_ ), iprepad,
246 CALL pdfillpad( descz( ctxt_ ), np, mq, z, descz( lld_ ), iprepad,
247 $ ipostpad, padval+1.0d+0 )
249 CALL pdfillpad( desca( ctxt_ ), n, 1, wnew, n, iprepad, ipostpad,
252 CALL pdfillpad( desca( ctxt_ ), lwork1, 1, work, lwork1, iprepad,
253 $ ipostpad, padval+4.0d+0 )
260 CALL pdelset( z( 1+iprepad ), i, j, desca, 13.0d+0 )
267 CALL pdsyevd(
'V', uplo, n, a( 1+iprepad ), ia, ja, desca,
268 $ wnew( 1+iprepad ), z( 1+iprepad ), ia, ja, desca,
269 $ work( 1+iprepad ), lwork1, iwork( 1+iprepad ),
274 IF( thresh.LE.0 )
THEN
277 CALL pdchekpad( desca( ctxt_ ),
'PDSYEVD-A', np, nq, a,
278 $ desca( lld_ ), iprepad, ipostpad, padval )
280 CALL pdchekpad( descz( ctxt_ ),
'PDSYEVD-Z', np, mq, z,
281 $ descz( lld_ ), iprepad, ipostpad,
284 CALL pdchekpad( desca( ctxt_ ),
'PDSYEVD-WNEW', n, 1, wnew, n,
285 $ iprepad, ipostpad, padval+2.0d+0 )
287 CALL pdchekpad( desca( ctxt_ ),
'PDSYEVD-WORK', lwork1, 1,
288 $ work, lwork1, iprepad, ipostpad,
299 CALL igamn2d( desca( ctxt_ ),
'a',
' ', 1, 1, itmp, 1, 1, 1,
301 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, itmp( 2 ), 1, 1,
305 IF( itmp( 1 ).NE.itmp( 2 ) )
THEN
307 $
WRITE( nout, fmt = * )
308 $
'Different processes return different INFO'
310 ELSE IF( info.NE.0 )
THEN
312 WRITE( nout, fmt = 9999 )info
314 $
WRITE( nout, fmt = 9994 )
317 ELSE IF( info.EQ.14 .AND. lwork1.GE.minsize )
THEN
319 $
WRITE( nout, fmt = 9996 )info
323 IF( result.EQ.0 .OR. info.GT.n )
THEN
329 work( i ) = wnew( i+iprepad )
330 work( i+n ) = wnew( i+iprepad )
333 CALL dgamn2d( desca( ctxt_ ),
'a',
' ', n, 1, work, n, 1,
335 CALL dgamx2d( desca( ctxt_ ),
'a',
' ', n, 1,
336 $ work( 1+n ), n, 1, 1, -1, -1, 0 )
340 IF( abs( work( i )-work( n+i ) ).GT.zero )
THEN
342 $
WRITE( nout, fmt = 9995 )
350 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, result, 1, 1, 1,
358 epsnorma = pdlansy(
'I', uplo, n, copya, ia, ja, desca,
375 CALL pdfillpad( desca( ctxt_ ), sizechk, 1, work, sizechk,
376 $ iprepad, ipostpad, 4.3d+0 )
380 CALL pdsepchk( n, n, copya, ia, ja, desca,
381 $
max( abstol+epsnorma, safmin ), thresh,
382 $ z( 1+iprepad ), ia, ja, descz,
383 $ a( 1+iprepad ), ia, ja, desca,
384 $ wnew( 1+iprepad ), work( 1+iprepad ),
385 $ sizechk, tstnrm, resaq )
387 CALL pdchekpad( desca( ctxt_ ),
'PDSEPCHK-WORK', sizechk, 1,
388 $ work, sizechk, iprepad, ipostpad, 4.3d+0 )
390 IF( resaq.NE.0 )
THEN
392 WRITE( nout, fmt = 9993 )
397 CALL pdfillpad( desca( ctxt_ ), sizeqtq, 1, work, sizeqtq,
398 $ iprepad, ipostpad, 4.3d+0 )
404 iwork( iprepad + i ) = 0
406 CALL pdsepqtq( n, n, thresh, z( 1+iprepad ), ia, ja, descz,
407 $ a( 1+iprepad ), ia, ja, desca,
408 $ iwork( 1 ), iwork( 1 ), work( 1 ),
409 $ work( iprepad+1 ), sizeqtq, qtqnrm, info,
412 CALL pdchekpad( desca( ctxt_ ),
'PDSEPQTQ-WORK', sizeqtq, 1,
413 $ work, sizeqtq, iprepad, ipostpad, 4.3d+0 )
415 IF( resqtq.NE.0 )
THEN
417 WRITE( nout, fmt = 9992 )
422 $
WRITE( nout, fmt = 9998 )info
429 IF( wknown .AND. n.GT.0 )
THEN
438 error = abs( win( i+iprepad )-wnew( i+iprepad ) )
439 maxerror =
max( maxerror, error )
441 minerror =
min( maxerror, minerror )
443 IF( minerror.GT.normwin*five*thresh*eps )
THEN
445 $
WRITE( nout, fmt = 9997 )minerror, normwin
452 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, result, 1, 1, 1, -1,
460 9999
FORMAT(
'PDSYEVD returned INFO=', i7 )
461 9998
FORMAT(
'PDSEPQTQ in PDSDPSUBTST returned INFO=', i7 )
462 9997
FORMAT(
'PDSDPSUBTST minerror =', d11.2,
' normwin=', d11.2 )
463 9996
FORMAT(
'PDSYEVD returned INFO=', i7,
464 $
' despite adequate workspace' )
465 9995
FORMAT(
'Different processes return different eigenvalues' )
466 9994
FORMAT(
'Heterogeneity detected by PDSYEVD' )
467 9993
FORMAT(
'PDSYEVD failed the |AQ -QE| test' )
468 9992
FORMAT(
'PDSYEVD failed the |QTQ -I| test' )