1 SUBROUTINE pdlaed2( ICTXT, K, N, N1, NB, D, DROW, DCOL, Q, LDQ,
2 $ RHO, Z, W, DLAMDA, Q2, LDQ2, QBUF, CTOT, PSM,
3 $ NPCOL, INDX, INDXC, INDXP, INDCOL, COLTYP, NN,
12 INTEGER DCOL, DROW, IB1, IB2, ICTXT, K, LDQ, LDQ2, N,
13 $ N1, NB, NN, NN1, NN2, NPCOL
17 INTEGER COLTYP( * ), CTOT( 0: NPCOL-1, 4 ),
18 $ INDCOL( N ), INDX( * ), INDXC( * ), INDXP( * ),
19 $ PSM( 0: NPCOL-1, 4 )
20 DOUBLE PRECISION D( * ), DLAMDA( * ), Q( LDQ, * ),
21 $ Q2( LDQ2, * ), QBUF( * ), W( * ), Z( * )
152 DOUBLE PRECISION MONE, ZERO, ONE, TWO, EIGHT
153 PARAMETER ( MONE = -1.0d0, zero = 0.0d0, one = 1.0d0,
154 $ two = 2.0d0, eight = 8.0d0 )
157 INTEGER COL, CT, I, IAM, IE1, IE2, IMAX, INFO, J, JJQ2,
158 $ JJS, JMAX, JS, K2, MYCOL, MYROW, N1P1, N2, NJ,
159 $ NJCOL, NJJ, NP, NPROCS, NPROW, PJ, PJCOL, PJJ
160 DOUBLE PRECISION C, EPS, S, T, TAU, TOL
163 INTEGER IDAMAX, INDXG2L, INDXL2G, NUMROC
164 DOUBLE PRECISION DLAPY2, PDLAMCH
165 EXTERNAL IDAMAX, INDXG2L, INDXL2G, NUMROC, PDLAMCH,
169 EXTERNAL blacs_gridinfo, blacs_pinfo, dcopy, dgerv2d,
173 INTRINSIC abs,
max,
min, mod, sqrt
187 CALL blacs_pinfo( iam, nprocs )
188 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
189 np = numroc( n, nb, myrow, drow, nprow )
194 IF( rho.LT.zero )
THEN
195 CALL dscal( n2, mone, z( n1p1 ), 1 )
201 t = one / sqrt( two )
202 CALL dscal( n, t, z, 1 )
210 imax = idamax( n, z, 1 )
211 jmax = idamax( n, d, 1 )
212 eps = pdlamch( ictxt,
'Epsilon' )
213 tol = eight*eps*
max( abs( d( jmax ) ), abs( z( imax ) ) )
219 IF( rho*abs( z( imax ) ).LE.tol )
THEN
231 CALL dlapst(
'I', n, d, indx, info )
243 $ indcol( i+j ) = col
245 col = mod( col+1, npcol )
252 IF( rho*abs( z( nj ) ).LE.tol )
THEN
271 IF( rho*abs( z( nj ) ).LE.tol )
THEN
289 t = d( nj ) - d( pj )
292 IF( abs( t*c*s ).LE.tol )
THEN
298 IF( coltyp( nj ).NE.coltyp( pj ) )
301 CALL infog1l( nj, nb, npcol, mycol, dcol, njj, njcol )
302 CALL infog1l( pj, nb, npcol, mycol, dcol, pjj, pjcol )
303 IF( indcol( pj ).EQ.indcol( nj ) .AND. mycol.EQ.njcol )
THEN
304 CALL drot( np, q( 1, pjj ), 1, q( 1, njj ), 1, c, s )
305 ELSE IF( mycol.EQ.pjcol )
THEN
306 CALL dgesd2d( ictxt, np, 1, q( 1, pjj ), np, myrow,
308 CALL dgerv2d( ictxt, np, 1, qbuf, np, myrow, njcol )
309 CALL drot( np, q( 1, pjj ), 1, qbuf, 1, c, s )
310 ELSE IF( mycol.EQ.njcol )
THEN
311 CALL dgesd2d( ictxt, np, 1, q( 1, njj ), np, myrow,
313 CALL dgerv2d( ictxt, np, 1, qbuf, np, myrow, pjcol )
314 CALL drot( np, qbuf, 1, q( 1, njj ), 1, c, s )
316 t = d( pj )*c**2 + d( nj )*s**2
317 d( nj ) = d( pj )*s**2 + d( nj )*c**2
323 IF( d( pj ).LT.d( indxp( k2+i ) ) )
THEN
324 indxp( k2+i-1 ) = indxp( k2+i )
337 dlamda( k ) = d( pj )
349 dlamda( k ) = d( pj )
359 DO 90 i = 0, npcol - 1
367 ctot( col, ct ) = ctot( col, ct ) + 1
372 DO 120 col = 0, npcol - 1
374 psm( col, 2 ) = 1 + ctot( col, 1 )
375 psm( col, 3 ) = psm( col, 2 ) + ctot( col, 2 )
376 psm( col, 4 ) = psm( col, 3 ) + ctot( col, 3 )
381 DO 130 j = 0, npcol - 1
382 ct = ct + ctot( j, i-1 )
384 ptt( i ) = ptt( i-1 ) + ct
395 i = indxl2g( psm( col, ct ), nb, col, dcol, npcol )
397 indxc( ptt( ct ) ) = i
398 psm( col, ct ) = psm( col, ct ) + 1
399 ptt( ct ) = ptt( ct ) + 1
405 jjs = indxg2l( js, nb, j, j, npcol )
407 IF( col.EQ.mycol )
THEN
409 jjq2 = indxg2l( i, nb, j, j, npcol )
410 CALL dcopy( np, q( 1, jjs ), 1, q2( 1, jjq2 ), 1 )
418 CALL dcopy( n, d, 1, z, 1 )
428 DO 180 j = 0, npcol - 1
429 ct = ct + ctot( j, i-1 )
431 ptt( i ) = ptt( i-1 ) + ct
437 ib2 = indxc( ptt( 2 ) )
439 DO 200 i = 2, ptt( 3 ) - 1
440 ib1 =
min( ib1, indxc( i ) )
441 ie1 =
max( ie1, indxc( i ) )
443 DO 210 i = ptt( 2 ), ptt( 4 ) - 1
444 ib2 =
min( ib2, indxc( i ) )
445 ie2 =
max( ie2, indxc( i ) )
449 nn =
max( ie1, ie2 ) -
min( ib1, ib2 ) + 1