1 SUBROUTINE pslaed3( ICTXT, K, N, NB, D, DROW, DCOL, RHO, DLAMDA,
2 $ W, Z, U, LDU, BUF, INDX, INDCOL, INDROW,
3 $ INDXR, INDXC, CTOT, NPCOL, INFO )
11 INTEGER DCOL, DROW, ICTXT, INFO, K, LDU, N, NB, NPCOL
15 INTEGER CTOT( 0: NPCOL-1, 4 ), INDCOL( * ),
16 $ INDROW( * ), INDX( * ), INDXC( * ), INDXR( * )
17 REAL BUF( * ), D( * ), DLAMDA( * ), U( LDU, * ),
131 PARAMETER ( ONE = 1.0e0 )
134 INTEGER COL, GI, I, IINFO, IIU, IPD, IU, J, JJU, JU,
135 $ KK, KL, KLC, KLR, MYCOL, MYKL, MYKLR, MYROW,
136 $ nprow, pdc, pdr, row
142 EXTERNAL indxg2l, slamc3, snrm2
145 EXTERNAL blacs_gridinfo, scopy, sgebr2d, sgebs2d,
146 $ sgerv2d, sgesd2d, slaed4
149 INTRINSIC mod, sign, sqrt
162 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
171 row = mod( row+1, nprow )
172 col = mod( col+1, npcol )
175 mykl = ctot( mycol, 1 ) + ctot( mycol, 2 ) + ctot( mycol, 3 )
177 IF( myrow.EQ.drow )
THEN
178 myklr = klr + mod( mykl, nprow )
185 IF( mycol.NE.col )
THEN
186 pdc = pdc + ctot( col, 1 ) + ctot( col, 2 ) + ctot( col, 3 )
187 col = mod( col+1, npcol )
191 kl = klr + mod( mykl, nprow )
194 IF( myrow.NE.row )
THEN
197 row = mod( row+1, nprow )
202 dlamda( i ) = slamc3( dlamda( i ), dlamda( i ) ) - dlamda( i )
205 IF( myklr.GT.0 )
THEN
208 CALL slaed4( k, kk, dlamda, w, buf, rho, buf( k+i ), iinfo )
209 IF( iinfo.NE.0 )
THEN
216 z( j ) = z( j )*( buf( j ) /
217 $ ( dlamda( j )-dlamda( kk ) ) )
219 z( kk ) = z( kk )*buf( kk )
221 z( j ) = z( j )*( buf( j ) /
222 $ ( dlamda( j )-dlamda( kk ) ) )
227 IF( myrow.NE.drow )
THEN
228 CALL scopy( k, z, 1, buf, 1 )
229 CALL sgesd2d( ictxt, k+myklr, 1, buf, k+myklr, drow, mycol )
232 CALL scopy( myklr, buf( k+1 ), 1, buf( ipd ), 1 )
235 row = mod( drow+1, nprow )
236 DO 100 i = 1, nprow - 1
237 CALL sgerv2d( ictxt, k+klr, 1, buf, k+klr, row,
239 CALL scopy( klr, buf( k+1 ), 1, buf( ipd ), 1 )
241 z( j ) = z( j )*buf( j )
244 row = mod( row+1, nprow )
250 IF( myrow.EQ.drow )
THEN
251 IF( mycol.NE.dcol .AND. mykl.NE.0 )
THEN
252 CALL scopy( k, z, 1, buf, 1 )
253 CALL scopy( mykl, buf( 2*k+1 ), 1, buf( k+1 ), 1 )
254 CALL sgesd2d( ictxt, k+mykl, 1, buf, k+mykl, myrow, dcol )
255 ELSE IF( mycol.EQ.dcol )
THEN
259 DO 120 i = 1, npcol - 1
261 col = mod( col+1, npcol )
262 kl = ctot( col, 1 ) + ctot( col, 2 ) + ctot( col, 3 )
264 CALL sgerv2d( ictxt, k+kl, 1, buf, k+kl, myrow, col )
265 CALL scopy( kl, buf( k+1 ), 1, buf( ipd ), 1 )
267 z( j ) = z( j )*buf( j )
272 z( i ) = sign( sqrt( -z( i ) ), w( i ) )
280 IF( myrow.EQ.drow .AND. mycol.EQ.dcol )
THEN
281 CALL scopy( k, z, 1, buf, 1 )
282 CALL scopy( k, buf( 2*k+1 ), 1, buf( k+1 ), 1 )
283 CALL sgebs2d( ictxt,
'All',
' ', 2*k, 1, buf, 2*k )
285 CALL sgebr2d( ictxt,
'All',
' ', 2*k, 1, buf, 2*k, drow, dcol )
286 CALL scopy( k, buf, 1, z, 1 )
298 IF( col.EQ.mycol )
THEN
302 IF( row.EQ.myrow )
THEN
314 jju = indxg2l( ju, nb, j, j, npcol )
315 CALL slaed4( k, kk, dlamda, w, buf, rho, aux, iinfo )
316 IF( iinfo.NE.0 )
THEN
319 IF( k.EQ.1 .OR. k.EQ.2 )
THEN
323 iiu = indxg2l( iu, nb, j, j, nprow )
324 u( iiu, jju ) = buf( kk )
330 buf( i ) = z( i ) / buf( i )
332 temp = snrm2( k, buf, 1 )
336 iiu = indxg2l( iu, nb, j, j, nprow )
337 u( iiu, jju ) = buf( kk ) / temp