242 SUBROUTINE slaed8( ICOMPQ, K, N, QSIZ, D, Q, LDQ, INDXQ, RHO,
243 $ cutpnt, z, dlamda, q2, ldq2, w, perm, givptr,
244 $ givcol, givnum, indxp, indx, info )
252 INTEGER CUTPNT, GIVPTR, ICOMPQ, INFO, K, LDQ, LDQ2, N,
257 INTEGER GIVCOL( 2, * ), INDX( * ), INDXP( * ),
258 $ indxq( * ), perm( * )
259 REAL D( * ), DLAMDA( * ), GIVNUM( 2, * ),
260 $ q( ldq, * ), q2( ldq2, * ), w( * ), z( * )
266 REAL MONE, ZERO, ONE, TWO, EIGHT
267 parameter ( mone = -1.0e0, zero = 0.0e0, one = 1.0e0,
268 $ two = 2.0e0, eight = 8.0e0 )
272 INTEGER I, IMAX, J, JLAM, JMAX, JP, K2, N1, N1P1, N2
273 REAL C, EPS, S, T, TAU, TOL
278 EXTERNAL isamax, slamch, slapy2
284 INTRINSIC abs, max, min, sqrt
292 IF( icompq.LT.0 .OR. icompq.GT.1 )
THEN
294 ELSE IF( n.LT.0 )
THEN
296 ELSE IF( icompq.EQ.1 .AND. qsiz.LT.n )
THEN
298 ELSE IF( ldq.LT.max( 1, n ) )
THEN
300 ELSE IF( cutpnt.LT.min( 1, n ) .OR. cutpnt.GT.n )
THEN
302 ELSE IF( ldq2.LT.max( 1, n ) )
THEN
306 CALL xerbla(
'SLAED8', -info )
326 IF( rho.LT.zero )
THEN
327 CALL sscal( n2, mone, z( n1p1 ), 1 )
332 t = one / sqrt( two )
336 CALL sscal( n, t, z, 1 )
341 DO 20 i = cutpnt + 1, n
342 indxq( i ) = indxq( i ) + cutpnt
345 dlamda( i ) = d( indxq( i ) )
346 w( i ) = z( indxq( i ) )
350 CALL slamrg( n1, n2, dlamda, 1, 1, indx )
352 d( i ) = dlamda( indx( i ) )
353 z( i ) = w( indx( i ) )
358 imax = isamax( n, z, 1 )
359 jmax = isamax( n, d, 1 )
360 eps = slamch(
'Epsilon' )
361 tol = eight*eps*abs( d( jmax ) )
367 IF( rho*abs( z( imax ) ).LE.tol )
THEN
369 IF( icompq.EQ.0 )
THEN
371 perm( j ) = indxq( indx( j ) )
375 perm( j ) = indxq( indx( j ) )
376 CALL scopy( qsiz, q( 1, perm( j ) ), 1, q2( 1, j ), 1 )
378 CALL slacpy(
'A', qsiz, n, q2( 1, 1 ), ldq2, q( 1, 1 ),
393 IF( rho*abs( z( j ) ).LE.tol )
THEN
410 IF( rho*abs( z( j ) ).LE.tol )
THEN
427 t = d( j ) - d( jlam )
430 IF( abs( t*c*s ).LE.tol )
THEN
440 givcol( 1, givptr ) = indxq( indx( jlam ) )
441 givcol( 2, givptr ) = indxq( indx( j ) )
442 givnum( 1, givptr ) = c
443 givnum( 2, givptr ) = s
444 IF( icompq.EQ.1 )
THEN
445 CALL srot( qsiz, q( 1, indxq( indx( jlam ) ) ), 1,
446 $ q( 1, indxq( indx( j ) ) ), 1, c, s )
448 t = d( jlam )*c*c + d( j )*s*s
449 d( j ) = d( jlam )*s*s + d( j )*c*c
455 IF( d( jlam ).LT.d( indxp( k2+i ) ) )
THEN
456 indxp( k2+i-1 ) = indxp( k2+i )
461 indxp( k2+i-1 ) = jlam
464 indxp( k2+i-1 ) = jlam
470 dlamda( k ) = d( jlam )
482 dlamda( k ) = d( jlam )
492 IF( icompq.EQ.0 )
THEN
495 dlamda( j ) = d( jp )
496 perm( j ) = indxq( indx( jp ) )
501 dlamda( j ) = d( jp )
502 perm( j ) = indxq( indx( jp ) )
503 CALL scopy( qsiz, q( 1, perm( j ) ), 1, q2( 1, j ), 1 )
511 IF( icompq.EQ.0 )
THEN
512 CALL scopy( n-k, dlamda( k+1 ), 1, d( k+1 ), 1 )
514 CALL scopy( n-k, dlamda( k+1 ), 1, d( k+1 ), 1 )
515 CALL slacpy(
'A', qsiz, n-k, q2( 1, k+1 ), ldq2,
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine slaed8(ICOMPQ, K, N, QSIZ, D, Q, LDQ, INDXQ, RHO, CUTPNT, Z, DLAMDA, Q2, LDQ2, W, PERM, GIVPTR, GIVCOL, GIVNUM, INDXP, INDX, INFO)
SLAED8 used by sstedc. Merges eigenvalues and deflates secular equation. Used when the original matri...
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
subroutine srot(N, SX, INCX, SY, INCY, C, S)
SROT
subroutine slamrg(N1, N2, A, STRD1, STRD2, INDEX)
SLAMRG creates a permutation list to merge the entries of two independently sorted sets into a single...
subroutine sscal(N, SA, SX, INCX)
SSCAL
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY