1 SUBROUTINE pzunml2( 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 COMPLEX*16 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, 0.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,
227 EXTERNAL blacs_abort, blacs_gridinfo,
chk1mat,
233 INTEGER ILCM, INDXG2P, NUMROC
234 EXTERNAL ilcm, indxg2p, lsame, numroc
237 INTRINSIC dble, dcmplx,
max, mod
243 ictxt = desca( ctxt_ )
244 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
249 IF( nprow.EQ.-1 )
THEN
252 left = lsame( side,
'L' )
253 notran = lsame( trans,
'N' )
259 CALL chk1mat( k, 5, m, 3, ia, ja, desca, 9, info )
262 CALL chk1mat( k, 5, n, 4, ia, ja, desca, 9, info )
264 CALL chk1mat( m, 3, n, 4, ic, jc, descc, 14, info )
266 icoffa = mod( ja-1, desca( nb_ ) )
267 iroffc = mod( ic-1, descc( mb_ ) )
268 icoffc = mod( jc-1, descc( nb_ ) )
269 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
271 icrow = indxg2p( ic, descc( mb_ ), myrow, descc( rsrc_ ),
273 iccol = indxg2p( jc, descc( nb_ ), mycol, descc( csrc_ ),
275 mpc0 = numroc( m+iroffc, descc( mb_ ), myrow, icrow, nprow )
276 nqc0 = numroc( n+icoffc, descc( nb_ ), mycol, iccol, npcol )
279 lcm = ilcm( nprow, npcol )
281 lwmin = mpc0 +
max(
max( 1, nqc0 ), numroc( numroc(
282 $ m+iroffc, desca( mb_ ), 0, 0, nprow ),
283 $ desca( mb_ ), 0, 0, lcmp ) )
285 nqc0 = numroc( n+icoffc, descc( nb_ ), mycol, iccol,
287 mpc0 = numroc( m+iroffc, descc( mb_ ), myrow, icrow,
289 lwmin = nqc0 +
max( 1, mpc0 )
292 work( 1 ) = dcmplx( dble( lwmin ) )
293 lquery = ( lwork.EQ.-1 )
294 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
296 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'C' ) )
THEN
298 ELSE IF( k.LT.0 .OR. k.GT.nq )
THEN
300 ELSE IF( left .AND. desca( nb_ ).NE.descc( mb_ ) )
THEN
302 ELSE IF( left .AND. icoffa.NE.iroffc )
THEN
304 ELSE IF( .NOT.left .AND. icoffa.NE.icoffc )
THEN
306 ELSE IF( .NOT.left .AND. iacol.NE.iccol )
THEN
308 ELSE IF( .NOT.left .AND. desca( nb_ ).NE.descc( nb_ ) )
THEN
310 ELSE IF( ictxt.NE.descc( ctxt_ ) )
THEN
312 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
319 CALL pxerbla( ictxt,
'PZUNML2', -info )
320 CALL blacs_abort( ictxt, 1 )
322 ELSE IF( lquery )
THEN
328 IF( m.EQ.0 .OR. n.EQ.0 .OR. k.EQ.0 )
331 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
332 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
334 IF( ( left .AND. notran .OR. .NOT.left .AND. .NOT.notran ) )
THEN
350 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
352 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'D-ring' )
354 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'I-ring' )
376 $
CALL pzlacgv( nq-i+ia-1, a, i, ja+i-ia+1, desca,
378 CALL pzelset2( aii, a, i, ja+i-ia, desca, one )
380 CALL pzlarfc( side, mi, ni, a, i, ja+i-ia, desca,
381 $ desca( m_ ), tau, c, icc, jcc, descc, work )
383 CALL pzlarf( side, mi, ni, a, i, ja+i-ia, desca,
384 $ desca( m_ ), tau, c, icc, jcc, descc, work )
386 CALL pzelset( a, i, ja+i-ia, desca, aii )
388 $
CALL pzlacgv( nq-i+ia-1, a, i, ja+i-ia+1, desca,
393 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
394 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
396 work( 1 ) = dcmplx( dble( lwmin ) )