3 SUBROUTINE pclaevswp( N, ZIN, LDZI, Z, IZ, JZ, DESCZ, NVS, KEY,
12 INTEGER IZ, JZ, LDZI, LRWORK, N
15 INTEGER DESCZ( * ), KEY( * ), NVS( * )
16 REAL RWORK( * ), ZIN( LDZI, * )
134 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
135 $ mb_, nb_, rsrc_, csrc_, lld_
136 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
137 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
138 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
141 INTEGER CYCLIC_I, CYCLIC_J, DIST, I, IAM, II, INCII, J,
142 $ maxi, maxii, mini, minii, mycol, myrow, nb,
143 $ nbufsize, npcol, nprocs, nprow, pcol, recvcol,
144 $ recvfrom, recvrow, sendcol, sendrow, sendto
147 INTEGER INDXG2L, INDXG2P
148 EXTERNAL indxg2l, indxg2p
151 EXTERNAL blacs_gridinfo, sgerv2d, sgesd2d
158 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
160 CALL blacs_gridinfo( descz( ctxt_ ), nprow, npcol, myrow, mycol )
161 iam = myrow + mycol*nprow
162 iam = myrow*npcol + mycol
175 DO 10 j = descz( n_ ), 1, -1
176 key( j ) = key( j-jz+1 ) + ( jz-1 )
179 DO 110 dist = 0, nprocs - 1
181 sendto = mod( iam+dist, nprocs )
182 recvfrom = mod( nprocs+iam-dist, nprocs )
184 sendrow = mod( sendto, nprow )
185 sendcol = sendto / nprow
186 recvrow = mod( recvfrom, nprow )
187 recvcol = recvfrom / nprow
189 sendrow = sendto / npcol
190 sendcol = mod( sendto, npcol )
191 recvrow = recvfrom / npcol
192 recvcol = mod( recvfrom, npcol )
200 DO 40 j = nvs( 1+iam ) + jz, nvs( 1+iam+1 ) + jz - 1
201 pcol = indxg2p( key( j ), descz( nb_ ), -1, descz( csrc_ ),
203 IF( sendcol.EQ.pcol )
THEN
204 minii = mod( sendrow+descz( rsrc_ ), nprow )*
207 incii = descz( mb_ )*nprow
208 DO 30 ii = minii, maxii, incii
210 maxi =
min( ii+descz( mb_ )-1, n+iz-1 )
211 DO 20 i = mini, maxi, 1
212 nbufsize = nbufsize + 1
213 rwork( nbufsize ) = zin( i+1-iz,
214 $ j-nvs( 1+iam )+1-jz )
221 IF( myrow.NE.sendrow .OR. mycol.NE.sendcol )
222 $
CALL sgesd2d( descz( ctxt_ ), nbufsize, 1, rwork, nbufsize,
229 DO 70 j = nvs( 1+recvfrom ) + jz,
230 $ nvs( 1+recvfrom+1 ) + jz - 1, 1
231 pcol = indxg2p( key( j ), descz( nb_ ), -1, descz( csrc_ ),
233 IF( mycol.EQ.pcol )
THEN
234 minii = mod( myrow+descz( rsrc_ ), nprow )*descz( mb_ ) +
237 incii = descz( mb_ )*nprow
238 DO 60 ii = minii, maxii, incii
240 maxi =
min( ii+nb-1, n+iz-1 )
241 DO 50 i = mini, maxi, 1
242 nbufsize = nbufsize + 1
250 IF( myrow.NE.recvrow .OR. mycol.NE.recvcol )
251 $
CALL sgerv2d( descz( ctxt_ ), 1, nbufsize, rwork, 1,
255 DO 100 j = nvs( 1+recvfrom ) + jz,
256 $ nvs( 1+recvfrom+1 ) + jz - 1, 1
257 pcol = indxg2p( key( j ), descz( nb_ ), -1, descz( csrc_ ),
259 IF( mycol.EQ.pcol )
THEN
260 cyclic_j = indxg2l( key( j ), descz( mb_ ), -1, -1,
263 minii = mod( myrow+descz( rsrc_ ), nprow )*descz( mb_ ) +
266 incii = descz( mb_ )*nprow
267 DO 90 ii = minii, maxii, incii
269 cyclic_i = indxg2l( mini, descz( mb_ ), -1, -1,
271 maxi =
min( ii+nb-1, n+iz-1 )
272 DO 80 i = mini, maxi, 1
273 nbufsize = nbufsize + 1
274 z( cyclic_i+( cyclic_j-1 )*descz( lld_ ) )
275 $ =
cmplx( rwork( nbufsize ) )
276 cyclic_i = cyclic_i + 1