197 SUBROUTINE zheevd( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK,
198 $ LRWORK, IWORK, LIWORK, INFO )
206 INTEGER INFO, LDA, LIWORK, LRWORK, LWORK, N
210 DOUBLE PRECISION RWORK( * ), W( * )
211 COMPLEX*16 A( LDA, * ), WORK( * )
217 DOUBLE PRECISION ZERO, ONE
218 parameter( zero = 0.0d0, one = 1.0d0 )
220 parameter( cone = ( 1.0d0, 0.0d0 ) )
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 DOUBLE PRECISION ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
233 DOUBLE PRECISION DLAMCH, ZLANHE
234 EXTERNAL lsame, ilaenv, dlamch, zlanhe
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,
'ZHETRD', uplo, n, -1, -1, -1 ) )
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(
'ZHEEVD', -info )
301 ELSE IF( lquery )
THEN
311 w( 1 ) = dble( a( 1, 1 ) )
319 safmin = dlamch(
'Safe minimum' )
320 eps = dlamch(
'Precision' )
321 smlnum = safmin / eps
322 bignum = one / smlnum
323 rmin = sqrt( smlnum )
324 rmax = sqrt( bignum )
328 anrm = zlanhe(
'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 zlascl( 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 zhetrd( uplo, n, a, lda, w, rwork( inde ), work( indtau ),
351 $ work( indwrk ), llwork, iinfo )
359 IF( .NOT.wantz )
THEN
360 CALL dsterf( n, w, rwork( inde ), info )
362 CALL zstedc(
'I', n, w, rwork( inde ), work( indwrk ), n,
363 $ work( indwk2 ), llwrk2, rwork( indrwk ), llrwk,
364 $ iwork, liwork, info )
365 CALL zunmtr(
'L', uplo,
'N', n, n, a, lda, work( indtau ),
366 $ work( indwrk ), n, work( indwk2 ), llwrk2, iinfo )
367 CALL zlacpy(
'A', n, n, work( indwrk ), n, a, lda )
372 IF( iscale.EQ.1 )
THEN
378 CALL dscal( imax, one / sigma, w, 1 )
subroutine xerbla(srname, info)
subroutine zheevd(jobz, uplo, n, a, lda, w, work, lwork, rwork, lrwork, iwork, liwork, info)
ZHEEVD computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices
subroutine zhetrd(uplo, n, a, lda, d, e, tau, work, lwork, info)
ZHETRD
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine zstedc(compz, n, d, e, z, ldz, work, lwork, rwork, lrwork, iwork, liwork, info)
ZSTEDC
subroutine dsterf(n, d, e, info)
DSTERF
subroutine zunmtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
ZUNMTR