204 SUBROUTINE zstedc( COMPZ, N, D, E, Z, LDZ, WORK, LWORK, RWORK,
205 $ LRWORK, IWORK, LIWORK, INFO )
213 INTEGER INFO, LDZ, LIWORK, LRWORK, LWORK, N
217 DOUBLE PRECISION D( * ), E( * ), RWORK( * )
218 COMPLEX*16 WORK( * ), Z( LDZ, * )
224 DOUBLE PRECISION ZERO, ONE, TWO
225 parameter( zero = 0.0d0, one = 1.0d0, two = 2.0d0 )
229 INTEGER FINISH, I, ICOMPZ, II, J, K, LGN, LIWMIN, LL,
230 $ lrwmin, lwmin, m, smlsiz, start
231 DOUBLE PRECISION EPS, ORGNRM, P, TINY
236 DOUBLE PRECISION DLAMCH, DLANST
237 EXTERNAL lsame, ilaenv, dlamch, dlanst
244 INTRINSIC abs, dble, int, log, max, mod, sqrt
251 lquery = ( lwork.EQ.-1 .OR. lrwork.EQ.-1 .OR. liwork.EQ.-1 )
253 IF( lsame( compz,
'N' ) )
THEN
255 ELSE IF( lsame( compz,
'V' ) )
THEN
257 ELSE IF( lsame( compz,
'I' ) )
THEN
262 IF( icompz.LT.0 )
THEN
264 ELSE IF( n.LT.0 )
THEN
266 ELSE IF( ( ldz.LT.1 ) .OR.
267 $ ( icompz.GT.0 .AND. ldz.LT.max( 1, n ) ) )
THEN
275 smlsiz = ilaenv( 9,
'ZSTEDC',
' ', 0, 0, 0, 0 )
276 IF( n.LE.1 .OR. icompz.EQ.0 )
THEN
280 ELSE IF( n.LE.smlsiz )
THEN
284 ELSE IF( icompz.EQ.1 )
THEN
285 lgn = int( log( dble( n ) ) / log( two ) )
291 lrwmin = 1 + 3*n + 2*n*lgn + 4*n**2
292 liwmin = 6 + 6*n + 5*n*lgn
293 ELSE IF( icompz.EQ.2 )
THEN
295 lrwmin = 1 + 4*n + 2*n**2
302 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
304 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery )
THEN
306 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
312 CALL xerbla(
'ZSTEDC', -info )
314 ELSE IF( lquery )
THEN
339 IF( icompz.EQ.0 )
THEN
340 CALL dsterf( n, d, e, info )
347 IF( n.LE.smlsiz )
THEN
349 CALL zsteqr( compz, n, d, e, z, ldz, rwork, info )
355 IF( icompz.EQ.2 )
THEN
356 CALL dlaset(
'Full', n, n, zero, one, rwork, n )
358 CALL dstedc(
'I', n, d, e, rwork, n,
359 $ rwork( ll ), lrwork-ll+1, iwork, liwork, info )
362 z( i, j ) = rwork( ( j-1 )*n+i )
373 orgnrm = dlanst(
'M', n, d, e )
377 eps = dlamch(
'Epsilon' )
384 IF( start.LE.n )
THEN
394 IF( finish.LT.n )
THEN
395 tiny = eps*sqrt( abs( d( finish ) ) )*
396 $ sqrt( abs( d( finish+1 ) ) )
397 IF( abs( e( finish ) ).GT.tiny )
THEN
405 m = finish - start + 1
406 IF( m.GT.smlsiz )
THEN
410 orgnrm = dlanst(
'M', m, d( start ), e( start ) )
411 CALL dlascl(
'G', 0, 0, orgnrm, one, m, 1, d( start ), m,
413 CALL dlascl(
'G', 0, 0, orgnrm, one, m-1, 1, e( start ),
416 CALL zlaed0( n, m, d( start ), e( start ), z( 1, start ),
417 $ ldz, work, n, rwork, iwork, info )
419 info = ( info / ( m+1 )+start-1 )*( n+1 ) +
420 $ mod( info, ( m+1 ) ) + start - 1
426 CALL dlascl(
'G', 0, 0, one, orgnrm, m, 1, d( start ), m,
430 CALL dsteqr(
'I', m, d( start ), e( start ), rwork, m,
431 $ rwork( m*m+1 ), info )
432 CALL zlacrm( n, m, z( 1, start ), ldz, rwork, m, work, n,
434 CALL zlacpy(
'A', n, m, work, n, z( 1, start ), ldz )
436 info = start*( n+1 ) + finish
455 IF( d( j ).LT.p )
THEN
463 CALL zswap( n, z( 1, i ), 1, z( 1, k ), 1 )
subroutine xerbla(srname, info)
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlacrm(m, n, a, lda, b, ldb, c, ldc, rwork)
ZLACRM multiplies a complex matrix by a square real matrix.
subroutine zlaed0(qsiz, n, d, e, q, ldq, qstore, ldqs, rwork, iwork, info)
ZLAED0 used by ZSTEDC. Computes all eigenvalues and corresponding eigenvectors of an unreduced symmet...
subroutine dlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine zstedc(compz, n, d, e, z, ldz, work, lwork, rwork, lrwork, iwork, liwork, info)
ZSTEDC
subroutine dstedc(compz, n, d, e, z, ldz, work, lwork, iwork, liwork, info)
DSTEDC
subroutine zsteqr(compz, n, d, e, z, ldz, work, info)
ZSTEQR
subroutine dsteqr(compz, n, d, e, z, ldz, work, info)
DSTEQR
subroutine dsterf(n, d, e, info)
DSTERF
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP