136 SUBROUTINE cheev( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK,
145 INTEGER INFO, LDA, LWORK, N
148 REAL RWORK( * ), W( * )
149 COMPLEX A( LDA, * ), WORK( * )
156 parameter( zero = 0.0e0, one = 1.0e0 )
158 parameter( cone = ( 1.0e0, 0.0e0 ) )
161 LOGICAL LOWER, LQUERY, WANTZ
162 INTEGER IINFO, IMAX, INDE, INDTAU, INDWRK, ISCALE,
164 REAL ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
170 REAL CLANHE, SLAMCH, SROUNDUP_LWORK
171 EXTERNAL ilaenv, lsame, clanhe,
172 $ slamch, sroundup_lwork
186 wantz = lsame( jobz,
'V' )
187 lower = lsame( uplo,
'L' )
188 lquery = ( lwork.EQ.-1 )
191 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
193 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
195 ELSE IF( n.LT.0 )
THEN
197 ELSE IF( lda.LT.max( 1, n ) )
THEN
202 nb = ilaenv( 1,
'CHETRD', uplo, n, -1, -1, -1 )
203 lwkopt = max( 1, ( nb+1 )*n )
204 work( 1 ) = sroundup_lwork(lwkopt)
206 IF( lwork.LT.max( 1, 2*n-1 ) .AND. .NOT.lquery )
211 CALL xerbla(
'CHEEV ', -info )
213 ELSE IF( lquery )
THEN
224 w( 1 ) = real( a( 1, 1 ) )
233 safmin = slamch(
'Safe minimum' )
234 eps = slamch(
'Precision' )
235 smlnum = safmin / eps
236 bignum = one / smlnum
237 rmin = sqrt( smlnum )
238 rmax = sqrt( bignum )
242 anrm = clanhe(
'M', uplo, n, a, lda, rwork )
244 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
247 ELSE IF( anrm.GT.rmax )
THEN
252 $
CALL clascl( uplo, 0, 0, one, sigma, n, n, a, lda, info )
259 llwork = lwork - indwrk + 1
260 CALL chetrd( uplo, n, a, lda, w, rwork( inde ), work( indtau ),
261 $ work( indwrk ), llwork, iinfo )
266 IF( .NOT.wantz )
THEN
267 CALL ssterf( n, w, rwork( inde ), info )
269 CALL cungtr( uplo, n, a, lda, work( indtau ),
273 CALL csteqr( jobz, n, w, rwork( inde ), a, lda,
274 $ rwork( indwrk ), info )
279 IF( iscale.EQ.1 )
THEN
285 CALL sscal( imax, one / sigma, w, 1 )
290 work( 1 ) = sroundup_lwork(lwkopt)
subroutine cheev(jobz, uplo, n, a, lda, w, work, lwork, rwork, info)
CHEEV 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 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.