1 SUBROUTINE psormr3( SIDE, TRANS, M, N, K, L, A, IA, JA, DESCA,
2 $ TAU, C, IC, JC, DESCC, WORK, LWORK, INFO )
11 INTEGER IA, IC, INFO, JA, JC, K, L, LWORK, M, N
14 INTEGER DESCA( * ), DESCC( * )
15 REAL A( * ), C( * ), TAU( * ), WORK( * )
214 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
215 $ lld_, mb_, m_, nb_, n_, rsrc_
216 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
217 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
218 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
221 LOGICAL LEFT, LQUERY, NOTRAN
222 CHARACTER COLBTOP, ROWBTOP
223 INTEGER I, I1, I2, I3, IACOL, ICC, ICCOL, ICOFFA,
224 $ icoffc, icrow, ictxt, iroffc, jaa, jcc, lcm,
225 $ lcmp, lwmin, mi, mpc0, mycol, myrow, ni, npcol,
230 $ pb_topget, pb_topset,
pxerbla
234 INTEGER ILCM, INDXG2P, NUMROC
235 EXTERNAL ilcm, indxg2p, lsame, numroc
238 INTRINSIC max, mod, real
244 ictxt = desca( ctxt_ )
245 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
250 IF( nprow.EQ.-1 )
THEN
253 left = lsame( side,
'L' )
254 notran = lsame( trans,
'N' )
260 CALL chk1mat( k, 5, m, 3, ia, ja, desca, 10, info )
263 CALL chk1mat( k, 5, n, 4, ia, ja, desca, 10, info )
265 CALL chk1mat( m, 3, n, 4, ic, jc, descc, 15, info )
267 icoffa = mod( ja-1, desca( nb_ ) )
268 iroffc = mod( ic-1, descc( mb_ ) )
269 icoffc = mod( jc-1, descc( nb_ ) )
270 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
272 icrow = indxg2p( ic, descc( mb_ ), myrow, descc( rsrc_ ),
274 iccol = indxg2p( jc, descc( nb_ ), mycol, descc( csrc_ ),
276 mpc0 = numroc( m+iroffc, descc( mb_ ), myrow, icrow, nprow )
277 nqc0 = numroc( n+icoffc, descc( nb_ ), mycol, iccol, npcol )
280 lcm = ilcm( nprow, npcol )
282 lwmin = mpc0 +
max(
max( 1, nqc0 ), numroc( numroc(
283 $ m+iroffc, desca( mb_ ), 0, 0, nprow ),
284 $ desca( mb_ ), 0, 0, lcmp ) )
286 lwmin = nqc0 +
max( 1, mpc0 )
289 work( 1 ) = real( lwmin )
290 lquery = ( lwork.EQ.-1 )
291 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
293 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) )
THEN
295 ELSE IF( k.LT.0 .OR. k.GT.nq )
THEN
297 ELSE IF( l.LT.0 .OR. l.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,
'PSORMR3', -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. .NOT.notran .OR. .NOT.left .AND. notran ) )
THEN
351 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
353 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'I-ring' )
355 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'D-ring' )
376 CALL pslarz( side, mi, ni, l, a, i, jaa, desca, desca( m_ ),
377 $ tau, c, icc, jcc, descc, work )
381 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
382 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
384 work( 1 ) = real( lwmin )