1 SUBROUTINE pslaed2( 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 REAL D( * ), DLAMDA( * ), Q( LDQ, * ),
21 $ Q2( LDQ2, * ), QBUF( * ), W( * ), Z( * )
152 REAL MONE, ZERO, ONE, TWO, EIGHT
153 PARAMETER ( MONE = -1.0e0, zero = 0.0e0, one = 1.0e0,
154 $ two = 2.0e0, eight = 8.0e0 )
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 REAL C, EPS, S, T, TAU, TOL
163 INTEGER INDXG2L, INDXL2G, ISAMAX, NUMROC
165 EXTERNAL INDXG2L, INDXL2G, ISAMAX, NUMROC, PSLAMCH,
169 EXTERNAL blacs_gridinfo, blacs_pinfo,
infog1l, scopy,
170 $ sgerv2d, sgesd2d,
slapst, srot, sscal
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 sscal( n2, mone, z( n1p1 ), 1 )
201 t = one / sqrt( two )
202 CALL sscal( n, t, z, 1 )
210 imax = isamax( n, z, 1 )
211 jmax = isamax( n, d, 1 )
212 eps = pslamch( ictxt,
'Epsilon' )
213 tol = eight*eps*
max( abs( d( jmax ) ), abs( z( imax ) ) )
219 IF( rho*abs( z( imax ) ).LE.tol )
THEN
231 CALL slapst(
'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 srot( np, q( 1, pjj ), 1, q( 1, njj ), 1, c, s )
305 ELSE IF( mycol.EQ.pjcol )
THEN
306 CALL sgesd2d( ictxt, np, 1, q( 1, pjj ), np, myrow,
308 CALL sgerv2d( ictxt, np, 1, qbuf, np, myrow, njcol )
309 CALL srot( np, q( 1, pjj ), 1, qbuf, 1, c, s )
310 ELSE IF( mycol.EQ.njcol )
THEN
311 CALL sgesd2d( ictxt, np, 1, q( 1, njj ), np, myrow,
313 CALL sgerv2d( ictxt, np, 1, qbuf, np, myrow, pjcol )
314 CALL srot( 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
403 jjs = indxg2l( js, nb, j, j, npcol )
405 IF( col.EQ.mycol )
THEN
407 jjq2 = indxg2l( i, nb, j, j, npcol )
408 CALL scopy( np, q( 1, jjs ), 1, q2( 1, jjq2 ), 1 )
416 CALL scopy( n, d, 1, z, 1 )
426 DO 180 j = 0, npcol - 1
427 ct = ct + ctot( j, i-1 )
429 ptt( i ) = ptt( i-1 ) + ct
435 ib2 = indxc( ptt( 2 ) )
437 DO 200 i = 2, ptt( 3 ) - 1
438 ib1 =
min( ib1, indxc( i ) )
439 ie1 =
max( ie1, indxc( i ) )
441 DO 210 i = ptt( 2 ), ptt( 4 ) - 1
442 ib2 =
min( ib2, indxc( i ) )
443 ie2 =
max( ie2, indxc( i ) )
447 nn =
max( ie1, ie2 ) -
min( ib1, ib2 ) + 1