173 SUBROUTINE dsyevd( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK,
183 INTEGER INFO, LDA, LIWORK, LWORK, N
187 DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * )
193 DOUBLE PRECISION ZERO, ONE
194 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
198 LOGICAL LOWER, LQUERY, WANTZ
199 INTEGER IINFO, INDE, INDTAU, INDWK2, INDWRK, ISCALE,
200 $ liopt, liwmin, llwork, llwrk2, lopt, lwmin
201 DOUBLE PRECISION ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
207 DOUBLE PRECISION DLAMCH, DLANSY
208 EXTERNAL lsame, dlamch, dlansy, ilaenv
222 wantz = lsame( jobz,
'V' )
223 lower = lsame( uplo,
'L' )
224 lquery = ( lwork.EQ.-1 .OR. liwork.EQ.-1 )
227 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
229 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
231 ELSE IF( n.LT.0 )
THEN
233 ELSE IF( lda.LT.max( 1, n ) )
THEN
246 lwmin = 1 + 6*n + 2*n**2
251 lopt = max( lwmin, 2*n +
252 $ n*ilaenv( 1,
'DSYTRD', uplo, n, -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 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 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 dormtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
DORMTR