1 SUBROUTINE pslacp2( UPLO, M, N, A, IA, JA, DESCA, B, IB, JB,
10 INTEGER IA, IB, JA, JB, M, N
13 INTEGER DESCA( * ), DESCB( * )
143 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
144 $ lld_, mb_, m_, nb_, n_, rsrc_
145 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
146 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
147 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
150 INTEGER HEIGHT, IACOL, IAROW, IBASE, IBCOL, IBROW,
151 $ icoffa, iia, iiaa, iib, iibb, iibega, iibegb,
152 $ iienda, iinxta, iinxtb, ileft, iright, iroffa,
153 $ itop, jja, jjaa, jjb, jjbb, jjbega, jjbegb,
154 $ jjenda, jjnxta, jjnxtb, lda, ldb, mba, mp,
155 $ mpaa, mycol, mydist, myrow, nba, npcol, nprow,
159 EXTERNAL blacs_gridinfo,
infog2l, slamov
163 INTEGER ICEIL, NUMROC
164 EXTERNAL iceil, lsame, numroc
171 IF( m.EQ.0 .OR. n.EQ.0 )
176 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
178 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
180 CALL infog2l( ib, jb, descb, nprow, npcol, myrow, mycol, iib, jjb,
186 iroffa = mod( ia-1, mba )
187 icoffa = mod( ja-1, nba )
190 IF( n.LE.( nba-icoffa ) )
THEN
228 IF( mycol.EQ.iacol )
THEN
230 mp = numroc( m+iroffa, mba, myrow, iarow, nprow )
235 mydist = mod( myrow-iarow+nprow, nprow )
236 itop = mydist * mba - iroffa
238 IF( lsame( uplo,
'U' ) )
THEN
240 itop =
max( 0, itop )
242 iienda = iia + mp - 1
243 iinxta =
min( iceil( iibega, mba ) * mba, iienda )
245 iinxtb = iibegb + iinxta - iibega
248 IF( ( n-itop ).GT.0 )
THEN
249 CALL slamov( uplo, iinxta-iibega+1, n-itop,
250 $ a( iibega+(jja+itop-1)*lda ), lda,
251 $ b( iibegb+(jjb+itop-1)*ldb ), ldb )
252 mydist = mydist + nprow
253 itop = mydist * mba - iroffa
255 iinxta =
min( iinxta+mba, iienda )
257 iinxtb = iibegb + iinxta - iibega
261 ELSE IF( lsame( uplo,
'L' ) )
THEN
268 ibase =
min( itop + mba, n )
269 itop =
min(
max( 0, itop ), n )
272 IF( jjaa.LE.( jja+n-1 ) )
THEN
273 height = ibase - itop
274 CALL slamov(
'All', mpaa, itop-jjaa+jja,
275 $ a( iiaa+(jjaa-1)*lda ), lda,
276 $ b( iibb+(jjbb-1)*ldb ), ldb )
277 CALL slamov( uplo, mpaa, height,
278 $ a( iiaa+(jja+itop-1)*lda ), lda,
279 $ b( iibb+(jjb+itop-1)*ldb ), ldb )
280 mpaa =
max( 0, mpaa - height )
285 mydist = mydist + nprow
286 itop = mydist * mba - iroffa
287 ibase =
min( itop + mba, n )
288 itop =
min( itop, n )
294 CALL slamov(
'All', mp, n, a( iia+(jja-1)*lda ),
295 $ lda, b( iib+(jjb-1)*ldb ), ldb )
301 ELSE IF( m.LE.( mba-iroffa ) )
THEN
326 IF( myrow.EQ.iarow )
THEN
328 nq = numroc( n+icoffa, nba, mycol, iacol, npcol )
333 mydist = mod( mycol-iacol+npcol, npcol )
334 ileft = mydist * nba - icoffa
336 IF( lsame( uplo,
'L' ) )
THEN
338 ileft =
max( 0, ileft )
340 jjenda = jja + nq - 1
341 jjnxta =
min( iceil( jjbega, nba ) * nba, jjenda )
343 jjnxtb = jjbegb + jjnxta - jjbega
346 IF( ( m-ileft ).GT.0 )
THEN
347 CALL slamov( uplo, m-ileft, jjnxta-jjbega+1,
348 $ a( iia+ileft+(jjbega-1)*lda ), lda,
349 $ b( iib+ileft+(jjbegb-1)*ldb ), ldb )
350 mydist = mydist + npcol
351 ileft = mydist * nba - icoffa
353 jjnxta =
min( jjnxta+nba, jjenda )
355 jjnxtb = jjbegb + jjnxta - jjbega
359 ELSE IF( lsame( uplo,
'U' ) )
THEN
366 iright =
min( ileft + nba, m )
367 ileft =
min(
max( 0, ileft ), m )
370 IF( iiaa.LE.( iia+m-1 ) )
THEN
371 wide = iright - ileft
372 CALL slamov(
'All', ileft-iiaa+iia, nqaa,
373 $ a( iiaa+(jjaa-1)*lda ), lda,
374 $ b( iibb+(jjbb-1)*ldb ), ldb )
375 CALL slamov( uplo, wide, nqaa,
376 $ a( iia+ileft+(jjaa-1)*lda ), lda,
377 $ b( iib+ileft+(jjbb-1)*ldb ), ldb )
378 nqaa =
max( 0, nqaa - wide )
383 mydist = mydist + npcol
384 ileft = mydist * nba - icoffa
385 iright =
min( ileft + nba, m )
386 ileft =
min( ileft, m )
392 CALL slamov(
'All', m, nq, a( iia+(jja-1)*lda ),
393 $ lda, b( iib+(jjb-1)*ldb ), ldb )