1 *> \brief <b> DSBEV 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 DSBEV + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dsbev.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dsbev.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dsbev.f">
21 * SUBROUTINE DSBEV( JOBZ, UPLO, N, KD, AB, LDAB, W, Z, LDZ, WORK,
24 * .. Scalar Arguments ..
25 * CHARACTER JOBZ, UPLO
26 * INTEGER INFO, KD, LDAB, LDZ, N
28 * .. Array Arguments ..
29 * DOUBLE PRECISION AB( LDAB, * ), W( * ), WORK( * ), Z( LDZ, * )
38 *> DSBEV computes all the eigenvalues and, optionally, eigenvectors of
39 *> a real symmetric band matrix A.
47 *> JOBZ is CHARACTER*1
48 *> = 'N': Compute eigenvalues only;
49 *> = 'V': Compute eigenvalues and eigenvectors.
54 *> UPLO is CHARACTER*1
55 *> = 'U': Upper triangle of A is stored;
56 *> = 'L': Lower triangle of A is stored.
62 *> The order of the matrix A. N >= 0.
68 *> The number of superdiagonals of the matrix A if UPLO = 'U',
69 *> or the number of subdiagonals if UPLO = 'L'. KD >= 0.
74 *> AB is DOUBLE PRECISION array, dimension (LDAB, N)
75 *> On entry, the upper or lower triangle of the symmetric band
76 *> matrix A, stored in the first KD+1 rows of the array. The
77 *> j-th column of A is stored in the j-th column of the array AB
79 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
80 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
82 *> On exit, AB is overwritten by values generated during the
83 *> reduction to tridiagonal form. If UPLO = 'U', the first
84 *> superdiagonal and the diagonal of the tridiagonal matrix T
85 *> are returned in rows KD and KD+1 of AB, and if UPLO = 'L',
86 *> the diagonal and first subdiagonal of T are returned in the
87 *> first two rows of AB.
93 *> The leading dimension of the array AB. LDAB >= KD + 1.
98 *> W is DOUBLE PRECISION array, dimension (N)
99 *> If INFO = 0, the eigenvalues in ascending order.
104 *> Z is DOUBLE PRECISION array, dimension (LDZ, N)
105 *> If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
106 *> eigenvectors of the matrix A, with the i-th column of Z
107 *> holding the eigenvector associated with W(i).
108 *> If JOBZ = 'N', then Z is not referenced.
114 *> The leading dimension of the array Z. LDZ >= 1, and if
115 *> JOBZ = 'V', LDZ >= max(1,N).
120 *> WORK is DOUBLE PRECISION array, dimension (max(1,3*N-2))
126 *> = 0: successful exit
127 *> < 0: if INFO = -i, the i-th argument had an illegal value
128 *> > 0: if INFO = i, the algorithm failed to converge; i
129 *> off-diagonal elements of an intermediate tridiagonal
130 *> form did not converge to zero.
136 *> \author Univ. of Tennessee
137 *> \author Univ. of California Berkeley
138 *> \author Univ. of Colorado Denver
141 *> \date November 2011
143 *> \ingroup doubleOTHEReigen
145 * =====================================================================
146 SUBROUTINE DSBEV( JOBZ, UPLO, N, KD, AB, LDAB, W, Z, LDZ, WORK,
149 * -- LAPACK driver routine (version 3.4.0) --
150 * -- LAPACK is a software package provided by Univ. of Tennessee, --
151 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
154 * .. Scalar Arguments ..
156 INTEGER INFO, KD, LDAB, LDZ, N
158 * .. Array Arguments ..
159 DOUBLE PRECISION AB( LDAB, * ), W( * ), WORK( * ), Z( LDZ, * )
162 * =====================================================================
165 DOUBLE PRECISION ZERO, ONE
166 PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
168 * .. Local Scalars ..
170 INTEGER IINFO, IMAX, INDE, INDWRK, ISCALE
171 DOUBLE PRECISION ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
174 * .. External Functions ..
176 DOUBLE PRECISION DLAMCH, DLANSB
177 EXTERNAL LSAME, DLAMCH, DLANSB
179 * .. External Subroutines ..
180 EXTERNAL DLASCL, DSBTRD, DSCAL, DSTEQR, DSTERF, XERBLA
182 * .. Intrinsic Functions ..
185 * .. Executable Statements ..
187 * Test the input parameters.
189 WANTZ = LSAME( JOBZ, 'V' )
190 LOWER = LSAME( UPLO, 'L' )
193 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
195 ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN
197 ELSE IF( N.LT.0 ) THEN
199 ELSE IF( KD.LT.0 ) THEN
201 ELSE IF( LDAB.LT.KD+1 ) THEN
203 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
208 CALL XERBLA( 'DSBEV ', -INFO )
212 * Quick return if possible
221 W( 1 ) = AB( KD+1, 1 )
228 * Get machine constants.
230 SAFMIN = DLAMCH( 'Safe minimum' )
231 EPS = DLAMCH( 'Precision' )
232 SMLNUM = SAFMIN / EPS
233 BIGNUM = ONE / SMLNUM
234 RMIN = SQRT( SMLNUM )
235 RMAX = SQRT( BIGNUM )
237 * Scale matrix to allowable range, if necessary.
239 ANRM = DLANSB( 'M', UPLO, N, KD, AB, LDAB, WORK )
241 IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
244 ELSE IF( ANRM.GT.RMAX ) THEN
248 IF( ISCALE.EQ.1 ) THEN
250 CALL DLASCL( 'B', KD, KD, ONE, SIGMA, N, N, AB, LDAB, INFO )
252 CALL DLASCL( 'Q', KD, KD, ONE, SIGMA, N, N, AB, LDAB, INFO )
256 * Call DSBTRD to reduce symmetric band matrix to tridiagonal form.
260 CALL DSBTRD( JOBZ, UPLO, N, KD, AB, LDAB, W, WORK( INDE ), Z, LDZ,
261 $ WORK( INDWRK ), IINFO )
263 * For eigenvalues only, call DSTERF. For eigenvectors, call SSTEQR.
265 IF( .NOT.WANTZ ) THEN
266 CALL DSTERF( N, W, WORK( INDE ), INFO )
268 CALL DSTEQR( JOBZ, N, W, WORK( INDE ), Z, LDZ, WORK( INDWRK ),
272 * If matrix was scaled, then rescale eigenvalues appropriately.
274 IF( ISCALE.EQ.1 ) THEN
280 CALL DSCAL( IMAX, ONE / SIGMA, W, 1 )