1 *> \brief <b> DSTEVD computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices</b>
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DSTEVD + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dstevd.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dstevd.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dstevd.f">
21 * SUBROUTINE DSTEVD( JOBZ, N, D, E, Z, LDZ, WORK, LWORK, IWORK,
24 * .. Scalar Arguments ..
26 * INTEGER INFO, LDZ, LIWORK, LWORK, N
28 * .. Array Arguments ..
30 * DOUBLE PRECISION D( * ), E( * ), WORK( * ), Z( LDZ, * )
39 *> DSTEVD computes all eigenvalues and, optionally, eigenvectors of a
40 *> real symmetric tridiagonal matrix. If eigenvectors are desired, it
41 *> uses a divide and conquer algorithm.
43 *> The divide and conquer algorithm makes very mild assumptions about
44 *> floating point arithmetic. It will work on machines with a guard
45 *> digit in add/subtract, or on those binary machines without guard
46 *> digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
47 *> Cray-2. It could conceivably fail on hexadecimal or decimal machines
48 *> without guard digits, but we know of none.
56 *> JOBZ is CHARACTER*1
57 *> = 'N': Compute eigenvalues only;
58 *> = 'V': Compute eigenvalues and eigenvectors.
64 *> The order of the matrix. N >= 0.
69 *> D is DOUBLE PRECISION array, dimension (N)
70 *> On entry, the n diagonal elements of the tridiagonal matrix
72 *> On exit, if INFO = 0, the eigenvalues in ascending order.
77 *> E is DOUBLE PRECISION array, dimension (N-1)
78 *> On entry, the (n-1) subdiagonal elements of the tridiagonal
79 *> matrix A, stored in elements 1 to N-1 of E.
80 *> On exit, the contents of E are destroyed.
85 *> Z is DOUBLE PRECISION array, dimension (LDZ, N)
86 *> If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
87 *> eigenvectors of the matrix A, with the i-th column of Z
88 *> holding the eigenvector associated with D(i).
89 *> If JOBZ = 'N', then Z is not referenced.
95 *> The leading dimension of the array Z. LDZ >= 1, and if
96 *> JOBZ = 'V', LDZ >= max(1,N).
101 *> WORK is DOUBLE PRECISION array,
103 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
109 *> The dimension of the array WORK.
110 *> If JOBZ = 'N' or N <= 1 then LWORK must be at least 1.
111 *> If JOBZ = 'V' and N > 1 then LWORK must be at least
112 *> ( 1 + 4*N + N**2 ).
114 *> If LWORK = -1, then a workspace query is assumed; the routine
115 *> only calculates the optimal sizes of the WORK and IWORK
116 *> arrays, returns these values as the first entries of the WORK
117 *> and IWORK arrays, and no error message related to LWORK or
118 *> LIWORK is issued by XERBLA.
123 *> IWORK is INTEGER array, dimension (MAX(1,LIWORK))
124 *> On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
130 *> The dimension of the array IWORK.
131 *> If JOBZ = 'N' or N <= 1 then LIWORK must be at least 1.
132 *> If JOBZ = 'V' and N > 1 then LIWORK must be at least 3+5*N.
134 *> If LIWORK = -1, then a workspace query is assumed; the
135 *> routine only calculates the optimal sizes of the WORK and
136 *> IWORK arrays, returns these values as the first entries of
137 *> the WORK and IWORK arrays, and no error message related to
138 *> LWORK or LIWORK is issued by XERBLA.
144 *> = 0: successful exit
145 *> < 0: if INFO = -i, the i-th argument had an illegal value
146 *> > 0: if INFO = i, the algorithm failed to converge; i
147 *> off-diagonal elements of E did not converge to zero.
153 *> \author Univ. of Tennessee
154 *> \author Univ. of California Berkeley
155 *> \author Univ. of Colorado Denver
158 *> \date November 2011
160 *> \ingroup doubleOTHEReigen
162 * =====================================================================
163 SUBROUTINE DSTEVD( JOBZ, N, D, E, Z, LDZ, WORK, LWORK, IWORK,
166 * -- LAPACK driver routine (version 3.4.0) --
167 * -- LAPACK is a software package provided by Univ. of Tennessee, --
168 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
171 * .. Scalar Arguments ..
173 INTEGER INFO, LDZ, LIWORK, LWORK, N
175 * .. Array Arguments ..
177 DOUBLE PRECISION D( * ), E( * ), WORK( * ), Z( LDZ, * )
180 * =====================================================================
183 DOUBLE PRECISION ZERO, ONE
184 PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
186 * .. Local Scalars ..
187 LOGICAL LQUERY, WANTZ
188 INTEGER ISCALE, LIWMIN, LWMIN
189 DOUBLE PRECISION BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA, SMLNUM,
192 * .. External Functions ..
194 DOUBLE PRECISION DLAMCH, DLANST
195 EXTERNAL LSAME, DLAMCH, DLANST
197 * .. External Subroutines ..
198 EXTERNAL DSCAL, DSTEDC, DSTERF, XERBLA
200 * .. Intrinsic Functions ..
203 * .. Executable Statements ..
205 * Test the input parameters.
207 WANTZ = LSAME( JOBZ, 'V' )
208 LQUERY = ( LWORK.EQ.-1 .OR. LIWORK.EQ.-1 )
213 IF( N.GT.1 .AND. WANTZ ) THEN
214 LWMIN = 1 + 4*N + N**2
218 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
220 ELSE IF( N.LT.0 ) THEN
222 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
230 IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
232 ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
238 CALL XERBLA( 'DSTEVD', -INFO )
240 ELSE IF( LQUERY ) THEN
244 * Quick return if possible
255 * Get machine constants.
257 SAFMIN = DLAMCH( 'Safe minimum' )
258 EPS = DLAMCH( 'Precision' )
259 SMLNUM = SAFMIN / EPS
260 BIGNUM = ONE / SMLNUM
261 RMIN = SQRT( SMLNUM )
262 RMAX = SQRT( BIGNUM )
264 * Scale matrix to allowable range, if necessary.
267 TNRM = DLANST( 'M', N, D, E )
268 IF( TNRM.GT.ZERO .AND. TNRM.LT.RMIN ) THEN
271 ELSE IF( TNRM.GT.RMAX ) THEN
275 IF( ISCALE.EQ.1 ) THEN
276 CALL DSCAL( N, SIGMA, D, 1 )
277 CALL DSCAL( N-1, SIGMA, E( 1 ), 1 )
280 * For eigenvalues only, call DSTERF. For eigenvalues and
281 * eigenvectors, call DSTEDC.
283 IF( .NOT.WANTZ ) THEN
284 CALL DSTERF( N, D, E, INFO )
286 CALL DSTEDC( 'I', N, D, E, Z, LDZ, WORK, LWORK, IWORK, LIWORK,
290 * If matrix was scaled, then rescale eigenvalues appropriately.
293 $ CALL DSCAL( N, ONE / SIGMA, D, 1 )