1 SUBROUTINE pssytrd( UPLO, N, A, IA, JA, DESCA, D, E, TAU, WORK,
11 INTEGER IA, INFO, JA, LWORK, N
15 REAL A( * ), D( * ), E( * ), TAU( * ), WORK( * )
223 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
224 $ lld_, mb_, m_, nb_, n_, rsrc_
225 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
226 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
227 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
229 parameter( one = 1.0e+0 )
232 LOGICAL LQUERY, UPPER
233 CHARACTER COLCTOP, ROWCTOP
234 INTEGER I, IACOL, IAROW, ICOFFA, ICTXT, IINFO, IPW,
235 $ iroffa, j, jb, jx, k, kk, lwmin, mycol, myrow,
236 $ nb, np, npcol, nprow, nq
239 INTEGER DESCW( DLEN_ ), IDUM1( 2 ), IDUM2( 2 )
248 INTEGER INDXG2L, INDXG2P, NUMROC
249 EXTERNAL lsame, indxg2l, indxg2p, numroc
252 INTRINSIC ichar,
max,
min, mod, real
258 ictxt = desca( ctxt_ )
259 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
264 IF( nprow.EQ.-1 )
THEN
267 CALL chk1mat( n, 2, n, 2, ia, ja, desca, 6, info )
268 upper = lsame( uplo,
'U' )
271 iroffa = mod( ia-1, desca( mb_ ) )
272 icoffa = mod( ja-1, desca( nb_ ) )
273 iarow = indxg2p( ia, nb, myrow, desca( rsrc_ ), nprow )
274 iacol = indxg2p( ja, nb, mycol, desca( csrc_ ), npcol )
275 np = numroc( n, nb, myrow, iarow, nprow )
276 nq =
max( 1, numroc( n+ja-1, nb, mycol, desca( csrc_ ),
278 lwmin =
max( (np+1)*nb, 3*nb )
280 work( 1 ) = real( lwmin )
281 lquery = ( lwork.EQ.-1 )
282 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
284 ELSE IF( iroffa.NE.icoffa .OR. icoffa.NE.0 )
THEN
286 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
288 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
293 idum1( 1 ) = ichar(
'U' )
295 idum1( 1 ) = ichar(
'L' )
298 IF( lwork.EQ.-1 )
THEN
304 CALL pchk1mat( n, 2, n, 2, ia, ja, desca, 6, 2, idum1, idum2,
309 CALL pxerbla( ictxt,
'PSSYTRD', -info )
311 ELSE IF( lquery )
THEN
320 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
321 CALL pb_topget( ictxt,
'Combine',
'Rowwise', rowctop )
322 CALL pb_topset( ictxt,
'Combine',
'Columnwise',
'1-tree' )
323 CALL pb_topset( ictxt,
'Combine',
'Rowwise',
'1-tree' )
331 kk = mod( ja+n-1, nb )
334 CALL descset( descw, n, nb, nb, nb, iarow, indxg2p( ja+n-kk,
335 $ nb, mycol, desca( csrc_ ), npcol ), ictxt,
338 DO 10 k = n-kk+1, nb+1, -nb
339 jb =
min( n-k+1, nb )
347 CALL pslatrd( uplo, k+jb-1, jb, a, ia, ja, desca, d, e, tau,
348 $ work, 1, 1, descw, work( ipw ) )
354 CALL pssyr2k( uplo,
'No transpose', k-1, jb, -one, a, ia, j,
355 $ desca, work, 1, 1, descw, one, a, ia, ja,
360 jx =
min( indxg2l( j, nb, 0, iacol, npcol ), nq )
361 CALL pselset( a, i-1, j, desca, e( jx ) )
363 descw( csrc_ ) = mod( descw( csrc_ ) + npcol - 1, npcol )
369 CALL pssytd2( uplo,
min( n, nb ), a, ia, ja, desca, d, e,
370 $ tau, work, lwork, iinfo )
376 kk = mod( ja+n-1, nb )
379 CALL descset( descw, n, nb, nb, nb, iarow, iacol, ictxt,
382 DO 20 k = 1, n-nb, nb
390 CALL pslatrd( uplo, n-k+1, nb, a, i, j, desca, d, e, tau,
391 $ work, k, 1, descw, work( ipw ) )
397 CALL pssyr2k( uplo,
'No transpose', n-k-nb+1, nb, -one, a,
398 $ i+nb, j, desca, work, k+nb, 1, descw, one, a,
399 $ i+nb, j+nb, desca )
403 jx =
min( indxg2l( j+nb-1, nb, 0, iacol, npcol ), nq )
404 CALL pselset( a, i+nb, j+nb-1, desca, e( jx ) )
406 descw( csrc_ ) = mod( descw( csrc_ ) + 1, npcol )
412 CALL pssytd2( uplo, kk, a, ia+k-1, ja+k-1, desca, d, e,
413 $ tau, work, lwork, iinfo )
416 CALL pb_topset( ictxt,
'Combine',
'Columnwise', colctop )
417 CALL pb_topset( ictxt,
'Combine',
'Rowwise', rowctop )
419 work( 1 ) = real( lwmin )