1 SUBROUTINE pdlaed3( 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 DOUBLE PRECISION BUF( * ), D( * ), DLAMDA( * ), U( LDU, * ),
131 PARAMETER ( ONE = 1.0d+0 )
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
137 DOUBLE PRECISION AUX, TEMP
141 DOUBLE PRECISION DLAMC3, DNRM2
142 EXTERNAL indxg2l, dlamc3, dnrm2
145 EXTERNAL blacs_gridinfo, dcopy, dgebr2d, dgebs2d,
146 $ dgerv2d, dgesd2d, dlaed4
149 INTRINSIC mod, sign, sqrt
162 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
173 row = mod( row+1, nprow )
174 col = mod( col+1, npcol )
177 mykl = ctot( mycol, 1 ) + ctot( mycol, 2 ) + ctot( mycol, 3 )
179 IF( myrow.EQ.drow )
THEN
180 myklr = klr + mod( mykl, nprow )
187 IF( mycol.NE.col )
THEN
188 pdc = pdc + ctot( col, 1 ) + ctot( col, 2 ) + ctot( col, 3 )
189 col = mod( col+1, npcol )
193 kl = klr + mod( mykl, nprow )
196 IF( myrow.NE.row )
THEN
199 row = mod( row+1, nprow )
204 dlamda( i ) = dlamc3( dlamda( i ), dlamda( i ) ) - dlamda( i )
207 IF( myklr.GT.0 )
THEN
210 CALL dlaed4( k, kk, dlamda, w, buf, rho, buf( k+i ), iinfo )
211 IF( iinfo.NE.0 )
THEN
218 z( j ) = z( j )*( buf( j ) /
219 $ ( dlamda( j )-dlamda( kk ) ) )
221 z( kk ) = z( kk )*buf( kk )
223 z( j ) = z( j )*( buf( j ) /
224 $ ( dlamda( j )-dlamda( kk ) ) )
229 IF( myrow.NE.drow )
THEN
230 CALL dcopy( k, z, 1, buf, 1 )
231 CALL dgesd2d( ictxt, k+myklr, 1, buf, k+myklr, drow, mycol )
234 CALL dcopy( myklr, buf( k+1 ), 1, buf( ipd ), 1 )
237 row = mod( drow+1, nprow )
238 DO 100 i = 1, nprow - 1
239 CALL dgerv2d( ictxt, k+klr, 1, buf, k+klr, row,
241 CALL dcopy( klr, buf( k+1 ), 1, buf( ipd ), 1 )
243 z( j ) = z( j )*buf( j )
246 row = mod( row+1, nprow )
252 IF( myrow.EQ.drow )
THEN
253 IF( mycol.NE.dcol .AND. mykl.NE.0 )
THEN
254 CALL dcopy( k, z, 1, buf, 1 )
255 CALL dcopy( mykl, buf( 2*k+1 ), 1, buf( k+1 ), 1 )
256 CALL dgesd2d( ictxt, k+mykl, 1, buf, k+mykl, myrow, dcol )
257 ELSE IF( mycol.EQ.dcol )
THEN
261 DO 120 i = 1, npcol - 1
263 col = mod( col+1, npcol )
264 kl = ctot( col, 1 ) + ctot( col, 2 ) + ctot( col, 3 )
266 CALL dgerv2d( ictxt, k+kl, 1, buf, k+kl, myrow, col )
267 CALL dcopy( kl, buf( k+1 ), 1, buf( ipd ), 1 )
269 z( j ) = z( j )*buf( j )
274 z( i ) = sign( sqrt( -z( i ) ), w( i ) )
282 IF( myrow.EQ.drow .AND. mycol.EQ.dcol )
THEN
283 CALL dcopy( k, z, 1, buf, 1 )
284 CALL dcopy( k, buf( 2*k+1 ), 1, buf( k+1 ), 1 )
285 CALL dgebs2d( ictxt,
'All',
' ', 2*k, 1, buf, 2*k )
287 CALL dgebr2d( ictxt,
'All',
' ', 2*k, 1, buf, 2*k, drow, dcol )
288 CALL dcopy( k, buf, 1, z, 1 )
300 IF( col.EQ.mycol )
THEN
304 IF( row.EQ.myrow )
THEN
316 jju = indxg2l( ju, nb, j, j, npcol )
317 CALL dlaed4( k, kk, dlamda, w, buf, rho, aux, iinfo )
318 IF( iinfo.NE.0 )
THEN
321 IF( k.EQ.1 .OR. k.EQ.2 )
THEN
325 iiu = indxg2l( iu, nb, j, j, nprow )
326 u( iiu, jju ) = buf( kk )
332 buf( i ) = z( i ) / buf( i )
334 temp = dnrm2( k, buf, 1 )
338 iiu = indxg2l( iu, nb, j, j, nprow )
339 u( iiu, jju ) = buf( kk ) / temp