197 SUBROUTINE cheevd( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK,
198 $ LRWORK, IWORK, LIWORK, INFO )
206 INTEGER INFO, LDA, LIWORK, LRWORK, LWORK, N
210 REAL RWORK( * ), W( * )
211 COMPLEX A( LDA, * ), WORK( * )
218 parameter( zero = 0.0e0, one = 1.0e0 )
220 parameter( cone = ( 1.0e0, 0.0e0 ) )
223 LOGICAL LOWER, LQUERY, WANTZ
224 INTEGER IINFO, IMAX, INDE, INDRWK, INDTAU, INDWK2,
225 $ indwrk, iscale, liopt, liwmin, llrwk, llwork,
226 $ llwrk2, lopt, lropt, lrwmin, lwmin
227 REAL ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
233 REAL CLANHE, SLAMCH, SROUNDUP_LWORK
234 EXTERNAL ilaenv, lsame, clanhe, slamch, sroundup_lwork
247 wantz = lsame( jobz,
'V' )
248 lower = lsame( uplo,
'L' )
249 lquery = ( lwork.EQ.-1 .OR. lrwork.EQ.-1 .OR. liwork.EQ.-1 )
252 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
254 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
256 ELSE IF( n.LT.0 )
THEN
258 ELSE IF( lda.LT.max( 1, n ) )
THEN
273 lrwmin = 1 + 5*n + 2*n**2
280 lopt = max( lwmin, n +
281 $ n*ilaenv( 1,
'CHETRD', uplo, n, -1, -1, -1 ) )
285 work( 1 ) = sroundup_lwork(lopt)
289 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
291 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery )
THEN
293 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
299 CALL xerbla(
'CHEEVD', -info )
301 ELSE IF( lquery )
THEN
311 w( 1 ) = real( a( 1, 1 ) )
319 safmin = slamch(
'Safe minimum' )
320 eps = slamch(
'Precision' )
321 smlnum = safmin / eps
322 bignum = one / smlnum
323 rmin = sqrt( smlnum )
324 rmax = sqrt( bignum )
328 anrm = clanhe(
'M', uplo, n, a, lda, rwork )
330 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
333 ELSE IF( anrm.GT.rmax )
THEN
338 $
CALL clascl( uplo, 0, 0, one, sigma, n, n, a, lda, info )
346 indwk2 = indwrk + n*n
347 llwork = lwork - indwrk + 1
348 llwrk2 = lwork - indwk2 + 1
349 llrwk = lrwork - indrwk + 1
350 CALL chetrd( uplo, n, a, lda, w, rwork( inde ), work( indtau ),
351 $ work( indwrk ), llwork, iinfo )
359 IF( .NOT.wantz )
THEN
360 CALL ssterf( n, w, rwork( inde ), info )
362 CALL cstedc(
'I', n, w, rwork( inde ), work( indwrk ), n,
363 $ work( indwk2 ), llwrk2, rwork( indrwk ), llrwk,
364 $ iwork, liwork, info )
365 CALL cunmtr(
'L', uplo,
'N', n, n, a, lda, work( indtau ),
366 $ work( indwrk ), n, work( indwk2 ), llwrk2, iinfo )
367 CALL clacpy(
'A', n, n, work( indwrk ), n, a, lda )
372 IF( iscale.EQ.1 )
THEN
378 CALL sscal( imax, one / sigma, w, 1 )
381 work( 1 ) = sroundup_lwork(lopt)
subroutine xerbla(srname, info)
subroutine cheevd(jobz, uplo, n, a, lda, w, work, lwork, rwork, lrwork, iwork, liwork, info)
CHEEVD computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices
subroutine chetrd(uplo, n, a, lda, d, e, tau, work, lwork, info)
CHETRD
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine clascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine cstedc(compz, n, d, e, z, ldz, work, lwork, rwork, lrwork, iwork, liwork, info)
CSTEDC
subroutine ssterf(n, d, e, info)
SSTERF
subroutine cunmtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
CUNMTR