1 SUBROUTINE pcsdpsubtst( 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 REAL ABSTOL, QTQNRM, THRESH, TSTNRM
20 INTEGER DESCA( * ), IWORK( * )
21 REAL RWORK( * ), WIN( * ), WNEW( * )
22 COMPLEX 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 REAL PADVAL, FIVE, NEGONE
162 parameter( padval = 13.5285e+0, five = 5.0e+0,
165 parameter( cpadval = ( 13.989e+0, 1.93e+0 ) )
167 PARAMETER ( IPADVAL = 927 )
168 COMPLEX CZERO, CONE, CNEGONE
169 parameter( czero = 0.0e+0, cone = 1.0e+0,
170 $ cnegone = -1.0e+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 REAL EPS, EPSNORMA, ERROR, MAXERROR, MINERROR, NORM,
181 $ NORMWIN, SAFMIN, ULP
189 REAL PCLANGE, PCLANHE, PSLAMCH
190 EXTERNAL NUMROC, PCLANGE, PCLANHE, PSLAMCH
193 EXTERNAL blacs_gridinfo, clacpy, igamn2d, igamx2d,
199 INTRINSIC abs,
max,
min, real
203 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
206 CALL pclasizesep( 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 = pslamch( desca( ctxt_ ),
'Eps' )
216 safmin = pslamch( 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.3e+0
226 DO 20 i = 1, liwork, 1
229 DO 30 i = 1, lwork, 1
230 work( i+iprepad ) = ( 15.63e+0, 1.1e+0 )
234 wnew( i+iprepad ) = 3.14159e+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 clacpy(
'A', np, nq, copya, desca( lld_ ), a( 1+iprepad ),
256 CALL pcfillpad( desca( ctxt_ ), np, nq, a, desca( lld_ ), iprepad,
257 $ ipostpad, cpadval )
259 CALL pcfillpad( desca( ctxt_ ), np, nq, z, desca( lld_ ), iprepad,
260 $ ipostpad, cpadval+1.0e+0 )
262 CALL psfillpad( desca( ctxt_ ), n, 1, wnew, n, iprepad, ipostpad,
265 CALL psfillpad( desca( ctxt_ ), lwork1, 1, rwork, lwork1, iprepad,
266 $ ipostpad, padval+4.0e+0 )
268 CALL pifillpad( desca( ctxt_ ), liwork, 1, iwork, liwork, iprepad,
269 $ ipostpad, ipadval )
271 CALL pcfillpad( desca( ctxt_ ), lwork, 1, work, lwork, iprepad,
272 $ ipostpad, cpadval+4.1e+0 )
278 CALL pcheevd(
'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 pcchekpad( desca( ctxt_ ),
'PCHEEVD-A', np, nq, a,
289 $ desca( lld_ ), iprepad, ipostpad, cpadval )
291 CALL pcchekpad( desca( ctxt_ ),
'PCHEEVD-Z', np, nq, z,
292 $ desca( lld_ ), iprepad, ipostpad,
295 CALL pschekpad( desca( ctxt_ ),
'PCHEEVD-WNEW', n, 1, wnew, n,
296 $ iprepad, ipostpad, padval+2.0e+0 )
298 CALL pschekpad( desca( ctxt_ ),
'PCHEEVD-rWORK', lwork1, 1,
299 $ rwork, lwork1, iprepad, ipostpad,
302 CALL pcchekpad( desca( ctxt_ ),
'PCHEEVD-WORK', lwork, 1, work,
303 $ lwork, iprepad, ipostpad, cpadval+4.1e+0 )
305 CALL pichekpad( desca( ctxt_ ),
'PCHEEVD-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 = pclanhe(
'I', uplo, n, copya, ia, ja, desca,
352 CALL psfillpad( desca( ctxt_ ), rsizechk, 1, rwork, rsizechk,
353 $ iprepad, ipostpad, 4.3e+0 )
355 CALL pcsepchk( 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 pschekpad( desca( ctxt_ ),
'PCSDPCHK-rWORK', rsizechk, 1,
362 $ rwork, rsizechk, iprepad, ipostpad, 4.3e+0 )
366 WRITE( nout, fmt = 9995 )
371 CALL psfillpad( desca( ctxt_ ), rsizeqtq, 1, rwork, rsizeqtq,
372 $ iprepad, ipostpad, 4.3e+0 )
376 ulp = pslamch( desca( ctxt_ ),
'P' )
377 CALL pclaset(
'A', n, n, czero, cone, a( 1+iprepad ), ia, ja,
379 CALL pcgemm(
'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 = pclange(
'1', n, n, a( 1+iprepad ), ia, ja, desca,
383 $ work( 1+iprepad ) )
384 qtqnrm = norm / ( real(
max( n, 1 ) )*ulp )
385 IF( qtqnrm.GT.thresh )
THEN
388 CALL pschekpad( desca( ctxt_ ),
'PCSEPQTQ-rWORK', rsizeqtq, 1,
389 $ rwork, rsizeqtq, iprepad, ipostpad, 4.3e+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(
'PCHEEVD returned INFO=', i7 )
443 9998
FORMAT(
'PCSEPQTQ returned INFO=', i7 )
444 9997
FORMAT(
'PCSDPSUBTST minerror =', d11.2,
' normwin=', d11.2 )
445 9996
FORMAT(
'PCHEEVD returned INFO=', i7,
446 $
' despite adequate workspace' )
447 9995
FORMAT(
'PCHEEVD failed the |AQ -QE| test' )
448 9994
FORMAT(
'PCHEEVD failed the |QTQ -I| test' )