3 SUBROUTINE pdsqpsubtst( WKNOWN, JOBZ, UPLO, N, THRESH, ABSTOL, A,
4 $ COPYA, Z, IA, JA, DESCA, WIN, WNEW,
5 $ IPREPAD, IPOSTPAD, WORK, LWORK, LWORK1,
6 $ RESULT, TSTNRM, QTQNRM, NOUT )
16 INTEGER IA, IPOSTPAD, IPREPAD, JA, LWORK, LWORK1, N,
18 DOUBLE PRECISION ABSTOL, QTQNRM, THRESH, TSTNRM
22 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, EIGS, 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
162 DOUBLE PRECISION EPS, EPSNORMA, ERROR, MAXERROR, MINERROR,
166 INTEGER DESCZ( DLEN_ ), ITMP( 2 ),
173 DOUBLE PRECISION PDLAMCH, PDLANSY
174 EXTERNAL lsame, numroc, pdlamch, pdlansy
177 EXTERNAL blacs_gridinfo,
descinit, dgamn2d, dgamx2d,
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
219 IF( lsame( jobz,
'N' ) )
THEN
226 CALL descinit( descz, desca( m_ ), desca( n_ ), desca( mb_ ),
227 $ desca( nb_ ), desca( rsrc_ ), desca( csrc_ ),
228 $ desca( ctxt_ ), desca( lld_ ), info )
230 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
233 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
239 IF( myrow.GE.nprow .OR. myrow.LT.0 )
243 np = numroc( n, desca( mb_ ), myrow, 0, nprow )
244 nq = numroc( n, desca( nb_ ), mycol, 0, npcol )
245 mq = numroc( eigs, desca( nb_ ), mycol, 0, npcol )
251 CALL dlacpy(
'A', np, nq, copya, desca( lld_ ), a( 1+iprepad ),
254 CALL pdfillpad( desca( ctxt_ ), np, nq, a, desca( lld_ ), iprepad,
257 CALL pdfillpad( descz( ctxt_ ), np, mq, z, descz( lld_ ), iprepad,
258 $ ipostpad, padval+1.0d+0 )
260 CALL pdfillpad( desca( ctxt_ ), n, 1, wnew, n, iprepad, ipostpad,
263 CALL pdfillpad( desca( ctxt_ ), lwork1, 1, work, lwork1, iprepad,
264 $ ipostpad, padval+4.0d+0 )
271 CALL pdelset( z( 1+iprepad ), i, j, desca, 13.0d+0 )
278 CALL pdsyev( jobz, uplo, n, a( 1+iprepad ), ia, ja, desca,
279 $ wnew( 1+iprepad ), z( 1+iprepad ), ia, ja, desca,
280 $ work( 1+iprepad ), lwork1, info )
284 IF( thresh.LE.0 )
THEN
287 CALL pdchekpad( desca( ctxt_ ),
'PDSYEV-A', np, nq, a,
288 $ desca( lld_ ), iprepad, ipostpad, padval )
290 CALL pdchekpad( descz( ctxt_ ),
'PDSYEV-Z', np, mq, z,
291 $ descz( lld_ ), iprepad, ipostpad,
294 CALL pdchekpad( desca( ctxt_ ),
'PDSYEV-WNEW', n, 1, wnew, n,
295 $ iprepad, ipostpad, padval+2.0d+0 )
297 CALL pdchekpad( desca( ctxt_ ),
'PDSYEV-WORK', lwork1, 1,
298 $ work, lwork1, iprepad, ipostpad,
309 CALL igamn2d( desca( ctxt_ ),
'a',
' ', 1, 1, itmp, 1, 1, 1,
311 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, itmp( 2 ), 1, 1,
315 IF( itmp( 1 ).NE.itmp( 2 ) )
THEN
317 $
WRITE( nout, fmt = * )
318 $
'Different processes return different INFO'
320 ELSE IF( info.NE.0 )
THEN
322 WRITE( nout, fmt = 9999 )info
324 $
WRITE( nout, fmt = 9994 )
327 ELSE IF( info.EQ.14 .AND. lwork1.GE.minsize )
THEN
329 $
WRITE( nout, fmt = 9996 )info
333 IF( result.EQ.0 .OR. info.GT.n )
THEN
339 work( i ) = wnew( i+iprepad )
340 work( i+n ) = wnew( i+iprepad )
343 CALL dgamn2d( desca( ctxt_ ),
'a',
' ', n, 1, work, n, 1,
345 CALL dgamx2d( desca( ctxt_ ),
'a',
' ', n, 1,
346 $ work( 1+n ), n, 1, 1, -1, -1, 0 )
350 IF( abs( work( i )-work( n+i ) ).GT.zero )
THEN
352 $
WRITE( nout, fmt = 9995 )
360 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, result, 1, 1, 1,
368 epsnorma = pdlansy(
'I', uplo, n, copya, ia, ja, desca,
382 IF( lsame( jobz,
'V' ) )
THEN
386 CALL pdfillpad( desca( ctxt_ ), sizechk, 1, work, sizechk,
387 $ iprepad, ipostpad, 4.3d+0 )
391 CALL pdsepchk( n, n, copya, ia, ja, desca,
392 $
max( abstol+epsnorma, safmin ), thresh,
393 $ z( 1+iprepad ), ia, ja, descz,
394 $ a( 1+iprepad ), ia, ja, desca,
395 $ wnew( 1+iprepad ), work( 1+iprepad ),
396 $ sizechk, tstnrm, resaq )
398 CALL pdchekpad( desca( ctxt_ ),
'PDSEPCHK-WORK', sizechk, 1,
399 $ work, sizechk, iprepad, ipostpad, 4.3d+0 )
401 IF( resaq.NE.0 )
THEN
403 WRITE( nout, fmt = 9993 )
408 CALL pdfillpad( desca( ctxt_ ), sizeqtq, 1, work, sizeqtq,
409 $ iprepad, ipostpad, 4.3d+0 )
413 CALL pdsepqtq( n, n, thresh, z( 1+iprepad ), ia, ja, descz,
414 $ a( 1+iprepad ), ia, ja, desca,
415 $ iwork( 1 ), iwork( 1 ), work( 1 ),
416 $ work( iprepad+1 ), sizeqtq, qtqnrm, info,
419 CALL pdchekpad( desca( ctxt_ ),
'PDSEPQTQ-WORK', sizeqtq, 1,
420 $ work, sizeqtq, iprepad, ipostpad, 4.3d+0 )
422 IF( resqtq.NE.0 )
THEN
424 WRITE( nout, fmt = 9992 )
429 $
WRITE( nout, fmt = 9998 )info
436 IF( wknown .AND. n.GT.0 )
THEN
445 error = abs( win( i+iprepad )-wnew( i+iprepad ) )
446 maxerror =
max( maxerror, error )
448 minerror =
min( maxerror, minerror )
450 IF( minerror.GT.normwin*five*thresh*eps )
THEN
452 $
WRITE( nout, fmt = 9997 )minerror, normwin
460 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, result, 1, 1, 1, -1,
468 9999
FORMAT(
'PDSYEV returned INFO=', i7 )
469 9998
FORMAT(
'PDSEPQTQ in PDSQPSUBTST returned INFO=', i7 )
470 9997
FORMAT(
'PDSQPSUBTST minerror =', d11.2,
' normwin=', d11.2 )
471 9996
FORMAT(
'PDSYEV returned INFO=', i7,
472 $
' despite adequate workspace' )
473 9995
FORMAT(
'Different processes return different eigenvalues' )
474 9994
FORMAT(
'Heterogeneity detected by PDSYEV' )
475 9993
FORMAT(
'PDSYEV failed the |AQ -QE| test' )
476 9992
FORMAT(
'PDSYEV failed the |QTQ -I| test' )