1 SUBROUTINE pchetrd( UPLO, N, A, IA, JA, DESCA, D, E, TAU, WORK,
11 INTEGER IA, INFO, JA, LWORK, N
16 COMPLEX A( * ), TAU( * ), WORK( * )
224 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
225 $ lld_, mb_, m_, nb_, n_, rsrc_
226 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
227 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
228 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
230 parameter( one = 1.0e+0 )
232 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
235 LOGICAL LQUERY, UPPER
236 CHARACTER COLCTOP, ROWCTOP
237 INTEGER I, IACOL, IAROW, ICOFFA, ICTXT, IINFO, IPW,
238 $ iroffa, j, jb, jx, k, kk, lwmin, mycol, myrow,
239 $ nb, np, npcol, nprow, nq
242 INTEGER DESCW( DLEN_ ), IDUM1( 2 ), IDUM2( 2 )
251 INTEGER INDXG2L, INDXG2P, NUMROC
252 EXTERNAL lsame, indxg2l, indxg2p, numroc
261 ictxt = desca( ctxt_ )
262 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
267 IF( nprow.EQ.-1 )
THEN
270 CALL chk1mat( n, 2, n, 2, ia, ja, desca, 6, info )
271 upper = lsame( uplo,
'U' )
274 iroffa = mod( ia-1, desca( mb_ ) )
275 icoffa = mod( ja-1, desca( nb_ ) )
276 iarow = indxg2p( ia, nb, myrow, desca( rsrc_ ), nprow )
277 iacol = indxg2p( ja, nb, mycol, desca( csrc_ ), npcol )
278 np = numroc( n, nb, myrow, iarow, nprow )
279 nq =
max( 1, numroc( n+ja-1, nb, mycol, desca( csrc_ ),
281 lwmin =
max( (np+1)*nb, 3*nb )
283 work( 1 ) =
cmplx( real( lwmin ) )
284 lquery = ( lwork.EQ.-1 )
285 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
287 ELSE IF( iroffa.NE.icoffa .OR. icoffa.NE.0 )
THEN
289 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
291 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
296 idum1( 1 ) = ichar(
'U' )
298 idum1( 1 ) = ichar(
'L' )
301 IF( lwork.EQ.-1 )
THEN
307 CALL pchk1mat( n, 2, n, 2, ia, ja, desca, 6, 2, idum1, idum2,
312 CALL pxerbla( ictxt,
'PCHETRD', -info )
314 ELSE IF( lquery )
THEN
323 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
324 CALL pb_topget( ictxt,
'Combine',
'Rowwise', rowctop )
325 CALL pb_topset( ictxt,
'Combine',
'Columnwise',
'1-tree' )
326 CALL pb_topset( ictxt,
'Combine',
'Rowwise',
'1-tree' )
334 kk = mod( ja+n-1, nb )
337 CALL descset( descw, n, nb, nb, nb, iarow, indxg2p( ja+n-kk,
338 $ nb, mycol, desca( csrc_ ), npcol ), ictxt,
341 DO 10 k = n-kk+1, nb+1, -nb
342 jb =
min( n-k+1, nb )
350 CALL pclatrd( uplo, k+jb-1, jb, a, ia, ja, desca, d, e, tau,
351 $ work, 1, 1, descw, work( ipw ) )
357 CALL pcher2k( uplo,
'No transpose', k-1, jb, -cone, a, ia,
358 $ j, desca, work, 1, 1, descw, one, a, ia, ja,
363 jx =
min( indxg2l( j, nb, 0, iacol, npcol ), nq )
366 descw( csrc_ ) = mod( descw( csrc_ ) + npcol - 1, npcol )
372 CALL pchetd2( uplo,
min( n, nb ), a, ia, ja, desca, d, e,
373 $ tau, work, lwork, iinfo )
379 kk = mod( ja+n-1, nb )
382 CALL descset( descw, n, nb, nb, nb, iarow, iacol, ictxt,
385 DO 20 k = 1, n-nb, nb
393 CALL pclatrd( uplo, n-k+1, nb, a, i, j, desca, d, e, tau,
394 $ work, k, 1, descw, work( ipw ) )
400 CALL pcher2k( uplo,
'No transpose', n-k-nb+1, nb, -cone, a,
401 $ i+nb, j, desca, work, k+nb, 1, descw, one, a,
402 $ i+nb, j+nb, desca )
406 jx =
min( indxg2l( j+nb-1, nb, 0, iacol, npcol ), nq )
407 CALL pcelset( a, i+nb, j+nb-1, desca,
cmplx( e( jx ) ) )
409 descw( csrc_ ) = mod( descw( csrc_ ) + 1, npcol )
415 CALL pchetd2( uplo, kk, a, ia+k-1, ja+k-1, desca, d, e,
416 $ tau, work, lwork, iinfo )
419 CALL pb_topset( ictxt,
'Combine',
'Columnwise', colctop )
420 CALL pb_topset( ictxt,
'Combine',
'Rowwise', rowctop )
422 work( 1 ) =
cmplx( real( lwmin ) )