3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZHBGVX + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhbgvx.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhbgvx.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhbgvx.f">
21 * SUBROUTINE ZHBGVX( JOBZ, RANGE, UPLO, N, KA, KB, AB, LDAB, BB,
22 * LDBB, Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W, Z,
23 * LDZ, WORK, RWORK, IWORK, IFAIL, INFO )
25 * .. Scalar Arguments ..
26 * CHARACTER JOBZ, RANGE, UPLO
27 * INTEGER IL, INFO, IU, KA, KB, LDAB, LDBB, LDQ, LDZ, M,
29 * DOUBLE PRECISION ABSTOL, VL, VU
31 * .. Array Arguments ..
32 * INTEGER IFAIL( * ), IWORK( * )
33 * DOUBLE PRECISION RWORK( * ), W( * )
34 * COMPLEX*16 AB( LDAB, * ), BB( LDBB, * ), Q( LDQ, * ),
35 * $ WORK( * ), Z( LDZ, * )
44 *> ZHBGVX computes all the eigenvalues, and optionally, the eigenvectors
45 *> of a complex generalized Hermitian-definite banded eigenproblem, of
46 *> the form A*x=(lambda)*B*x. Here A and B are assumed to be Hermitian
47 *> and banded, and B is also positive definite. Eigenvalues and
48 *> eigenvectors can be selected by specifying either all eigenvalues,
49 *> a range of values or a range of indices for the desired eigenvalues.
57 *> JOBZ is CHARACTER*1
58 *> = 'N': Compute eigenvalues only;
59 *> = 'V': Compute eigenvalues and eigenvectors.
64 *> RANGE is CHARACTER*1
65 *> = 'A': all eigenvalues will be found;
66 *> = 'V': all eigenvalues in the half-open interval (VL,VU]
68 *> = 'I': the IL-th through IU-th eigenvalues will be found.
73 *> UPLO is CHARACTER*1
74 *> = 'U': Upper triangles of A and B are stored;
75 *> = 'L': Lower triangles of A and B are stored.
81 *> The order of the matrices A and B. N >= 0.
87 *> The number of superdiagonals of the matrix A if UPLO = 'U',
88 *> or the number of subdiagonals if UPLO = 'L'. KA >= 0.
94 *> The number of superdiagonals of the matrix B if UPLO = 'U',
95 *> or the number of subdiagonals if UPLO = 'L'. KB >= 0.
100 *> AB is COMPLEX*16 array, dimension (LDAB, N)
101 *> On entry, the upper or lower triangle of the Hermitian band
102 *> matrix A, stored in the first ka+1 rows of the array. The
103 *> j-th column of A is stored in the j-th column of the array AB
105 *> if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j;
106 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+ka).
108 *> On exit, the contents of AB are destroyed.
114 *> The leading dimension of the array AB. LDAB >= KA+1.
119 *> BB is COMPLEX*16 array, dimension (LDBB, N)
120 *> On entry, the upper or lower triangle of the Hermitian band
121 *> matrix B, stored in the first kb+1 rows of the array. The
122 *> j-th column of B is stored in the j-th column of the array BB
124 *> if UPLO = 'U', BB(kb+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j;
125 *> if UPLO = 'L', BB(1+i-j,j) = B(i,j) for j<=i<=min(n,j+kb).
127 *> On exit, the factor S from the split Cholesky factorization
128 *> B = S**H*S, as returned by ZPBSTF.
134 *> The leading dimension of the array BB. LDBB >= KB+1.
139 *> Q is COMPLEX*16 array, dimension (LDQ, N)
140 *> If JOBZ = 'V', the n-by-n matrix used in the reduction of
141 *> A*x = (lambda)*B*x to standard form, i.e. C*x = (lambda)*x,
142 *> and consequently C to tridiagonal form.
143 *> If JOBZ = 'N', the array Q is not referenced.
149 *> The leading dimension of the array Q. If JOBZ = 'N',
150 *> LDQ >= 1. If JOBZ = 'V', LDQ >= max(1,N).
155 *> VL is DOUBLE PRECISION
157 *> If RANGE='V', the lower bound of the interval to
158 *> be searched for eigenvalues. VL < VU.
159 *> Not referenced if RANGE = 'A' or 'I'.
164 *> VU is DOUBLE PRECISION
166 *> If RANGE='V', the upper bound of the interval to
167 *> be searched for eigenvalues. VL < VU.
168 *> Not referenced if RANGE = 'A' or 'I'.
175 *> If RANGE='I', the index of the
176 *> smallest eigenvalue to be returned.
177 *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
178 *> Not referenced if RANGE = 'A' or 'V'.
185 *> If RANGE='I', the index of the
186 *> largest eigenvalue to be returned.
187 *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
188 *> Not referenced if RANGE = 'A' or 'V'.
193 *> ABSTOL is DOUBLE PRECISION
194 *> The absolute error tolerance for the eigenvalues.
195 *> An approximate eigenvalue is accepted as converged
196 *> when it is determined to lie in an interval [a,b]
197 *> of width less than or equal to
199 *> ABSTOL + EPS * max( |a|,|b| ) ,
201 *> where EPS is the machine precision. If ABSTOL is less than
202 *> or equal to zero, then EPS*|T| will be used in its place,
203 *> where |T| is the 1-norm of the tridiagonal matrix obtained
204 *> by reducing AP to tridiagonal form.
206 *> Eigenvalues will be computed most accurately when ABSTOL is
207 *> set to twice the underflow threshold 2*DLAMCH('S'), not zero.
208 *> If this routine returns with INFO>0, indicating that some
209 *> eigenvectors did not converge, try setting ABSTOL to
216 *> The total number of eigenvalues found. 0 <= M <= N.
217 *> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
222 *> W is DOUBLE PRECISION array, dimension (N)
223 *> If INFO = 0, the eigenvalues in ascending order.
228 *> Z is COMPLEX*16 array, dimension (LDZ, N)
229 *> If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
230 *> eigenvectors, with the i-th column of Z holding the
231 *> eigenvector associated with W(i). The eigenvectors are
232 *> normalized so that Z**H*B*Z = I.
233 *> If JOBZ = 'N', then Z is not referenced.
239 *> The leading dimension of the array Z. LDZ >= 1, and if
240 *> JOBZ = 'V', LDZ >= N.
245 *> WORK is COMPLEX*16 array, dimension (N)
250 *> RWORK is DOUBLE PRECISION array, dimension (7*N)
255 *> IWORK is INTEGER array, dimension (5*N)
260 *> IFAIL is INTEGER array, dimension (N)
261 *> If JOBZ = 'V', then if INFO = 0, the first M elements of
262 *> IFAIL are zero. If INFO > 0, then IFAIL contains the
263 *> indices of the eigenvectors that failed to converge.
264 *> If JOBZ = 'N', then IFAIL is not referenced.
270 *> = 0: successful exit
271 *> < 0: if INFO = -i, the i-th argument had an illegal value
272 *> > 0: if INFO = i, and i is:
273 *> <= N: then i eigenvectors failed to converge. Their
274 *> indices are stored in array IFAIL.
275 *> > N: if INFO = N + i, for 1 <= i <= N, then ZPBSTF
276 *> returned INFO = i: B is not positive definite.
277 *> The factorization of B could not be completed and
278 *> no eigenvalues or eigenvectors were computed.
284 *> \author Univ. of Tennessee
285 *> \author Univ. of California Berkeley
286 *> \author Univ. of Colorado Denver
291 *> \ingroup complex16OTHEReigen
293 *> \par Contributors:
296 *> Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
298 * =====================================================================
299 SUBROUTINE ZHBGVX( JOBZ, RANGE, UPLO, N, KA, KB, AB, LDAB, BB,
300 $ LDBB, Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W, Z,
301 $ LDZ, WORK, RWORK, IWORK, IFAIL, INFO )
303 * -- LAPACK driver routine (version 3.6.1) --
304 * -- LAPACK is a software package provided by Univ. of Tennessee, --
305 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
308 * .. Scalar Arguments ..
309 CHARACTER JOBZ, RANGE, UPLO
310 INTEGER IL, INFO, IU, KA, KB, LDAB, LDBB, LDQ, LDZ, M,
312 DOUBLE PRECISION ABSTOL, VL, VU
314 * .. Array Arguments ..
315 INTEGER IFAIL( * ), IWORK( * )
316 DOUBLE PRECISION RWORK( * ), W( * )
317 COMPLEX*16 AB( LDAB, * ), BB( LDBB, * ), Q( LDQ, * ),
318 $ WORK( * ), Z( LDZ, * )
321 * =====================================================================
324 DOUBLE PRECISION ZERO
325 PARAMETER ( ZERO = 0.0D+0 )
326 COMPLEX*16 CZERO, CONE
327 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
328 $ CONE = ( 1.0D+0, 0.0D+0 ) )
330 * .. Local Scalars ..
331 LOGICAL ALLEIG, INDEIG, TEST, UPPER, VALEIG, WANTZ
332 CHARACTER ORDER, VECT
333 INTEGER I, IINFO, INDD, INDE, INDEE, INDIBL, INDISP,
334 $ INDIWK, INDRWK, INDWRK, ITMP1, J, JJ, NSPLIT
335 DOUBLE PRECISION TMP1
337 * .. External Functions ..
341 * .. External Subroutines ..
342 EXTERNAL DCOPY, DSTEBZ, DSTERF, XERBLA, ZCOPY, ZGEMV,
343 $ ZHBGST, ZHBTRD, ZLACPY, ZPBSTF, ZSTEIN, ZSTEQR,
346 * .. Intrinsic Functions ..
349 * .. Executable Statements ..
351 * Test the input parameters.
353 WANTZ = LSAME( JOBZ, 'V' )
354 UPPER = LSAME( UPLO, 'U' )
355 ALLEIG = LSAME( RANGE, 'A' )
356 VALEIG = LSAME( RANGE, 'V' )
357 INDEIG = LSAME( RANGE, 'I' )
360 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
362 ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
364 ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
366 ELSE IF( N.LT.0 ) THEN
368 ELSE IF( KA.LT.0 ) THEN
370 ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
372 ELSE IF( LDAB.LT.KA+1 ) THEN
374 ELSE IF( LDBB.LT.KB+1 ) THEN
376 ELSE IF( LDQ.LT.1 .OR. ( WANTZ .AND. LDQ.LT.N ) ) THEN
380 IF( N.GT.0 .AND. VU.LE.VL )
382 ELSE IF( INDEIG ) THEN
383 IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
385 ELSE IF ( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
391 IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
397 CALL XERBLA( 'ZHBGVX', -INFO )
401 * Quick return if possible
407 * Form a split Cholesky factorization of B.
409 CALL ZPBSTF( UPLO, N, KB, BB, LDBB, INFO )
415 * Transform problem to standard eigenvalue problem.
417 CALL ZHBGST( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Q, LDQ,
418 $ WORK, RWORK, IINFO )
420 * Solve the standard eigenvalue problem.
421 * Reduce Hermitian band matrix to tridiagonal form.
432 CALL ZHBTRD( VECT, UPLO, N, KA, AB, LDAB, RWORK( INDD ),
433 $ RWORK( INDE ), Q, LDQ, WORK( INDWRK ), IINFO )
435 * If all eigenvalues are desired and ABSTOL is less than or equal
436 * to zero, then call DSTERF or ZSTEQR. If this fails for some
437 * eigenvalue, then try DSTEBZ.
441 IF( IL.EQ.1 .AND. IU.EQ.N ) THEN
445 IF( ( ALLEIG .OR. TEST ) .AND. ( ABSTOL.LE.ZERO ) ) THEN
446 CALL DCOPY( N, RWORK( INDD ), 1, W, 1 )
448 CALL DCOPY( N-1, RWORK( INDE ), 1, RWORK( INDEE ), 1 )
449 IF( .NOT.WANTZ ) THEN
450 CALL DSTERF( N, W, RWORK( INDEE ), INFO )
452 CALL ZLACPY( 'A', N, N, Q, LDQ, Z, LDZ )
453 CALL ZSTEQR( JOBZ, N, W, RWORK( INDEE ), Z, LDZ,
454 $ RWORK( INDRWK ), INFO )
468 * Otherwise, call DSTEBZ and, if eigenvectors are desired,
479 CALL DSTEBZ( RANGE, ORDER, N, VL, VU, IL, IU, ABSTOL,
480 $ RWORK( INDD ), RWORK( INDE ), M, NSPLIT, W,
481 $ IWORK( INDIBL ), IWORK( INDISP ), RWORK( INDRWK ),
482 $ IWORK( INDIWK ), INFO )
485 CALL ZSTEIN( N, RWORK( INDD ), RWORK( INDE ), M, W,
486 $ IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ,
487 $ RWORK( INDRWK ), IWORK( INDIWK ), IFAIL, INFO )
489 * Apply unitary matrix used in reduction to tridiagonal
490 * form to eigenvectors returned by ZSTEIN.
493 CALL ZCOPY( N, Z( 1, J ), 1, WORK( 1 ), 1 )
494 CALL ZGEMV( 'N', N, N, CONE, Q, LDQ, WORK, 1, CZERO,
501 * If eigenvalues are not in order, then sort them, along with
509 IF( W( JJ ).LT.TMP1 ) THEN
516 ITMP1 = IWORK( INDIBL+I-1 )
518 IWORK( INDIBL+I-1 ) = IWORK( INDIBL+J-1 )
520 IWORK( INDIBL+J-1 ) = ITMP1
521 CALL ZSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
524 IFAIL( I ) = IFAIL( J )