1 SUBROUTINE pdormhr( SIDE, TRANS, M, N, ILO, IHI, A, IA, JA, DESCA,
2 $ TAU, C, IC, JC, DESCC, WORK, LWORK, INFO )
11 INTEGER IA, IC, IHI, ILO, INFO, JA, JC, LWORK, M, N
14 INTEGER DESCA( * ), DESCC( * )
15 DOUBLE PRECISION A( * ), C( * ), TAU( * ), WORK( * )
221 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
222 $ lld_, mb_, m_, nb_, n_, rsrc_
223 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
224 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
225 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
228 LOGICAL LEFT, LQUERY, NOTRAN
229 INTEGER IAA, IAROW, ICC, ICCOL, ICOFFC, ICROW, ICTXT,
230 $ iinfo, iroffa, iroffc, jaa, jcc, lcm, lcmq,
231 $ lwmin, mi, mpc0, mycol, myrow, nh, ni, npa0,
232 $ npcol, nprow, nq, nqc0
235 INTEGER IDUM1( 5 ), IDUM2( 5 )
243 INTEGER ILCM, INDXG2P, NUMROC
244 EXTERNAL ilcm, indxg2p, lsame, numroc
247 INTRINSIC dble, ichar,
max,
min, mod
253 ictxt = desca( ctxt_ )
254 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
260 IF( nprow.EQ.-1 )
THEN
263 left = lsame( side,
'L' )
264 notran = lsame( trans,
'N' )
276 CALL chk1mat( m, 3, m, 3, ia, ja, desca, 10, info )
283 CALL chk1mat( n, 4, n, 4, ia, ja, desca, 10, info )
285 CALL chk1mat( m, 3, n, 4, ic, jc, descc, 15, info )
287 iroffa = mod( iaa-1, desca( mb_ ) )
288 iroffc = mod( icc-1, descc( mb_ ) )
289 icoffc = mod( jcc-1, descc( nb_ ) )
290 iarow = indxg2p( iaa, desca( mb_ ), myrow, desca( rsrc_ ),
292 icrow = indxg2p( icc, descc( mb_ ), myrow, descc( rsrc_ ),
294 iccol = indxg2p( jcc, descc( nb_ ), mycol, descc( csrc_ ),
296 mpc0 = numroc( mi+iroffc, descc( mb_ ), myrow, icrow,
298 nqc0 = numroc( ni+icoffc, descc( nb_ ), mycol, iccol,
302 lwmin =
max( ( desca( nb_ ) * ( desca( nb_ ) - 1 ) ) / 2,
303 $ ( mpc0 + nqc0 ) * desca( nb_ ) ) +
304 $ desca( nb_ ) * desca( nb_ )
306 npa0 = numroc( ni+iroffa, desca( mb_ ), myrow, iarow,
308 lcm = ilcm( nprow, npcol )
310 lwmin =
max( ( desca( nb_ ) * ( desca( nb_ ) - 1 ) )
311 $ / 2, ( nqc0 +
max( npa0 + numroc( numroc(
312 $ ni+icoffc, desca( nb_ ), 0, 0, npcol ),
313 $ desca( nb_ ), 0, 0, lcmq ), mpc0 ) ) *
314 $ desca( nb_ ) ) + desca( nb_ ) * desca( nb_ )
317 work( 1 ) = dble( lwmin )
318 lquery = ( lwork.EQ.-1 )
319 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
321 ELSE IF( .NOT.lsame( trans,
'N' ) .AND.
322 $ .NOT.lsame( trans,
'T' ) )
THEN
324 ELSE IF( ilo.LT.1 .OR. ilo.GT.
max( 1, nq ) )
THEN
326 ELSE IF( ihi.LT.
min( ilo, nq ) .OR. ihi.GT.nq )
THEN
328 ELSE IF( .NOT.left .AND. desca( mb_ ).NE.descc( nb_ ) )
THEN
330 ELSE IF( left .AND. iroffa.NE.iroffc )
THEN
332 ELSE IF( left .AND. iarow.NE.icrow )
THEN
334 ELSE IF( .NOT.left .AND. iroffa.NE.icoffc )
THEN
336 ELSE IF( left .AND. desca( mb_ ).NE.descc( mb_ ) )
THEN
338 ELSE IF( ictxt.NE.descc( ctxt_ ) )
THEN
340 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
346 idum1( 1 ) = ichar(
'L' )
348 idum1( 1 ) = ichar(
'R' )
352 idum1( 2 ) = ichar(
'N' )
354 idum1( 2 ) = ichar(
'T' )
361 IF( lwork.EQ.-1 )
THEN
368 CALL pchk2mat( m, 3, m, 3, ia, ja, desca, 10, m, 3, n, 4,
369 $ ic, jc, descc, 15, 5, idum1, idum2, info )
371 CALL pchk2mat( n, 4, n, 4, ia, ja, desca, 10, m, 3, n, 4,
372 $ ic, jc, descc, 15, 5, idum1, idum2, info )
377 CALL pxerbla( ictxt,
'PDORMHR', -info )
379 ELSE IF( lquery )
THEN
385 IF( m.EQ.0 .OR. n.EQ.0 .OR. nh.EQ.0 )
388 CALL pdormqr( side, trans, mi, ni, nh, a, iaa, jaa, desca, tau,
389 $ c, icc, jcc, descc, work, lwork, iinfo )
391 work( 1 ) = dble( lwmin )