1 SUBROUTINE pzunmhr( 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 COMPLEX*16 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, dcmplx, 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 ) = dcmplx( dble( lwmin ) )
318 lquery = ( lwork.EQ.-1 )
319 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
321 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'C' ) )
THEN
323 ELSE IF( ilo.LT.1 .OR. ilo.GT.
max( 1, nq ) )
THEN
325 ELSE IF( ihi.LT.
min( ilo, nq ) .OR. ihi.GT.nq )
THEN
327 ELSE IF( .NOT.left .AND. desca( mb_ ).NE.descc( nb_ ) )
THEN
329 ELSE IF( left .AND. iroffa.NE.iroffc )
THEN
331 ELSE IF( left .AND. iarow.NE.icrow )
THEN
333 ELSE IF( .NOT.left .AND. iroffa.NE.icoffc )
THEN
335 ELSE IF( left .AND. desca( mb_ ).NE.descc( mb_ ) )
THEN
337 ELSE IF( ictxt.NE.descc( ctxt_ ) )
THEN
339 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
345 idum1( 1 ) = ichar(
'L' )
347 idum1( 1 ) = ichar(
'R' )
351 idum1( 2 ) = ichar(
'N' )
353 idum1( 2 ) = ichar(
'C' )
360 IF( lwork.EQ.-1 )
THEN
367 CALL pchk2mat( m, 3, m, 3, ia, ja, desca, 10, m, 3, n, 4,
368 $ ic, jc, descc, 15, 5, idum1, idum2, info )
370 CALL pchk2mat( n, 4, n, 4, ia, ja, desca, 10, m, 3, n, 4,
371 $ ic, jc, descc, 15, 5, idum1, idum2, info )
376 CALL pxerbla( ictxt,
'PZUNMHR', -info )
378 ELSE IF( lquery )
THEN
384 IF( m.EQ.0 .OR. n.EQ.0 .OR. nh.EQ.0 )
387 CALL pzunmqr( side, trans, mi, ni, nh, a, iaa, jaa, desca, tau,
388 $ c, icc, jcc, descc, work, lwork, iinfo )
390 work( 1 ) = dcmplx( dble( lwmin ) )