3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SSBGVX + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ssbgvx.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ssbgvx.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ssbgvx.f">
21 * SUBROUTINE SSBGVX( JOBZ, RANGE, UPLO, N, KA, KB, AB, LDAB, BB,
22 * LDBB, Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W, Z,
23 * LDZ, WORK, IWORK, IFAIL, INFO )
25 * .. Scalar Arguments ..
26 * CHARACTER JOBZ, RANGE, UPLO
27 * INTEGER IL, INFO, IU, KA, KB, LDAB, LDBB, LDQ, LDZ, M,
31 * .. Array Arguments ..
32 * INTEGER IFAIL( * ), IWORK( * )
33 * REAL AB( LDAB, * ), BB( LDBB, * ), Q( LDQ, * ),
34 * $ W( * ), WORK( * ), Z( LDZ, * )
43 *> SSBGVX computes selected eigenvalues, and optionally, eigenvectors
44 *> of a real generalized symmetric-definite banded eigenproblem, of
45 *> the form A*x=(lambda)*B*x. Here A and B are assumed to be symmetric
46 *> and banded, and B is also positive definite. Eigenvalues and
47 *> eigenvectors can be selected by specifying either all eigenvalues,
48 *> a range of values or a range of indices for the desired eigenvalues.
56 *> JOBZ is CHARACTER*1
57 *> = 'N': Compute eigenvalues only;
58 *> = 'V': Compute eigenvalues and eigenvectors.
63 *> RANGE is CHARACTER*1
64 *> = 'A': all eigenvalues will be found.
65 *> = 'V': all eigenvalues in the half-open interval (VL,VU]
67 *> = 'I': the IL-th through IU-th eigenvalues will be found.
72 *> UPLO is CHARACTER*1
73 *> = 'U': Upper triangles of A and B are stored;
74 *> = 'L': Lower triangles of A and B are stored.
80 *> The order of the matrices A and B. N >= 0.
86 *> The number of superdiagonals of the matrix A if UPLO = 'U',
87 *> or the number of subdiagonals if UPLO = 'L'. KA >= 0.
93 *> The number of superdiagonals of the matrix B if UPLO = 'U',
94 *> or the number of subdiagonals if UPLO = 'L'. KB >= 0.
99 *> AB is REAL array, dimension (LDAB, N)
100 *> On entry, the upper or lower triangle of the symmetric band
101 *> matrix A, stored in the first ka+1 rows of the array. The
102 *> j-th column of A is stored in the j-th column of the array AB
104 *> if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j;
105 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+ka).
107 *> On exit, the contents of AB are destroyed.
113 *> The leading dimension of the array AB. LDAB >= KA+1.
118 *> BB is REAL array, dimension (LDBB, N)
119 *> On entry, the upper or lower triangle of the symmetric band
120 *> matrix B, stored in the first kb+1 rows of the array. The
121 *> j-th column of B is stored in the j-th column of the array BB
123 *> if UPLO = 'U', BB(ka+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j;
124 *> if UPLO = 'L', BB(1+i-j,j) = B(i,j) for j<=i<=min(n,j+kb).
126 *> On exit, the factor S from the split Cholesky factorization
127 *> B = S**T*S, as returned by SPBSTF.
133 *> The leading dimension of the array BB. LDBB >= KB+1.
138 *> Q is REAL array, dimension (LDQ, N)
139 *> If JOBZ = 'V', the n-by-n matrix used in the reduction of
140 *> A*x = (lambda)*B*x to standard form, i.e. C*x = (lambda)*x,
141 *> and consequently C to tridiagonal form.
142 *> If JOBZ = 'N', the array Q is not referenced.
148 *> The leading dimension of the array Q. If JOBZ = 'N',
149 *> LDQ >= 1. If JOBZ = 'V', LDQ >= max(1,N).
156 *> If RANGE='V', the lower bound of the interval to
157 *> be searched for eigenvalues. VL < VU.
158 *> Not referenced if RANGE = 'A' or 'I'.
165 *> If RANGE='V', the upper bound of the interval to
166 *> be searched for eigenvalues. VL < VU.
167 *> Not referenced if RANGE = 'A' or 'I'.
174 *> If RANGE='I', the index of the
175 *> smallest eigenvalue to be returned.
176 *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
177 *> Not referenced if RANGE = 'A' or 'V'.
184 *> If RANGE='I', the index of the
185 *> largest eigenvalue to be returned.
186 *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
187 *> Not referenced if RANGE = 'A' or 'V'.
193 *> The absolute error tolerance for the eigenvalues.
194 *> An approximate eigenvalue is accepted as converged
195 *> when it is determined to lie in an interval [a,b]
196 *> of width less than or equal to
198 *> ABSTOL + EPS * max( |a|,|b| ) ,
200 *> where EPS is the machine precision. If ABSTOL is less than
201 *> or equal to zero, then EPS*|T| will be used in its place,
202 *> where |T| is the 1-norm of the tridiagonal matrix obtained
203 *> by reducing A to tridiagonal form.
205 *> Eigenvalues will be computed most accurately when ABSTOL is
206 *> set to twice the underflow threshold 2*SLAMCH('S'), not zero.
207 *> If this routine returns with INFO>0, indicating that some
208 *> eigenvectors did not converge, try setting ABSTOL to
215 *> The total number of eigenvalues found. 0 <= M <= N.
216 *> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
221 *> W is REAL array, dimension (N)
222 *> If INFO = 0, the eigenvalues in ascending order.
227 *> Z is REAL array, dimension (LDZ, N)
228 *> If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
229 *> eigenvectors, with the i-th column of Z holding the
230 *> eigenvector associated with W(i). The eigenvectors are
231 *> normalized so Z**T*B*Z = I.
232 *> If JOBZ = 'N', then Z is not referenced.
238 *> The leading dimension of the array Z. LDZ >= 1, and if
239 *> JOBZ = 'V', LDZ >= max(1,N).
244 *> WORK is REAL array, dimension (7N)
249 *> IWORK is INTEGER array, dimension (5N)
254 *> IFAIL is INTEGER array, dimension (M)
255 *> If JOBZ = 'V', then if INFO = 0, the first M elements of
256 *> IFAIL are zero. If INFO > 0, then IFAIL contains the
257 *> indices of the eigenvalues that failed to converge.
258 *> If JOBZ = 'N', then IFAIL is not referenced.
264 *> = 0 : successful exit
265 *> < 0 : if INFO = -i, the i-th argument had an illegal value
266 *> <= N: if INFO = i, then i eigenvectors failed to converge.
267 *> Their indices are stored in IFAIL.
268 *> > N : SPBSTF returned an error code; i.e.,
269 *> if INFO = N + i, for 1 <= i <= N, then the leading
270 *> minor of order i of B is not positive definite.
271 *> The factorization of B could not be completed and
272 *> no eigenvalues or eigenvectors were computed.
278 *> \author Univ. of Tennessee
279 *> \author Univ. of California Berkeley
280 *> \author Univ. of Colorado Denver
285 *> \ingroup realOTHEReigen
287 *> \par Contributors:
290 *> Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
292 * =====================================================================
293 SUBROUTINE SSBGVX( JOBZ, RANGE, UPLO, N, KA, KB, AB, LDAB, BB,
294 $ LDBB, Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W, Z,
295 $ LDZ, WORK, IWORK, IFAIL, INFO )
297 * -- LAPACK driver routine (version 3.6.1) --
298 * -- LAPACK is a software package provided by Univ. of Tennessee, --
299 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
302 * .. Scalar Arguments ..
303 CHARACTER JOBZ, RANGE, UPLO
304 INTEGER IL, INFO, IU, KA, KB, LDAB, LDBB, LDQ, LDZ, M,
308 * .. Array Arguments ..
309 INTEGER IFAIL( * ), IWORK( * )
310 REAL AB( LDAB, * ), BB( LDBB, * ), Q( LDQ, * ),
311 $ W( * ), WORK( * ), Z( LDZ, * )
314 * =====================================================================
318 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
320 * .. Local Scalars ..
321 LOGICAL ALLEIG, INDEIG, TEST, UPPER, VALEIG, WANTZ
322 CHARACTER ORDER, VECT
323 INTEGER I, IINFO, INDD, INDE, INDEE, INDIBL, INDISP,
324 $ INDIWO, INDWRK, ITMP1, J, JJ, NSPLIT
327 * .. External Functions ..
331 * .. External Subroutines ..
332 EXTERNAL SCOPY, SGEMV, SLACPY, SPBSTF, SSBGST, SSBTRD,
333 $ SSTEBZ, SSTEIN, SSTEQR, SSTERF, SSWAP, XERBLA
335 * .. Intrinsic Functions ..
338 * .. Executable Statements ..
340 * Test the input parameters.
342 WANTZ = LSAME( JOBZ, 'V' )
343 UPPER = LSAME( UPLO, 'U' )
344 ALLEIG = LSAME( RANGE, 'A' )
345 VALEIG = LSAME( RANGE, 'V' )
346 INDEIG = LSAME( RANGE, 'I' )
349 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
351 ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
353 ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
355 ELSE IF( N.LT.0 ) THEN
357 ELSE IF( KA.LT.0 ) THEN
359 ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
361 ELSE IF( LDAB.LT.KA+1 ) THEN
363 ELSE IF( LDBB.LT.KB+1 ) THEN
365 ELSE IF( LDQ.LT.1 .OR. ( WANTZ .AND. LDQ.LT.N ) ) THEN
369 IF( N.GT.0 .AND. VU.LE.VL )
371 ELSE IF( INDEIG ) THEN
372 IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
374 ELSE IF ( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
380 IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
386 CALL XERBLA( 'SSBGVX', -INFO )
390 * Quick return if possible
396 * Form a split Cholesky factorization of B.
398 CALL SPBSTF( UPLO, N, KB, BB, LDBB, INFO )
404 * Transform problem to standard eigenvalue problem.
406 CALL SSBGST( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Q, LDQ,
409 * Reduce symmetric band matrix to tridiagonal form.
419 CALL SSBTRD( VECT, UPLO, N, KA, AB, LDAB, WORK( INDD ),
420 $ WORK( INDE ), Q, LDQ, WORK( INDWRK ), IINFO )
422 * If all eigenvalues are desired and ABSTOL is less than or equal
423 * to zero, then call SSTERF or SSTEQR. If this fails for some
424 * eigenvalue, then try SSTEBZ.
428 IF( IL.EQ.1 .AND. IU.EQ.N ) THEN
432 IF( ( ALLEIG .OR. TEST ) .AND. ( ABSTOL.LE.ZERO ) ) THEN
433 CALL SCOPY( N, WORK( INDD ), 1, W, 1 )
435 CALL SCOPY( N-1, WORK( INDE ), 1, WORK( INDEE ), 1 )
436 IF( .NOT.WANTZ ) THEN
437 CALL SSTERF( N, W, WORK( INDEE ), INFO )
439 CALL SLACPY( 'A', N, N, Q, LDQ, Z, LDZ )
440 CALL SSTEQR( JOBZ, N, W, WORK( INDEE ), Z, LDZ,
441 $ WORK( INDWRK ), INFO )
455 * Otherwise, call SSTEBZ and, if eigenvectors are desired,
466 CALL SSTEBZ( RANGE, ORDER, N, VL, VU, IL, IU, ABSTOL,
467 $ WORK( INDD ), WORK( INDE ), M, NSPLIT, W,
468 $ IWORK( INDIBL ), IWORK( INDISP ), WORK( INDWRK ),
469 $ IWORK( INDIWO ), INFO )
472 CALL SSTEIN( N, WORK( INDD ), WORK( INDE ), M, W,
473 $ IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ,
474 $ WORK( INDWRK ), IWORK( INDIWO ), IFAIL, INFO )
476 * Apply transformation matrix used in reduction to tridiagonal
477 * form to eigenvectors returned by SSTEIN.
480 CALL SCOPY( N, Z( 1, J ), 1, WORK( 1 ), 1 )
481 CALL SGEMV( 'N', N, N, ONE, Q, LDQ, WORK, 1, ZERO,
488 * If eigenvalues are not in order, then sort them, along with
496 IF( W( JJ ).LT.TMP1 ) THEN
503 ITMP1 = IWORK( INDIBL+I-1 )
505 IWORK( INDIBL+I-1 ) = IWORK( INDIBL+J-1 )
507 IWORK( INDIBL+J-1 ) = ITMP1
508 CALL SSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
511 IFAIL( I ) = IFAIL( J )