1 SUBROUTINE pzgehd2( N, ILO, IHI, A, IA, JA, DESCA, TAU, WORK,
10 INTEGER IA, IHI, ILO, INFO, JA, LWORK, N
14 COMPLEX*16 A( * ), TAU( * ), WORK( * )
192 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
193 $ lld_, mb_, m_, nb_, n_, rsrc_
194 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
195 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
196 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
198 parameter( one = ( 1.0d+0, 0.0d+0 ) )
202 INTEGER I, IAROW, ICOFFA, ICTXT, IROFFA, J, K, LWMIN,
203 $ mycol, myrow, npa0, npcol, nprow
211 INTEGER INDXG2P, NUMROC
212 EXTERNAL indxg2p, numroc
215 INTRINSIC dble, dcmplx,
max,
min, mod
221 ictxt = desca( ctxt_ )
222 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
227 IF( nprow.EQ.-1 )
THEN
230 CALL chk1mat( n, 1, n, 1, ia, ja, desca, 7, info )
232 iroffa = mod( ia-1, desca( mb_ ) )
233 icoffa = mod( ja-1, desca( nb_ ) )
234 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
236 npa0 = numroc( ihi+iroffa, desca( mb_ ), myrow, iarow,
238 lwmin = desca( nb_ ) +
max( npa0, desca( nb_ ) )
240 work( 1 ) = dcmplx( dble( lwmin ) )
241 lquery = ( lwork.EQ.-1 )
242 IF( ilo.LT.1 .OR. ilo.GT.
max( 1, n ) )
THEN
244 ELSE IF( ihi.LT.
min( ilo, n ) .OR. ihi.GT.n )
THEN
246 ELSE IF( iroffa.NE.icoffa )
THEN
248 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
250 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
257 CALL pxerbla( ictxt,
'PZGEHD2', -info )
258 CALL blacs_abort( ictxt, 1 )
260 ELSE IF( lquery )
THEN
271 CALL pzlarfg( ihi-k, aii, i+1, j, a,
min( i+2, n+ia-1 ), j,
273 CALL pzelset( a, i+1, j, desca, one )
277 CALL pzlarf(
'Right', ihi, ihi-k, a, i+1, j, desca, 1, tau, a,
278 $ ia, j+1, desca, work )
282 CALL pzlarfc(
'Left', ihi-k, n-k, a, i+1, j, desca, 1, tau, a,
283 $ i+1, j+1, desca, work )
285 CALL pzelset( a, i+1, j, desca, aii )
288 work( 1 ) = dcmplx( dble( lwmin ) )