1 SUBROUTINE pzgehrd( N, ILO, IHI, A, IA, JA, DESCA, TAU, WORK,
10 INTEGER IA, IHI, ILO, INFO, JA, LWORK, N
14 COMPLEX*16 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 )
203 parameter( one = ( 1.0d+0, 0.0d+0 ),
204 $ zero = ( 0.0d+0, 0.0d+0 ) )
208 CHARACTER COLCTOP, ROWCTOP
209 INTEGER I, IACOL, IAROW, IB, ICOFFA, ICTXT, IHIP,
210 $ ihlp, iia, iinfo, ilcol, ilrow, imcol, inlq,
211 $ ioff, ipt, ipw, ipy, iroffa, j, jj, jja, jy,
212 $ k, l, lwmin, mycol, myrow, nb, npcol, nprow,
217 INTEGER DESCY( DLEN_ ), IDUM1( 3 ), IDUM2( 3 )
225 INTEGER INDXG2P, NUMROC
226 EXTERNAL indxg2p, numroc
229 INTRINSIC dble, dcmplx,
max,
min, mod
235 ictxt = desca( ctxt_ )
236 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
241 IF( nprow.EQ.-1 )
THEN
244 CALL chk1mat( n, 1, n, 1, ia, ja, desca, 7, info )
247 iroffa = mod( ia-1, nb )
248 icoffa = mod( ja-1, nb )
249 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol,
250 $ iia, jja, iarow, iacol )
251 ihip = numroc( ihi+iroffa, nb, myrow, iarow, nprow )
252 ioff = mod( ia+ilo-2, nb )
253 ilrow = indxg2p( ia+ilo-1, nb, myrow, desca( rsrc_ ),
255 ihlp = numroc( ihi-ilo+ioff+1, nb, myrow, ilrow, nprow )
256 ilcol = indxg2p( ja+ilo-1, nb, mycol, desca( csrc_ ),
258 inlq = numroc( n-ilo+ioff+1, nb, mycol, ilcol, npcol )
259 lwmin = nb*( nb +
max( ihip+1, ihlp+inlq ) )
261 work( 1 ) = dcmplx( dble( lwmin ) )
262 lquery = ( lwork.EQ.-1 )
263 IF( ilo.LT.1 .OR. ilo.GT.
max( 1, n ) )
THEN
265 ELSE IF( ihi.LT.
min( ilo, n ) .OR. ihi.GT.n )
THEN
267 ELSE IF( iroffa.NE.icoffa .OR. iroffa.NE.0 )
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,
'PZGEHRD', -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 pzlahrd( ihi, k, ib, a, ia, j, desca, tau, work( ipt ),
342 $ work( ipy ), 1, jy, descy, work( ipw ) )
348 CALL pzelset2( ei, a, i+ib, j+ib-1, desca, one )
349 CALL pzgemm(
'No transpose',
'Conjugate transpose', ihi,
350 $ ihi-k-ib+1, ib, -one, work( ipy ), 1, jy, descy,
351 $ a, i+ib, j, desca, one, a, ia, j+ib, desca )
352 CALL pzelset( a, i+ib, j+ib-1, desca, ei )
357 CALL pzlarfb(
'Left',
'Conjugate transpose',
'Forward',
358 $
'Columnwise', ihi-k, n-k-ib+1, ib, a, i+1, j,
359 $ desca, work( ipt ), a, i+1, j+ib, desca,
365 descy( csrc_ ) = mod( descy( csrc_ ) + 1, npcol )
371 CALL pzgehd2( n, k, ihi, a, ia, ja, desca, tau, work, lwork,
374 CALL pb_topset( ictxt,
'Combine',
'Columnwise', colctop )
375 CALL pb_topset( ictxt,
'Combine',
'Rowwise', rowctop )
377 work( 1 ) = dcmplx( dble( lwmin ) )