1 SUBROUTINE pdgehrd( N, ILO, IHI, A, IA, JA, DESCA, TAU, WORK,
10 INTEGER IA, IHI, ILO, INFO, JA, LWORK, N
14 DOUBLE PRECISION A( * ), TAU( * ), WORK( * )
197 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
198 $ lld_, mb_, m_, nb_, n_, rsrc_
199 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
200 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
201 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
202 DOUBLE PRECISION ONE, ZERO
203 parameter( one = 1.0d+0, zero = 0.0d+0 )
207 CHARACTER COLCTOP, ROWCTOP
208 INTEGER I, IACOL, IAROW, IB, ICOFFA, ICTXT, IHIP,
209 $ ihlp, iia, iinfo, ilcol, ilrow, imcol, inlq,
210 $ ioff, ipt, ipw, ipy, iroffa, j, jj, jja, jy,
211 $ k, l, lwmin, mycol, myrow, nb, npcol, nprow,
216 INTEGER DESCY( DLEN_ ), IDUM1( 3 ), IDUM2( 3 )
224 INTEGER INDXG2P, NUMROC
225 EXTERNAL indxg2p, numroc
228 INTRINSIC dble,
max,
min, mod
234 ictxt = desca( ctxt_ )
235 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
240 IF( nprow.EQ.-1 )
THEN
243 CALL chk1mat( n, 1, n, 1, ia, ja, desca, 7, info )
246 iroffa = mod( ia-1, nb )
247 icoffa = mod( ja-1, nb )
248 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol,
249 $ iia, jja, iarow, iacol )
250 ihip = numroc( ihi+iroffa, nb, myrow, iarow, nprow )
251 ioff = mod( ia+ilo-2, nb )
252 ilrow = indxg2p( ia+ilo-1, nb, myrow, desca( rsrc_ ),
254 ihlp = numroc( ihi-ilo+ioff+1, nb, myrow, ilrow, nprow )
255 ilcol = indxg2p( ja+ilo-1, nb, mycol, desca( csrc_ ),
257 inlq = numroc( n-ilo+ioff+1, nb, mycol, ilcol, npcol )
258 lwmin = nb*( nb +
max( ihip+1, ihlp+inlq ) )
260 work( 1 ) = dble( lwmin )
261 lquery = ( lwork.EQ.-1 )
262 IF( ilo.LT.1 .OR. ilo.GT.
max( 1, n ) )
THEN
264 ELSE IF( ihi.LT.
min( ilo, n ) .OR. ihi.GT.n )
THEN
267 ELSE IF( iroffa.NE.icoffa )
THEN
269 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
271 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
279 IF( lwork.EQ.-1 )
THEN
285 CALL pchk1mat( n, 1, n, 1, ia, ja, desca, 7, 3, idum1, idum2,
290 CALL pxerbla( ictxt,
'PDGEHRD', -info )
292 ELSE IF( lquery )
THEN
298 nq = numroc( ja+n-2, nb, mycol, desca( csrc_ ), npcol )
299 CALL infog1l( ja+ilo-2, nb, npcol, mycol, desca( csrc_ ), jj,
301 DO 10 j = jja,
min( jj, nq )
305 CALL infog1l( ja+ihi-1, nb, npcol, mycol, desca( csrc_ ), jj,
316 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
317 CALL pb_topget( ictxt,
'Combine',
'Rowwise', rowctop )
318 CALL pb_topset( ictxt,
'Combine',
'Columnwise',
'1-tree' )
319 CALL pb_topset( ictxt,
'Combine',
'Rowwise',
'1-tree' )
323 ipw = ipy + ihip * nb
324 CALL descset( descy, ihi+iroffa, nb, nb, nb, iarow, ilcol, ictxt,
333 DO 30 l = 1, ihi-ilo+ioff-nb, nb
341 CALL pdlahrd( ihi, k, ib, a, ia, j, desca, tau, work( ipt ),
342 $ work( ipy ), 1, jy, descy, work( ipw ) )
348 CALL pdelset2( ei, a, i+ib, j+ib-1, desca, one )
349 CALL pdgemm(
'No transpose',
'Transpose', ihi, ihi-k-ib+1, ib,
350 $ -one, work( ipy ), 1, jy, descy, a, i+ib, j,
351 $ desca, one, a, ia, j+ib, desca )
352 CALL pdelset( a, i+ib, j+ib-1, desca, ei )
357 CALL pdlarfb(
'Left',
'Transpose',
'Forward',
'Columnwise',
358 $ ihi-k, n-k-ib+1, ib, a, i+1, j, desca,
359 $ work( ipt ), a, i+1, j+ib, desca, work( ipy ) )
364 descy( csrc_ ) = mod( descy( csrc_ ) + 1, npcol )
370 CALL pdgehd2( n, k, ihi, a, ia, ja, desca, tau, work, lwork,
373 CALL pb_topset( ictxt,
'Combine',
'Columnwise', colctop )
374 CALL pb_topset( ictxt,
'Combine',
'Rowwise', rowctop )
376 work( 1 ) = dble( lwmin )