140 SUBROUTINE cheev( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK,
150 INTEGER info, lda, lwork, n
153 REAL rwork( * ), w( * )
154 COMPLEX a( lda, * ), work( * )
161 parameter( zero = 0.0e0, one = 1.0e0 )
163 parameter( cone = ( 1.0e0, 0.0e0 ) )
166 LOGICAL lower, lquery, wantz
167 INTEGER iinfo, imax, inde, indtau, indwrk, iscale,
169 REAL anrm, bignum, eps, rmax, rmin, safmin, sigma,
189 wantz =
lsame( jobz,
'V' )
190 lower =
lsame( uplo,
'L' )
191 lquery = ( lwork.EQ.-1 )
194 IF( .NOT.( wantz .OR.
lsame( jobz,
'N' ) ) )
THEN
196 ELSE IF( .NOT.( lower .OR.
lsame( uplo,
'U' ) ) )
THEN
198 ELSE IF( n.LT.0 )
THEN
200 ELSE IF( lda.LT.max( 1, n ) )
THEN
205 nb =
ilaenv( 1,
'CHETRD', uplo, n, -1, -1, -1 )
206 lwkopt = max( 1, ( nb+1 )*n )
209 IF( lwork.LT.max( 1, 2*n-1 ) .AND. .NOT.lquery )
214 CALL
xerbla(
'CHEEV ', -info )
216 ELSE IF( lquery )
THEN
236 safmin =
slamch(
'Safe minimum' )
237 eps =
slamch(
'Precision' )
238 smlnum = safmin / eps
239 bignum = one / smlnum
240 rmin = sqrt( smlnum )
241 rmax = sqrt( bignum )
245 anrm =
clanhe(
'M', uplo, n, a, lda, rwork )
247 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
250 ELSE IF( anrm.GT.rmax )
THEN
255 $ CALL
clascl( uplo, 0, 0, one, sigma, n, n, a, lda, info )
262 llwork = lwork - indwrk + 1
263 CALL
chetrd( uplo, n, a, lda, w, rwork( inde ), work( indtau ),
264 $ work( indwrk ), llwork, iinfo )
269 IF( .NOT.wantz )
THEN
270 CALL
ssterf( n, w, rwork( inde ), info )
272 CALL
cungtr( uplo, n, a, lda, work( indtau ), work( indwrk ),
275 CALL
csteqr( jobz, n, w, rwork( inde ), a, lda,
276 $ rwork( indwrk ), info )
281 IF( iscale.EQ.1 )
THEN
287 CALL
sscal( imax, one / sigma, w, 1 )