1 *> \brief <b> CHBEV 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 CHBEV + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/chbev.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/chbev.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/chbev.f">
21 * SUBROUTINE CHBEV( 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 * REAL RWORK( * ), W( * )
30 * COMPLEX AB( LDAB, * ), WORK( * ), Z( LDZ, * )
39 *> CHBEV computes all the eigenvalues and, optionally, eigenvectors of
40 *> a complex Hermitian band matrix A.
48 *> JOBZ is CHARACTER*1
49 *> = 'N': Compute eigenvalues only;
50 *> = 'V': Compute eigenvalues and eigenvectors.
55 *> UPLO is CHARACTER*1
56 *> = 'U': Upper triangle of A is stored;
57 *> = 'L': Lower triangle of A is stored.
63 *> The order of the matrix A. N >= 0.
69 *> The number of superdiagonals of the matrix A if UPLO = 'U',
70 *> or the number of subdiagonals if UPLO = 'L'. KD >= 0.
75 *> AB is COMPLEX array, dimension (LDAB, N)
76 *> On entry, the upper or lower triangle of the Hermitian band
77 *> matrix A, stored in the first KD+1 rows of the array. The
78 *> j-th column of A is stored in the j-th column of the array AB
80 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
81 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
83 *> On exit, AB is overwritten by values generated during the
84 *> reduction to tridiagonal form. If UPLO = 'U', the first
85 *> superdiagonal and the diagonal of the tridiagonal matrix T
86 *> are returned in rows KD and KD+1 of AB, and if UPLO = 'L',
87 *> the diagonal and first subdiagonal of T are returned in the
88 *> first two rows of AB.
94 *> The leading dimension of the array AB. LDAB >= KD + 1.
99 *> W is REAL array, dimension (N)
100 *> If INFO = 0, the eigenvalues in ascending order.
105 *> Z is COMPLEX array, dimension (LDZ, N)
106 *> If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
107 *> eigenvectors of the matrix A, with the i-th column of Z
108 *> holding the eigenvector associated with W(i).
109 *> If JOBZ = 'N', then Z is not referenced.
115 *> The leading dimension of the array Z. LDZ >= 1, and if
116 *> JOBZ = 'V', LDZ >= max(1,N).
121 *> WORK is COMPLEX array, dimension (N)
126 *> RWORK is REAL array, dimension (max(1,3*N-2))
132 *> = 0: successful exit.
133 *> < 0: if INFO = -i, the i-th argument had an illegal value.
134 *> > 0: if INFO = i, the algorithm failed to converge; i
135 *> off-diagonal elements of an intermediate tridiagonal
136 *> form did not converge to zero.
142 *> \author Univ. of Tennessee
143 *> \author Univ. of California Berkeley
144 *> \author Univ. of Colorado Denver
147 *> \date November 2011
149 *> \ingroup complexOTHEReigen
151 * =====================================================================
152 SUBROUTINE CHBEV( JOBZ, UPLO, N, KD, AB, LDAB, W, Z, LDZ, WORK,
155 * -- LAPACK driver routine (version 3.4.0) --
156 * -- LAPACK is a software package provided by Univ. of Tennessee, --
157 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
160 * .. Scalar Arguments ..
162 INTEGER INFO, KD, LDAB, LDZ, N
164 * .. Array Arguments ..
165 REAL RWORK( * ), W( * )
166 COMPLEX AB( LDAB, * ), WORK( * ), Z( LDZ, * )
169 * =====================================================================
173 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
175 * .. Local Scalars ..
177 INTEGER IINFO, IMAX, INDE, INDRWK, ISCALE
178 REAL ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
181 * .. External Functions ..
184 EXTERNAL LSAME, CLANHB, SLAMCH
186 * .. External Subroutines ..
187 EXTERNAL CHBTRD, CLASCL, CSTEQR, SSCAL, SSTERF, XERBLA
189 * .. Intrinsic Functions ..
192 * .. Executable Statements ..
194 * Test the input parameters.
196 WANTZ = LSAME( JOBZ, 'V' )
197 LOWER = LSAME( UPLO, 'L' )
200 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
202 ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN
204 ELSE IF( N.LT.0 ) THEN
206 ELSE IF( KD.LT.0 ) THEN
208 ELSE IF( LDAB.LT.KD+1 ) THEN
210 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
215 CALL XERBLA( 'CHBEV ', -INFO )
219 * Quick return if possible
228 W( 1 ) = AB( KD+1, 1 )
235 * Get machine constants.
237 SAFMIN = SLAMCH( 'Safe minimum' )
238 EPS = SLAMCH( 'Precision' )
239 SMLNUM = SAFMIN / EPS
240 BIGNUM = ONE / SMLNUM
241 RMIN = SQRT( SMLNUM )
242 RMAX = SQRT( BIGNUM )
244 * Scale matrix to allowable range, if necessary.
246 ANRM = CLANHB( 'M', UPLO, N, KD, AB, LDAB, RWORK )
248 IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
251 ELSE IF( ANRM.GT.RMAX ) THEN
255 IF( ISCALE.EQ.1 ) THEN
257 CALL CLASCL( 'B', KD, KD, ONE, SIGMA, N, N, AB, LDAB, INFO )
259 CALL CLASCL( 'Q', KD, KD, ONE, SIGMA, N, N, AB, LDAB, INFO )
263 * Call CHBTRD to reduce Hermitian band matrix to tridiagonal form.
266 CALL CHBTRD( JOBZ, UPLO, N, KD, AB, LDAB, W, RWORK( INDE ), Z,
269 * For eigenvalues only, call SSTERF. For eigenvectors, call CSTEQR.
271 IF( .NOT.WANTZ ) THEN
272 CALL SSTERF( N, W, RWORK( INDE ), INFO )
275 CALL CSTEQR( JOBZ, N, W, RWORK( INDE ), Z, LDZ,
276 $ RWORK( INDRWK ), INFO )
279 * If matrix was scaled, then rescale eigenvalues appropriately.
281 IF( ISCALE.EQ.1 ) THEN
287 CALL SSCAL( IMAX, ONE / SIGMA, W, 1 )