LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zhbev.f
Go to the documentation of this file.
1*> \brief <b> ZHBEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZHBEV + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhbev.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhbev.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhbev.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZHBEV( JOBZ, UPLO, N, KD, AB, LDAB, W, Z, LDZ, WORK,
20* RWORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER JOBZ, UPLO
24* INTEGER INFO, KD, LDAB, LDZ, N
25* ..
26* .. Array Arguments ..
27* DOUBLE PRECISION RWORK( * ), W( * )
28* COMPLEX*16 AB( LDAB, * ), WORK( * ), Z( LDZ, * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> ZHBEV computes all the eigenvalues and, optionally, eigenvectors of
38*> a complex Hermitian band matrix A.
39*> \endverbatim
40*
41* Arguments:
42* ==========
43*
44*> \param[in] JOBZ
45*> \verbatim
46*> JOBZ is CHARACTER*1
47*> = 'N': Compute eigenvalues only;
48*> = 'V': Compute eigenvalues and eigenvectors.
49*> \endverbatim
50*>
51*> \param[in] UPLO
52*> \verbatim
53*> UPLO is CHARACTER*1
54*> = 'U': Upper triangle of A is stored;
55*> = 'L': Lower triangle of A is stored.
56*> \endverbatim
57*>
58*> \param[in] N
59*> \verbatim
60*> N is INTEGER
61*> The order of the matrix A. N >= 0.
62*> \endverbatim
63*>
64*> \param[in] KD
65*> \verbatim
66*> KD is INTEGER
67*> The number of superdiagonals of the matrix A if UPLO = 'U',
68*> or the number of subdiagonals if UPLO = 'L'. KD >= 0.
69*> \endverbatim
70*>
71*> \param[in,out] AB
72*> \verbatim
73*> AB is COMPLEX*16 array, dimension (LDAB, N)
74*> On entry, the upper or lower triangle of the Hermitian band
75*> matrix A, stored in the first KD+1 rows of the array. The
76*> j-th column of A is stored in the j-th column of the array AB
77*> as follows:
78*> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
79*> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
80*>
81*> On exit, AB is overwritten by values generated during the
82*> reduction to tridiagonal form. If UPLO = 'U', the first
83*> superdiagonal and the diagonal of the tridiagonal matrix T
84*> are returned in rows KD and KD+1 of AB, and if UPLO = 'L',
85*> the diagonal and first subdiagonal of T are returned in the
86*> first two rows of AB.
87*> \endverbatim
88*>
89*> \param[in] LDAB
90*> \verbatim
91*> LDAB is INTEGER
92*> The leading dimension of the array AB. LDAB >= KD + 1.
93*> \endverbatim
94*>
95*> \param[out] W
96*> \verbatim
97*> W is DOUBLE PRECISION array, dimension (N)
98*> If INFO = 0, the eigenvalues in ascending order.
99*> \endverbatim
100*>
101*> \param[out] Z
102*> \verbatim
103*> Z is COMPLEX*16 array, dimension (LDZ, N)
104*> If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
105*> eigenvectors of the matrix A, with the i-th column of Z
106*> holding the eigenvector associated with W(i).
107*> If JOBZ = 'N', then Z is not referenced.
108*> \endverbatim
109*>
110*> \param[in] LDZ
111*> \verbatim
112*> LDZ is INTEGER
113*> The leading dimension of the array Z. LDZ >= 1, and if
114*> JOBZ = 'V', LDZ >= max(1,N).
115*> \endverbatim
116*>
117*> \param[out] WORK
118*> \verbatim
119*> WORK is COMPLEX*16 array, dimension (N)
120*> \endverbatim
121*>
122*> \param[out] RWORK
123*> \verbatim
124*> RWORK is DOUBLE PRECISION array, dimension (max(1,3*N-2))
125*> \endverbatim
126*>
127*> \param[out] INFO
128*> \verbatim
129*> INFO is INTEGER
130*> = 0: successful exit.
131*> < 0: if INFO = -i, the i-th argument had an illegal value.
132*> > 0: if INFO = i, the algorithm failed to converge; i
133*> off-diagonal elements of an intermediate tridiagonal
134*> form did not converge to zero.
135*> \endverbatim
136*
137* Authors:
138* ========
139*
140*> \author Univ. of Tennessee
141*> \author Univ. of California Berkeley
142*> \author Univ. of Colorado Denver
143*> \author NAG Ltd.
144*
145*> \ingroup hbev
146*
147* =====================================================================
148 SUBROUTINE zhbev( JOBZ, UPLO, N, KD, AB, LDAB, W, Z, LDZ, WORK,
149 $ RWORK, INFO )
150*
151* -- LAPACK driver routine --
152* -- LAPACK is a software package provided by Univ. of Tennessee, --
153* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
154*
155* .. Scalar Arguments ..
156 CHARACTER JOBZ, UPLO
157 INTEGER INFO, KD, LDAB, LDZ, N
158* ..
159* .. Array Arguments ..
160 DOUBLE PRECISION RWORK( * ), W( * )
161 COMPLEX*16 AB( LDAB, * ), WORK( * ), Z( LDZ, * )
162* ..
163*
164* =====================================================================
165*
166* .. Parameters ..
167 DOUBLE PRECISION ZERO, ONE
168 parameter( zero = 0.0d0, one = 1.0d0 )
169* ..
170* .. Local Scalars ..
171 LOGICAL LOWER, WANTZ
172 INTEGER IINFO, IMAX, INDE, INDRWK, ISCALE
173 DOUBLE PRECISION ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
174 $ smlnum
175* ..
176* .. External Functions ..
177 LOGICAL LSAME
178 DOUBLE PRECISION DLAMCH, ZLANHB
179 EXTERNAL lsame, dlamch, zlanhb
180* ..
181* .. External Subroutines ..
182 EXTERNAL dscal, dsterf, xerbla, zhbtrd, zlascl,
183 $ zsteqr
184* ..
185* .. Intrinsic Functions ..
186 INTRINSIC sqrt
187* ..
188* .. Executable Statements ..
189*
190* Test the input parameters.
191*
192 wantz = lsame( jobz, 'V' )
193 lower = lsame( uplo, 'L' )
194*
195 info = 0
196 IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
197 info = -1
198 ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
199 info = -2
200 ELSE IF( n.LT.0 ) THEN
201 info = -3
202 ELSE IF( kd.LT.0 ) THEN
203 info = -4
204 ELSE IF( ldab.LT.kd+1 ) THEN
205 info = -6
206 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
207 info = -9
208 END IF
209*
210 IF( info.NE.0 ) THEN
211 CALL xerbla( 'ZHBEV ', -info )
212 RETURN
213 END IF
214*
215* Quick return if possible
216*
217 IF( n.EQ.0 )
218 $ RETURN
219*
220 IF( n.EQ.1 ) THEN
221 IF( lower ) THEN
222 w( 1 ) = dble( ab( 1, 1 ) )
223 ELSE
224 w( 1 ) = dble( ab( kd+1, 1 ) )
225 END IF
226 IF( wantz )
227 $ z( 1, 1 ) = one
228 RETURN
229 END IF
230*
231* Get machine constants.
232*
233 safmin = dlamch( 'Safe minimum' )
234 eps = dlamch( 'Precision' )
235 smlnum = safmin / eps
236 bignum = one / smlnum
237 rmin = sqrt( smlnum )
238 rmax = sqrt( bignum )
239*
240* Scale matrix to allowable range, if necessary.
241*
242 anrm = zlanhb( 'M', uplo, n, kd, ab, ldab, rwork )
243 iscale = 0
244 IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
245 iscale = 1
246 sigma = rmin / anrm
247 ELSE IF( anrm.GT.rmax ) THEN
248 iscale = 1
249 sigma = rmax / anrm
250 END IF
251 IF( iscale.EQ.1 ) THEN
252 IF( lower ) THEN
253 CALL zlascl( 'B', kd, kd, one, sigma, n, n, ab, ldab,
254 $ info )
255 ELSE
256 CALL zlascl( 'Q', kd, kd, one, sigma, n, n, ab, ldab,
257 $ info )
258 END IF
259 END IF
260*
261* Call ZHBTRD to reduce Hermitian band matrix to tridiagonal form.
262*
263 inde = 1
264 CALL zhbtrd( jobz, uplo, n, kd, ab, ldab, w, rwork( inde ), z,
265 $ ldz, work, iinfo )
266*
267* For eigenvalues only, call DSTERF. For eigenvectors, call ZSTEQR.
268*
269 IF( .NOT.wantz ) THEN
270 CALL dsterf( n, w, rwork( inde ), info )
271 ELSE
272 indrwk = inde + n
273 CALL zsteqr( jobz, n, w, rwork( inde ), z, ldz,
274 $ rwork( indrwk ), info )
275 END IF
276*
277* If matrix was scaled, then rescale eigenvalues appropriately.
278*
279 IF( iscale.EQ.1 ) THEN
280 IF( info.EQ.0 ) THEN
281 imax = n
282 ELSE
283 imax = info - 1
284 END IF
285 CALL dscal( imax, one / sigma, w, 1 )
286 END IF
287*
288 RETURN
289*
290* End of ZHBEV
291*
292 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zhbev(jobz, uplo, n, kd, ab, ldab, w, z, ldz, work, rwork, info)
ZHBEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices
Definition zhbev.f:150
subroutine zhbtrd(vect, uplo, n, kd, ab, ldab, d, e, q, ldq, work, info)
ZHBTRD
Definition zhbtrd.f:161
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition zlascl.f:142
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
subroutine zsteqr(compz, n, d, e, z, ldz, work, info)
ZSTEQR
Definition zsteqr.f:130
subroutine dsterf(n, d, e, info)
DSTERF
Definition dsterf.f:84