204 SUBROUTINE cstedc( COMPZ, N, D, E, Z, LDZ, WORK, LWORK, RWORK,
205 $ LRWORK, IWORK, LIWORK, INFO )
213 INTEGER INFO, LDZ, LIWORK, LRWORK, LWORK, N
217 REAL D( * ), E( * ), RWORK( * )
218 COMPLEX WORK( * ), Z( LDZ, * )
225 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0 )
229 INTEGER FINISH, I, ICOMPZ, II, J, K, LGN, LIWMIN, LL,
230 $ lrwmin, lwmin, m, smlsiz, start
231 REAL EPS, ORGNRM, P, TINY
236 REAL SLAMCH, SLANST, SROUNDUP_LWORK
237 EXTERNAL ilaenv, lsame, slamch, slanst, sroundup_lwork
244 INTRINSIC abs, int, log, max, mod, real, 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,
'CSTEDC',
' ', 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( real( 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
298 work( 1 ) = sroundup_lwork(lwmin)
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(
'CSTEDC', -info )
314 ELSE IF( lquery )
THEN
339 IF( icompz.EQ.0 )
THEN
340 CALL ssterf( n, d, e, info )
347 IF( n.LE.smlsiz )
THEN
349 CALL csteqr( compz, n, d, e, z, ldz, rwork, info )
355 IF( icompz.EQ.2 )
THEN
356 CALL slaset(
'Full', n, n, zero, one, rwork, n )
358 CALL sstedc(
'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 = slanst(
'M', n, d, e )
377 eps = slamch(
'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 = slanst(
'M', m, d( start ), e( start ) )
411 CALL slascl(
'G', 0, 0, orgnrm, one, m, 1, d( start ), m,
413 CALL slascl(
'G', 0, 0, orgnrm, one, m-1, 1, e( start ),
416 CALL claed0( 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 slascl(
'G', 0, 0, one, orgnrm, m, 1, d( start ), m,
430 CALL ssteqr(
'I', m, d( start ), e( start ), rwork, m,
431 $ rwork( m*m+1 ), info )
432 CALL clacrm( n, m, z( 1, start ), ldz, rwork, m, work, n,
434 CALL clacpy(
'A', n, m, work, n, z( 1, start ), ldz )
436 info = start*( n+1 ) + finish
455 IF( d( j ).LT.p )
THEN
463 CALL cswap( n, z( 1, i ), 1, z( 1, k ), 1 )
469 work( 1 ) = sroundup_lwork(lwmin)
subroutine xerbla(srname, info)
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine clacrm(m, n, a, lda, b, ldb, c, ldc, rwork)
CLACRM multiplies a complex matrix by a square real matrix.
subroutine claed0(qsiz, n, d, e, q, ldq, qstore, ldqs, rwork, iwork, info)
CLAED0 used by CSTEDC. Computes all eigenvalues and corresponding eigenvectors of an unreduced symmet...
subroutine slascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine sstedc(compz, n, d, e, z, ldz, work, lwork, iwork, liwork, info)
SSTEDC
subroutine cstedc(compz, n, d, e, z, ldz, work, lwork, rwork, lrwork, iwork, liwork, info)
CSTEDC
subroutine ssteqr(compz, n, d, e, z, ldz, work, info)
SSTEQR
subroutine csteqr(compz, n, d, e, z, ldz, work, info)
CSTEQR
subroutine ssterf(n, d, e, info)
SSTERF
subroutine cswap(n, cx, incx, cy, incy)
CSWAP