1 SUBROUTINE pssdpsubtst( 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 REAL ABSTOL, QTQNRM, THRESH, TSTNRM
20 INTEGER DESCA( * ), IWORK( * )
21 REAL 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 REAL FIVE, NEGONE, PADVAL, ZERO
152 parameter( padval = 13.5285e+0, five = 5.0e+0,
153 $ negone = -1.0e+0, zero = 0.0e+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 REAL EPS, EPSNORMA, ERROR, MAXERROR, MINERROR,
167 INTEGER DESCZ( DLEN_ ), ITMP( 2 )
173 REAL PSLAMCH, PSLANSY
174 EXTERNAL LSAME, NUMROC, PSLAMCH, PSLANSY
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 pslasizesqp( desca, iprepad, ipostpad, sizemqrleft,
190 $ sizemqrright, sizeqrf, sizetms, sizeqtq,
191 $ sizechk, sizesyevx, isizesyevx, sizesyev,
192 $ sizesyevd, isizesyevd, sizesubtst,
193 $ isizesubtst, sizetst, isizetst )
197 eps = pslamch( desca( ctxt_ ),
'Eps' )
198 safmin = pslamch( 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.3e+0
212 wnew( i+iprepad ) = 3.14159e+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 slacpy(
'A', np, nq, copya, desca( lld_ ), a( 1+iprepad ),
243 CALL psfillpad( desca( ctxt_ ), np, nq, a, desca( lld_ ), iprepad,
246 CALL psfillpad( descz( ctxt_ ), np, mq, z, descz( lld_ ), iprepad,
247 $ ipostpad, padval+1.0e+0 )
249 CALL psfillpad( desca( ctxt_ ), n, 1, wnew, n, iprepad, ipostpad,
252 CALL psfillpad( desca( ctxt_ ), lwork1, 1, work, lwork1, iprepad,
253 $ ipostpad, padval+4.0e+0 )
260 CALL pselset( z( 1+iprepad ), i, j, desca, 13.0e+0 )
267 CALL pssyevd(
'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 pschekpad( desca( ctxt_ ),
'PSSYEVD-A', np, nq, a,
278 $ desca( lld_ ), iprepad, ipostpad, padval )
280 CALL pschekpad( descz( ctxt_ ),
'PSSYEVD-Z', np, mq, z,
281 $ descz( lld_ ), iprepad, ipostpad,
284 CALL pschekpad( desca( ctxt_ ),
'PSSYEVD-WNEW', n, 1, wnew, n,
285 $ iprepad, ipostpad, padval+2.0e+0 )
287 CALL pschekpad( desca( ctxt_ ),
'PSSYEVD-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 sgamn2d( desca( ctxt_ ),
'a',
' ', n, 1, work, n, 1,
335 CALL sgamx2d( 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 = pslansy(
'I', uplo, n, copya, ia, ja, desca,
375 CALL psfillpad( desca( ctxt_ ), sizechk, 1, work, sizechk,
376 $ iprepad, ipostpad, 4.3e+0 )
380 CALL pssepchk( 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 pschekpad( desca( ctxt_ ),
'PSSEPCHK-WORK', sizechk, 1,
388 $ work, sizechk, iprepad, ipostpad, 4.3e+0 )
390 IF( resaq.NE.0 )
THEN
392 WRITE( nout, fmt = 9993 )
397 CALL psfillpad( desca( ctxt_ ), sizeqtq, 1, work, sizeqtq,
398 $ iprepad, ipostpad, 4.3e+0 )
404 iwork( iprepad + i ) = 0
406 CALL pssepqtq( 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 pschekpad( desca( ctxt_ ),
'PSSEPQTQ-WORK', sizeqtq, 1,
413 $ work, sizeqtq, iprepad, ipostpad, 4.3e+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
440 error = abs( win( i+iprepad )-wnew( i+iprepad ) )
441 maxerror =
max( maxerror, error )
443 minerror =
min( maxerror, minerror )
445 IF( minerror.GT.normwin*five*thresh*eps )
THEN
447 $
WRITE( nout, fmt = 9997 )minerror, normwin
454 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, result, 1, 1, 1, -1,
462 9999
FORMAT(
'PSSYEVD returned INFO=', i7 )
463 9998
FORMAT(
'PSSEPQTQ in PSSDPSUBTST returned INFO=', i7 )
464 9997
FORMAT(
'PSSDPSUBTST minerror =', d11.2,
' normwin=', d11.2 )
465 9996
FORMAT(
'PSSYEVD returned INFO=', i7,
466 $
' despite adequate workspace' )
467 9995
FORMAT(
'Different processes return different eigenvalues' )
468 9994
FORMAT(
'Heterogeneity detected by PSSYEVD' )
469 9993
FORMAT(
'PSSYEVD failed the |AQ -QE| test' )
470 9992
FORMAT(
'PSSYEVD failed the |QTQ -I| test' )