3 SUBROUTINE pdlaevswp( N, ZIN, LDZI, Z, IZ, JZ, DESCZ, NVS, KEY,
12 INTEGER IZ, JZ, LDZI, LWORK, N
15 INTEGER DESCZ( * ), KEY( * ), NVS( * )
16 DOUBLE PRECISION WORK( * ), Z( * ), ZIN( LDZI, * )
133 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
134 $ mb_, nb_, rsrc_, csrc_, lld_
135 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
136 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
137 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
140 INTEGER CYCLIC_I, CYCLIC_J, DIST, I, IAM, II, INCII, J,
141 $ maxi, maxii, mini, minii, mycol, myrow, nb,
142 $ nbufsize, npcol, nprocs, nprow, pcol, recvcol,
143 $ recvfrom, recvrow, sendcol, sendrow, sendto
146 INTEGER INDXG2L, INDXG2P
147 EXTERNAL indxg2l, indxg2p
150 EXTERNAL blacs_gridinfo, dgerv2d, dgesd2d
157 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
159 CALL blacs_gridinfo( descz( ctxt_ ), nprow, npcol, myrow, mycol )
160 iam = myrow + mycol*nprow
161 iam = myrow*npcol + mycol
174 DO 10 j = descz( n_ ), 1, -1
175 key( j ) = key( j-jz+1 ) + ( jz-1 )
178 DO 110 dist = 0, nprocs - 1
180 sendto = mod( iam+dist, nprocs )
181 recvfrom = mod( nprocs+iam-dist, nprocs )
183 sendrow = mod( sendto, nprow )
184 sendcol = sendto / nprow
185 recvrow = mod( recvfrom, nprow )
186 recvcol = recvfrom / nprow
188 sendrow = sendto / npcol
189 sendcol = mod( sendto, npcol )
190 recvrow = recvfrom / npcol
191 recvcol = mod( recvfrom, npcol )
199 DO 40 j = nvs( 1+iam ) + jz, nvs( 1+iam+1 ) + jz - 1
200 pcol = indxg2p( key( j ), descz( nb_ ), -1, descz( csrc_ ),
202 IF( sendcol.EQ.pcol )
THEN
203 minii = mod( sendrow+descz( rsrc_ ), nprow )*
206 incii = descz( mb_ )*nprow
207 DO 30 ii = minii, maxii, incii
209 maxi =
min( ii+descz( mb_ )-1, n+iz-1 )
210 DO 20 i = mini, maxi, 1
211 nbufsize = nbufsize + 1
212 work( nbufsize ) = zin( i+1-iz,
213 $ j-nvs( 1+iam )+1-jz )
220 IF( myrow.NE.sendrow .OR. mycol.NE.sendcol )
221 $
CALL dgesd2d( descz( ctxt_ ), nbufsize, 1, work, nbufsize,
228 DO 70 j = nvs( 1+recvfrom ) + jz,
229 $ nvs( 1+recvfrom+1 ) + jz - 1, 1
230 pcol = indxg2p( key( j ), descz( nb_ ), -1, descz( csrc_ ),
232 IF( mycol.EQ.pcol )
THEN
233 minii = mod( myrow+descz( rsrc_ ), nprow )*descz( mb_ ) +
236 incii = descz( mb_ )*nprow
237 DO 60 ii = minii, maxii, incii
239 maxi =
min( ii+nb-1, n+iz-1 )
240 DO 50 i = mini, maxi, 1
241 nbufsize = nbufsize + 1
249 IF( myrow.NE.recvrow .OR. mycol.NE.recvcol )
250 $
CALL dgerv2d( descz( ctxt_ ), 1, nbufsize, work, 1, recvrow,
254 DO 100 j = nvs( 1+recvfrom ) + jz,
255 $ nvs( 1+recvfrom+1 ) + jz - 1, 1
256 pcol = indxg2p( key( j ), descz( nb_ ), -1, descz( csrc_ ),
258 IF( mycol.EQ.pcol )
THEN
259 cyclic_j = indxg2l( key( j ), descz( mb_ ), -1, -1,
262 minii = mod( myrow+descz( rsrc_ ), nprow )*descz( mb_ ) +
265 incii = descz( mb_ )*nprow
266 DO 90 ii = minii, maxii, incii
268 cyclic_i = indxg2l( mini, descz( mb_ ), -1, -1,
270 maxi =
min( ii+nb-1, n+iz-1 )
271 DO 80 i = mini, maxi, 1
272 nbufsize = nbufsize + 1
273 z( cyclic_i+( cyclic_j-1 )*descz( lld_ ) )
275 cyclic_i = cyclic_i + 1