176 SUBROUTINE dsyevd( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, IWORK,
185 INTEGER INFO, LDA, LIWORK, LWORK, N
189 DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * )
195 DOUBLE PRECISION ZERO, ONE
196 parameter( zero = 0.0d+0, one = 1.0d+0 )
200 LOGICAL LOWER, LQUERY, WANTZ
201 INTEGER IINFO, INDE, INDTAU, INDWK2, INDWRK, ISCALE,
202 $ liopt, liwmin, llwork, llwrk2, lopt, lwmin
203 DOUBLE PRECISION ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
209 DOUBLE PRECISION DLAMCH, DLANSY
210 EXTERNAL lsame, dlamch, dlansy, ilaenv
223 wantz = lsame( jobz,
'V' )
224 lower = lsame( uplo,
'L' )
225 lquery = ( lwork.EQ.-1 .OR. liwork.EQ.-1 )
228 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
230 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
232 ELSE IF( n.LT.0 )
THEN
234 ELSE IF( lda.LT.max( 1, n ) )
THEN
247 lwmin = 1 + 6*n + 2*n**2
252 lopt = max( lwmin, 2*n +
253 $ n*ilaenv( 1,
'DSYTRD', uplo, n, -1, -1, -1 ) )
259 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
261 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
267 CALL xerbla(
'DSYEVD', -info )
269 ELSE IF( lquery )
THEN
287 safmin = dlamch(
'Safe minimum' )
288 eps = dlamch(
'Precision' )
289 smlnum = safmin / eps
290 bignum = one / smlnum
291 rmin = sqrt( smlnum )
292 rmax = sqrt( bignum )
296 anrm = dlansy(
'M', uplo, n, a, lda, work )
298 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
301 ELSE IF( anrm.GT.rmax )
THEN
306 $
CALL dlascl( uplo, 0, 0, one, sigma, n, n, a, lda, info )
313 llwork = lwork - indwrk + 1
314 indwk2 = indwrk + n*n
315 llwrk2 = lwork - indwk2 + 1
317 CALL dsytrd( uplo, n, a, lda, w, work( inde ), work( indtau ),
318 $ work( indwrk ), llwork, iinfo )
325 IF( .NOT.wantz )
THEN
326 CALL dsterf( n, w, work( inde ), info )
328 CALL dstedc(
'I', n, w, work( inde ), work( indwrk ), n,
329 $ work( indwk2 ), llwrk2, iwork, liwork, info )
330 CALL dormtr(
'L', uplo,
'N', n, n, a, lda, work( indtau ),
331 $ work( indwrk ), n, work( indwk2 ), llwrk2, iinfo )
332 CALL dlacpy(
'A', n, n, work( indwrk ), n, a, lda )
338 $
CALL dscal( n, one / sigma, w, 1 )
subroutine xerbla(srname, info)
subroutine dsyevd(jobz, uplo, n, a, lda, w, work, lwork, iwork, liwork, info)
DSYEVD computes the eigenvalues and, optionally, the left and/or right eigenvectors for SY matrices
subroutine dsytrd(uplo, n, a, lda, d, e, tau, work, lwork, info)
DSYTRD
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine dstedc(compz, n, d, e, z, ldz, work, lwork, iwork, liwork, info)
DSTEDC
subroutine dsterf(n, d, e, info)
DSTERF
subroutine dormtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
DORMTR