1 SUBROUTINE pdormtr( SIDE, UPLO, TRANS, M, N, A, IA, JA, DESCA,
2 $ TAU, C, IC, JC, DESCC, WORK, LWORK, INFO )
10 CHARACTER SIDE, TRANS, UPLO
11 INTEGER IA, IC, INFO, JA, JC, LWORK, M, N
14 INTEGER DESCA( * ), DESCC( * )
15 DOUBLE PRECISION A( * ), C( * ), TAU( * ), WORK( * )
235 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
236 $ lld_, mb_, m_, nb_, n_, rsrc_
237 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
238 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
239 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
242 LOGICAL LEFT, LQUERY, NOTRAN, UPPER
243 INTEGER IAA, IAROW, ICC, ICCOL, ICOFFC, ICROW, ICTXT,
244 $ iinfo, iroffa, iroffc, jaa, jcc, lcm, lcmq,
245 $ lwmin, mi, mpc0, mycol, myrow, ni, npa0, npcol,
249 INTEGER IDUM1( 4 ), IDUM2( 4 )
257 INTEGER ILCM, INDXG2P, NUMROC
258 EXTERNAL ilcm, indxg2p, lsame, numroc
261 INTRINSIC dble, ichar,
max, mod
267 ictxt = desca( ctxt_ )
268 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
273 IF( nprow.EQ.-1 )
THEN
276 left = lsame( side,
'L' )
277 notran = lsame( trans,
'N' )
278 upper = lsame( uplo,
'U' )
303 CALL chk1mat( mi, 4, nq-1, 4, iaa, jaa, desca, 9, info )
308 CALL chk1mat( ni, 5, nq-1, 5, iaa, jaa, desca, 9, info )
310 CALL chk1mat( mi, 4, ni, 5, icc, jcc, descc, 14, info )
312 iroffa = mod( iaa-1, desca( mb_ ) )
313 iroffc = mod( icc-1, descc( mb_ ) )
314 icoffc = mod( jcc-1, descc( nb_ ) )
315 iarow = indxg2p( iaa, desca( mb_ ), myrow, desca( rsrc_ ),
317 icrow = indxg2p( icc, descc( mb_ ), myrow, descc( rsrc_ ),
319 iccol = indxg2p( jcc, descc( nb_ ), mycol, descc( csrc_ ),
321 mpc0 = numroc( mi+iroffc, descc( mb_ ), myrow, icrow,
323 nqc0 = numroc( ni+icoffc, descc( nb_ ), mycol, iccol,
327 lwmin =
max( ( desca( nb_ ) * ( desca( nb_ ) - 1 ) ) / 2,
328 $ ( mpc0 + nqc0 ) * desca( nb_ ) ) +
329 $ desca( nb_ ) * desca( nb_ )
331 npa0 = numroc( ni+iroffa, desca( mb_ ), myrow, iarow,
333 lcm = ilcm( nprow, npcol )
335 lwmin =
max( ( desca( nb_ ) * ( desca( nb_ ) - 1 ) )
336 $ / 2, ( nqc0 +
max( npa0 + numroc( numroc(
337 $ ni+icoffc, desca( nb_ ), 0, 0, npcol ),
338 $ desca( nb_ ), 0, 0, lcmq ), mpc0 ) ) *
339 $ desca( nb_ ) ) + desca( nb_ ) * desca( nb_ )
342 work( 1 ) = dble( lwmin )
343 lquery = ( lwork.EQ.-1 )
344 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
346 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
348 ELSE IF( .NOT.lsame( trans,
'N' ) .AND.
349 $ .NOT.lsame( trans,
'T' ) )
THEN
351 ELSE IF( .NOT.left .AND. desca( mb_ ).NE.descc( nb_ ) )
THEN
353 ELSE IF( left .AND. iroffa.NE.iroffc )
THEN
355 ELSE IF( left .AND. iarow.NE.icrow )
THEN
357 ELSE IF( .NOT.left .AND. iroffa.NE.icoffc )
THEN
359 ELSE IF( left .AND. desca( mb_ ).NE.descc( mb_ ) )
THEN
361 ELSE IF( ictxt.NE.descc( ctxt_ ) )
THEN
363 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
369 idum1( 1 ) = ichar(
'L' )
371 idum1( 1 ) = ichar(
'R' )
375 idum1( 2 ) = ichar(
'U' )
377 idum1( 2 ) = ichar(
'L' )
381 idum1( 3 ) = ichar(
'N' )
383 idum1( 3 ) = ichar(
'T' )
386 IF( lwork.EQ.-1 )
THEN
393 CALL pchk2mat( mi, 4, nq-1, 4, iaa, jaa, desca, 9, mi, 4,
394 $ ni, 5, icc, jcc, descc, 14, 4, idum1, idum2,
397 CALL pchk2mat( ni, 5, nq-1, 5, iaa, jaa, desca, 9, mi, 4,
398 $ ni, 5, icc, jcc, descc, 14, 4, idum1, idum2,
404 CALL pxerbla( ictxt,
'PDORMTR', -info )
406 ELSE IF( lquery )
THEN
412 IF( m.EQ.0 .OR. n.EQ.0 .OR. nq.EQ.1 )
419 CALL pdormql( side, trans, mi, ni, nq-1, a, iaa, jaa, desca,
420 $ tau, c, icc, jcc, descc, work, lwork, iinfo )
426 CALL pdormqr( side, trans, mi, ni, nq-1, a, iaa, jaa, desca,
427 $ tau, c, icc, jcc, descc, work, lwork, iinfo )
431 work( 1 ) = dble( lwmin )