1 SUBROUTINE pdorml2( SIDE, TRANS, M, N, K, A, IA, JA, DESCA, TAU,
2 $ C, IC, JC, DESCC, WORK, LWORK, INFO )
11 INTEGER IA, IC, INFO, JA, JC, K, LWORK, M, N
14 INTEGER DESCA( * ), DESCC( * )
15 DOUBLE PRECISION A( * ), C( * ), TAU( * ), WORK( * )
209 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
210 $ lld_, mb_, m_, nb_, n_, rsrc_
211 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
212 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
213 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
215 parameter( one = 1.0d+0 )
218 LOGICAL LEFT, LQUERY, NOTRAN
219 CHARACTER COLBTOP, ROWBTOP
220 INTEGER I, I1, I2, I3, IACOL, ICC, ICCOL, ICOFFA,
221 $ icoffc, icrow, ictxt, iroffc, jcc, lcm, lcmp,
222 $ lwmin, mi, mpc0, mycol, myrow, ni, npcol,
232 INTEGER ILCM, INDXG2P, NUMROC
233 EXTERNAL ilcm, indxg2p, lsame, numroc
236 INTRINSIC dble,
max, mod
242 ictxt = desca( ctxt_ )
243 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
248 IF( nprow.EQ.-1 )
THEN
251 left = lsame( side,
'L' )
252 notran = lsame( trans,
'N' )
258 CALL chk1mat( k, 5, m, 3, ia, ja, desca, 9, info )
261 CALL chk1mat( k, 5, n, 4, ia, ja, desca, 9, info )
263 CALL chk1mat( m, 3, n, 4, ic, jc, descc, 14, info )
265 icoffa = mod( ja-1, desca( nb_ ) )
266 iroffc = mod( ic-1, descc( mb_ ) )
267 icoffc = mod( jc-1, descc( nb_ ) )
268 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
270 icrow = indxg2p( ic, descc( mb_ ), myrow, descc( rsrc_ ),
272 iccol = indxg2p( jc, descc( nb_ ), mycol, descc( csrc_ ),
274 mpc0 = numroc( m+iroffc, descc( mb_ ), myrow, icrow, nprow )
275 nqc0 = numroc( n+icoffc, descc( nb_ ), mycol, iccol, npcol )
278 lcm = ilcm( nprow, npcol )
280 lwmin = mpc0 +
max(
max( 1, nqc0 ), numroc( numroc(
281 $ m+iroffc, desca( mb_ ), 0, 0, nprow ),
282 $ desca( mb_ ), 0, 0, lcmp ) )
284 nqc0 = numroc( n+icoffc, descc( nb_ ), mycol, iccol,
286 mpc0 = numroc( m+iroffc, descc( mb_ ), myrow, icrow,
288 lwmin = nqc0 +
max( 1, mpc0 )
291 work( 1 ) = dble( lwmin )
292 lquery = ( lwork.EQ.-1 )
293 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
295 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) )
THEN
297 ELSE IF( k.LT.0 .OR. k.GT.nq )
THEN
299 ELSE IF( left .AND. desca( nb_ ).NE.descc( mb_ ) )
THEN
301 ELSE IF( left .AND. icoffa.NE.iroffc )
THEN
303 ELSE IF( .NOT.left .AND. icoffa.NE.icoffc )
THEN
305 ELSE IF( .NOT.left .AND. iacol.NE.iccol )
THEN
307 ELSE IF( .NOT.left .AND. desca( nb_ ).NE.descc( nb_ ) )
THEN
309 ELSE IF( ictxt.NE.descc( ctxt_ ) )
THEN
311 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
318 CALL pxerbla( ictxt,
'PDORML2', -info )
319 CALL blacs_abort( ictxt, 1 )
321 ELSE IF( lquery )
THEN
327 IF( m.EQ.0 .OR. n.EQ.0 .OR. k.EQ.0 )
330 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
331 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
333 IF( ( left .AND. notran .OR. .NOT.left .AND. .NOT.notran ) )
THEN
349 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
351 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'D-ring' )
353 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'I-ring' )
374 CALL pdelset2( aii, a, i, ja+i-ia, desca, one )
375 CALL pdlarf( side, mi, ni, a, i, ja+i-ia, desca, desca( m_ ),
376 $ tau, c, icc, jcc, descc, work )
377 CALL pdelset( a, i, ja+i-ia, desca, aii )
381 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
382 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
384 work( 1 ) = dble( lwmin )