1 SUBROUTINE pclapiv( DIREC, ROWCOL, PIVROC, M, N, A, IA, JA,
2 $ DESCA, IPIV, IP, JP, DESCIP, IWORK )
10 CHARACTER*1 DIREC, PIVROC, ROWCOL
11 INTEGER IA, IP, JA, JP, M, N
14 INTEGER DESCA( * ), DESCIP( * ), IPIV( * ), IWORK( * )
199 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
200 $ lld_, mb_, m_, nb_, n_, rsrc_
201 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
202 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
203 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
207 INTEGER I, ICTXT, ICURCOL, ICURROW, IIP, ITMP, IPT,
208 $ jjp, jpt, mycol, myrow, npcol, nprow
211 INTEGER DESCPT( DLEN_ )
214 EXTERNAL blacs_gridinfo, igebr2d, igebs2d,
219 INTEGER NUMROC, INDXG2P
220 EXTERNAL lsame, numroc, indxg2p
229 ictxt = desca( ctxt_ )
230 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
231 rowpvt = lsame( rowcol,
'R' )
236 IF( m.LE.1 .OR. n.LT.1 )
241 IF( lsame( pivroc,
'C' ) )
THEN
242 CALL pclapv2( direc, rowcol, m, n, a, ia, ja, desca, ipiv,
252 ipt = mod( jp-1, desca(mb_) )
253 descpt(m_) = m + ipt + nprow*desca(mb_)
255 descpt(mb_) = desca(mb_)
257 descpt(rsrc_) = indxg2p( ia, desca(mb_), ia, desca(rsrc_),
259 descpt(csrc_) = mycol
260 descpt(ctxt_) = ictxt
261 descpt(lld_) = numroc( descpt(m_), descpt(mb_), myrow,
262 $ descpt(rsrc_), nprow )
263 itmp = numroc( descip(n_), descip(nb_), mycol,
264 $ descip(csrc_), npcol )
265 CALL infog2l( ip, jp-ipt, descip, nprow, npcol, myrow,
266 $ mycol, iip, jjp, icurrow, icurcol )
267 CALL pirow2col( ictxt, m+ipt, 1, descip(nb_), ipiv(jjp),
268 $ itmp, iwork, descpt(lld_), 0, icurcol,
270 $ mycol, iwork(descpt(lld_)-descpt(mb_)+1) )
274 itmp = descpt(lld_) - descpt(mb_)
275 IF( mycol.EQ.0 )
THEN
276 CALL igebs2d( ictxt,
'Row',
' ', itmp, 1, iwork, itmp )
278 CALL igebr2d( ictxt,
'Row',
' ', itmp, 1, iwork, itmp,
287 iwork(i) = iwork(i) - jp + ipt
289 CALL pclapv2( direc, rowcol, m, n, a, ia, ja, desca, iwork,
296 IF( m.LT.1 .OR. n.LE.1 )
301 IF( lsame( pivroc,
'R' ) )
THEN
302 CALL pclapv2( direc, rowcol, m, n, a, ia, ja, desca, ipiv,
312 jpt = mod( ip-1, desca(nb_) )
314 descpt(n_) = n + jpt + npcol*desca(nb_)
316 descpt(nb_) = desca(nb_)
317 descpt(rsrc_) = myrow
318 descpt(csrc_) = indxg2p( ja, desca(nb_), ja, desca(csrc_),
320 descpt(ctxt_) = ictxt
322 CALL infog2l( ip-jpt, jp, descip, nprow, npcol, myrow,
323 $ mycol, iip, jjp, icurrow, icurcol )
324 itmp = numroc( n+jpt, descpt(nb_), mycol, descpt(csrc_),
326 CALL picol2row( ictxt, n+jpt, 1, descip(mb_), ipiv(iip),
327 $ descip(lld_), iwork,
max(1, itmp), icurrow,
328 $ 0, 0, descpt(csrc_), iwork(itmp+1) )
332 IF( myrow.EQ.0 )
THEN
333 CALL igebs2d( ictxt,
'Column',
' ', itmp, 1, iwork,
336 CALL igebr2d( ictxt,
'Column',
' ', itmp, 1, iwork,
345 iwork(i) = iwork(i) - ip + jpt
347 CALL pclapv2( direc, rowcol, m, n, a, ia, ja, desca, iwork,