LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dstev()

subroutine dstev ( character jobz,
integer n,
double precision, dimension( * ) d,
double precision, dimension( * ) e,
double precision, dimension( ldz, * ) z,
integer ldz,
double precision, dimension( * ) work,
integer info )

DSTEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices

Download DSTEV + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DSTEV computes all eigenvalues and, optionally, eigenvectors of a
!> real symmetric tridiagonal matrix A.
!> 
Parameters
[in]JOBZ
!>          JOBZ is CHARACTER*1
!>          = 'N':  Compute eigenvalues only;
!>          = 'V':  Compute eigenvalues and eigenvectors.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix.  N >= 0.
!> 
[in,out]D
!>          D is DOUBLE PRECISION array, dimension (N)
!>          On entry, the n diagonal elements of the tridiagonal matrix
!>          A.
!>          On exit, if INFO = 0, the eigenvalues in ascending order.
!> 
[in,out]E
!>          E is DOUBLE PRECISION array, dimension (N-1)
!>          On entry, the (n-1) subdiagonal elements of the tridiagonal
!>          matrix A, stored in elements 1 to N-1 of E.
!>          On exit, the contents of E are destroyed.
!> 
[out]Z
!>          Z is DOUBLE PRECISION array, dimension (LDZ, N)
!>          If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
!>          eigenvectors of the matrix A, with the i-th column of Z
!>          holding the eigenvector associated with D(i).
!>          If JOBZ = 'N', then Z is not referenced.
!> 
[in]LDZ
!>          LDZ is INTEGER
!>          The leading dimension of the array Z.  LDZ >= 1, and if
!>          JOBZ = 'V', LDZ >= max(1,N).
!> 
[out]WORK
!>          WORK is DOUBLE PRECISION array, dimension (max(1,2*N-2))
!>          If JOBZ = 'N', WORK is not referenced.
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!>          > 0:  if INFO = i, the algorithm failed to converge; i
!>                off-diagonal elements of E did not converge to zero.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 113 of file dstev.f.

114*
115* -- LAPACK driver routine --
116* -- LAPACK is a software package provided by Univ. of Tennessee, --
117* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
118*
119* .. Scalar Arguments ..
120 CHARACTER JOBZ
121 INTEGER INFO, LDZ, N
122* ..
123* .. Array Arguments ..
124 DOUBLE PRECISION D( * ), E( * ), WORK( * ), Z( LDZ, * )
125* ..
126*
127* =====================================================================
128*
129* .. Parameters ..
130 DOUBLE PRECISION ZERO, ONE
131 parameter( zero = 0.0d0, one = 1.0d0 )
132* ..
133* .. Local Scalars ..
134 LOGICAL WANTZ
135 INTEGER IMAX, ISCALE
136 DOUBLE PRECISION BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA, SMLNUM,
137 $ TNRM
138* ..
139* .. External Functions ..
140 LOGICAL LSAME
141 DOUBLE PRECISION DLAMCH, DLANST
142 EXTERNAL lsame, dlamch, dlanst
143* ..
144* .. External Subroutines ..
145 EXTERNAL dscal, dsteqr, dsterf, xerbla
146* ..
147* .. Intrinsic Functions ..
148 INTRINSIC sqrt
149* ..
150* .. Executable Statements ..
151*
152* Test the input parameters.
153*
154 wantz = lsame( jobz, 'V' )
155*
156 info = 0
157 IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
158 info = -1
159 ELSE IF( n.LT.0 ) THEN
160 info = -2
161 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
162 info = -6
163 END IF
164*
165 IF( info.NE.0 ) THEN
166 CALL xerbla( 'DSTEV ', -info )
167 RETURN
168 END IF
169*
170* Quick return if possible
171*
172 IF( n.EQ.0 )
173 $ RETURN
174*
175 IF( n.EQ.1 ) THEN
176 IF( wantz )
177 $ z( 1, 1 ) = one
178 RETURN
179 END IF
180*
181* Get machine constants.
182*
183 safmin = dlamch( 'Safe minimum' )
184 eps = dlamch( 'Precision' )
185 smlnum = safmin / eps
186 bignum = one / smlnum
187 rmin = sqrt( smlnum )
188 rmax = sqrt( bignum )
189*
190* Scale matrix to allowable range, if necessary.
191*
192 iscale = 0
193 tnrm = dlanst( 'M', n, d, e )
194 IF( tnrm.GT.zero .AND. tnrm.LT.rmin ) THEN
195 iscale = 1
196 sigma = rmin / tnrm
197 ELSE IF( tnrm.GT.rmax ) THEN
198 iscale = 1
199 sigma = rmax / tnrm
200 END IF
201 IF( iscale.EQ.1 ) THEN
202 CALL dscal( n, sigma, d, 1 )
203 CALL dscal( n-1, sigma, e( 1 ), 1 )
204 END IF
205*
206* For eigenvalues only, call DSTERF. For eigenvalues and
207* eigenvectors, call DSTEQR.
208*
209 IF( .NOT.wantz ) THEN
210 CALL dsterf( n, d, e, info )
211 ELSE
212 CALL dsteqr( 'I', n, d, e, z, ldz, work, info )
213 END IF
214*
215* If matrix was scaled, then rescale eigenvalues appropriately.
216*
217 IF( iscale.EQ.1 ) THEN
218 IF( info.EQ.0 ) THEN
219 imax = n
220 ELSE
221 imax = info - 1
222 END IF
223 CALL dscal( imax, one / sigma, d, 1 )
224 END IF
225*
226 RETURN
227*
228* End of DSTEV
229*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dlanst(norm, n, d, e)
DLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition dlanst.f:98
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
subroutine dsteqr(compz, n, d, e, z, ldz, work, info)
DSTEQR
Definition dsteqr.f:129
subroutine dsterf(n, d, e, info)
DSTERF
Definition dsterf.f:84
Here is the call graph for this function:
Here is the caller graph for this function: