1 SUBROUTINE pzsdpsubtst( WKNOWN, UPLO, N, THRESH, ABSTOL, A, COPYA,
2 $ Z, IA, JA, DESCA, WIN, WNEW, IPREPAD,
3 $ IPOSTPAD, WORK, LWORK, RWORK, LRWORK,
4 $ LWORK1, IWORK, LIWORK, RESULT, TSTNRM,
15 INTEGER IA, IPOSTPAD, IPREPAD, JA, LIWORK, LRWORK,
16 $ LWORK, LWORK1, N, NOUT, RESULT
17 DOUBLE PRECISION ABSTOL, QTQNRM, THRESH, TSTNRM
20 INTEGER DESCA( * ), IWORK( * )
21 DOUBLE PRECISION RWORK( * ), WIN( * ), WNEW( * )
22 COMPLEX*16 A( * ), COPYA( * ), WORK( * ), Z( * )
156 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
157 $ MB_, NB_, RSRC_, CSRC_, LLD_
158 PARAMETER ( BLOCK_CYCLIC_2D = 1, dlen_ = 9, dtype_ = 1,
159 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
160 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
161 DOUBLE PRECISION PADVAL, FIVE, NEGONE
162 parameter( padval = 13.5285d+0, five = 5.0d+0,
165 parameter( cpadval = ( 13.989d+0, 1.93d+0 ) )
167 PARAMETER ( IPADVAL = 927 )
168 COMPLEX*16 CZERO, CONE, CNEGONE
169 parameter( czero = 0.0d+0, cone = 1.0d+0,
170 $ cnegone = -1.0d+0 )
173 INTEGER I, IAM, INFO, ISIZEHEEVD, ISIZEHEEVX,
174 $ ISIZESUBTST, ISIZETST, MYCOL, MYROW, NP, NPCOL,
175 $ NPROW, NQ, RES, RSIZECHK, RSIZEHEEVD,
176 $ RSIZEHEEVX, RSIZEQTQ, RSIZESUBTST, RSIZETST,
177 $ sizeheevd, sizeheevx, sizemqrleft,
178 $ sizemqrright, sizeqrf, sizesubtst, sizetms,
180 DOUBLE PRECISION EPS, EPSNORMA, ERROR, MAXERROR, MINERROR, NORM,
181 $ NORMWIN, SAFMIN, ULP
189 DOUBLE PRECISION PZLANGE, PZLANHE, PDLAMCH
190 EXTERNAL NUMROC, PZLANGE, PZLANHE, PDLAMCH
193 EXTERNAL blacs_gridinfo, zlacpy, igamn2d, igamx2d,
199 INTRINSIC abs,
max,
min, dble
203 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
206 CALL pzlasizesep( desca, iprepad, ipostpad, sizemqrleft,
207 $ sizemqrright, sizeqrf, sizetms, rsizeqtq,
208 $ rsizechk, sizeheevx, rsizeheevx, isizeheevx,
209 $ sizeheevd, rsizeheevd, isizeheevd, sizesubtst,
210 $ rsizesubtst, isizesubtst, sizetst, rsizetst,
215 eps = pdlamch( desca( ctxt_ ),
'Eps' )
216 safmin = pdlamch( desca( ctxt_ ),
'Safe min' )
218 normwin = safmin / eps
220 $ normwin =
max( abs( win( 1+iprepad ) ),
221 $ abs( win( n+iprepad ) ), normwin )
223 DO 10 i = 1, lwork1, 1
224 rwork( i+iprepad ) = 14.3d+0
226 DO 20 i = 1, liwork, 1
229 DO 30 i = 1, lwork, 1
230 work( i+iprepad ) = ( 15.63d+0, 1.1d+0 )
234 wnew( i+iprepad ) = 3.14159d+0
237 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
240 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
246 IF( myrow.GE.nprow .OR. myrow.LT.0 )
250 np = numroc( n, desca( mb_ ), myrow, 0, nprow )
251 nq = numroc( n, desca( nb_ ), mycol, 0, npcol )
253 CALL zlacpy(
'A', np, nq, copya, desca( lld_ ), a( 1+iprepad ),
256 CALL pzfillpad( desca( ctxt_ ), np, nq, a, desca( lld_ ), iprepad,
257 $ ipostpad, cpadval )
259 CALL pzfillpad( desca( ctxt_ ), np, nq, z, desca( lld_ ), iprepad,
260 $ ipostpad, cpadval+1.0d+0 )
262 CALL pdfillpad( desca( ctxt_ ), n, 1, wnew, n, iprepad, ipostpad,
265 CALL pdfillpad( desca( ctxt_ ), lwork1, 1, rwork, lwork1, iprepad,
266 $ ipostpad, padval+4.0d+0 )
268 CALL pifillpad( desca( ctxt_ ), liwork, 1, iwork, liwork, iprepad,
269 $ ipostpad, ipadval )
271 CALL pzfillpad( desca( ctxt_ ), lwork, 1, work, lwork, iprepad,
272 $ ipostpad, cpadval+4.1d+0 )
278 CALL pzheevd(
'V', uplo, n, a( 1+iprepad ), ia, ja, desca,
279 $ wnew( 1+iprepad ), z( 1+iprepad ), ia, ja, desca,
280 $ work( 1+iprepad ), sizeheevd, rwork( 1+iprepad ),
281 $ lwork1, iwork( 1+iprepad ), liwork, info )
285 IF( thresh.LE.0 )
THEN
288 CALL pzchekpad( desca( ctxt_ ),
'PZHEEVD-A', np, nq, a,
289 $ desca( lld_ ), iprepad, ipostpad, cpadval )
291 CALL pzchekpad( desca( ctxt_ ),
'PZHEEVD-Z', np, nq, z,
292 $ desca( lld_ ), iprepad, ipostpad,
295 CALL pdchekpad( desca( ctxt_ ),
'PZHEEVD-WNEW', n, 1, wnew, n,
296 $ iprepad, ipostpad, padval+2.0d+0 )
298 CALL pdchekpad( desca( ctxt_ ),
'PZHEEVD-rWORK', lwork1, 1,
299 $ rwork, lwork1, iprepad, ipostpad,
302 CALL pzchekpad( desca( ctxt_ ),
'PZHEEVD-WORK', lwork, 1, work,
303 $ lwork, iprepad, ipostpad, cpadval+4.1d+0 )
305 CALL pichekpad( desca( ctxt_ ),
'PZHEEVD-IWORK', liwork, 1,
306 $ iwork, liwork, iprepad, ipostpad, ipadval )
315 CALL igamn2d( desca( ctxt_ ),
'a',
' ', 1, 1, itmp, 1, 1, 1,
317 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, itmp( 2 ), 1, 1,
321 IF( itmp( 1 ).NE.itmp( 2 ) )
THEN
323 $
WRITE( nout, fmt = * )
324 $
'Different processes return different INFO'
326 ELSE IF( info.NE.0 )
THEN
328 $
WRITE( nout, fmt = 9996 )info
337 epsnorma = pzlanhe(
'I', uplo, n, copya, ia, ja, desca,
352 CALL pdfillpad( desca( ctxt_ ), rsizechk, 1, rwork, rsizechk,
353 $ iprepad, ipostpad, 4.3d+0 )
355 CALL pzsepchk( n, n, copya, ia, ja, desca,
356 $
max( abstol+epsnorma, safmin ), thresh,
357 $ z( 1+iprepad ), ia, ja, desca, a( 1+iprepad ),
358 $ ia, ja, desca, wnew( 1+iprepad ),
359 $ rwork( 1+iprepad ), rsizechk, tstnrm, res )
361 CALL pdchekpad( desca( ctxt_ ),
'PZSDPCHK-rWORK', rsizechk, 1,
362 $ rwork, rsizechk, iprepad, ipostpad, 4.3d+0 )
366 WRITE( nout, fmt = 9995 )
371 CALL pdfillpad( desca( ctxt_ ), rsizeqtq, 1, rwork, rsizeqtq,
372 $ iprepad, ipostpad, 4.3d+0 )
376 ulp = pdlamch( desca( ctxt_ ),
'P' )
377 CALL pzlaset(
'A', n, n, czero, cone, a( 1+iprepad ), ia, ja,
379 CALL pzgemm(
'Conjugate transpose',
'N', n, n, n, cnegone,
380 $ z( 1+iprepad ), ia, ja, desca, z( 1+iprepad ), ia,
381 $ ja, desca, cone, a( 1+iprepad ), ia, ja, desca )
382 norm = pzlange(
'1', n, n, a( 1+iprepad ), ia, ja, desca,
383 $ work( 1+iprepad ) )
384 qtqnrm = norm / ( dble(
max( n, 1 ) )*ulp )
385 IF( qtqnrm.GT.thresh )
THEN
388 CALL pdchekpad( desca( ctxt_ ),
'PZSEPQTQ-rWORK', rsizeqtq, 1,
389 $ rwork, rsizeqtq, iprepad, ipostpad, 4.3d+0 )
393 WRITE( nout, fmt = 9994 )
398 $
WRITE( nout, fmt = 9998 )info
404 $
WRITE( nout, fmt = 9998 )info
411 IF( wknown .AND. n.GT.0 )
THEN
420 error = abs( win( i+iprepad )-wnew( i+iprepad ) )
421 maxerror =
max( maxerror, error )
423 minerror =
min( maxerror, minerror )
425 IF( minerror.GT.normwin*five*thresh*eps )
THEN
427 $
WRITE( nout, fmt = 9997 )minerror, normwin
435 CALL igamx2d( desca( ctxt_ ),
'a',
' ', 1, 1, result, 1, 1, 1, -1,
442 9999
FORMAT(
'PZHEEVD returned INFO=', i7 )
443 9998
FORMAT(
'PZSEPQTQ returned INFO=', i7 )
444 9997
FORMAT(
'PZSDPSUBTST minerror =', d11.2,
' normwin=', d11.2 )
445 9996
FORMAT(
'PZHEEVD returned INFO=', i7,
446 $
' despite adequate workspace' )
447 9995
FORMAT(
'PZHEEVD failed the |AQ -QE| test' )
448 9994
FORMAT(
'PZHEEVD failed the |QTQ -I| test' )