![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b CHBGST 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download CHBGVX + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/chbgvx.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/chbgvx.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/chbgvx.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE CHBGVX( JOBZ, RANGE, UPLO, N, KA, KB, AB, LDAB, BB, 00022 * LDBB, Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W, Z, 00023 * LDZ, WORK, RWORK, IWORK, IFAIL, INFO ) 00024 * 00025 * .. Scalar Arguments .. 00026 * CHARACTER JOBZ, RANGE, UPLO 00027 * INTEGER IL, INFO, IU, KA, KB, LDAB, LDBB, LDQ, LDZ, M, 00028 * $ N 00029 * REAL ABSTOL, VL, VU 00030 * .. 00031 * .. Array Arguments .. 00032 * INTEGER IFAIL( * ), IWORK( * ) 00033 * REAL RWORK( * ), W( * ) 00034 * COMPLEX AB( LDAB, * ), BB( LDBB, * ), Q( LDQ, * ), 00035 * $ WORK( * ), Z( LDZ, * ) 00036 * .. 00037 * 00038 * 00039 *> \par Purpose: 00040 * ============= 00041 *> 00042 *> \verbatim 00043 *> 00044 *> CHBGVX computes all the eigenvalues, and optionally, the eigenvectors 00045 *> of a complex generalized Hermitian-definite banded eigenproblem, of 00046 *> the form A*x=(lambda)*B*x. Here A and B are assumed to be Hermitian 00047 *> and banded, and B is also positive definite. Eigenvalues and 00048 *> eigenvectors can be selected by specifying either all eigenvalues, 00049 *> a range of values or a range of indices for the desired eigenvalues. 00050 *> \endverbatim 00051 * 00052 * Arguments: 00053 * ========== 00054 * 00055 *> \param[in] JOBZ 00056 *> \verbatim 00057 *> JOBZ is CHARACTER*1 00058 *> = 'N': Compute eigenvalues only; 00059 *> = 'V': Compute eigenvalues and eigenvectors. 00060 *> \endverbatim 00061 *> 00062 *> \param[in] RANGE 00063 *> \verbatim 00064 *> RANGE is CHARACTER*1 00065 *> = 'A': all eigenvalues will be found; 00066 *> = 'V': all eigenvalues in the half-open interval (VL,VU] 00067 *> will be found; 00068 *> = 'I': the IL-th through IU-th eigenvalues will be found. 00069 *> \endverbatim 00070 *> 00071 *> \param[in] UPLO 00072 *> \verbatim 00073 *> UPLO is CHARACTER*1 00074 *> = 'U': Upper triangles of A and B are stored; 00075 *> = 'L': Lower triangles of A and B are stored. 00076 *> \endverbatim 00077 *> 00078 *> \param[in] N 00079 *> \verbatim 00080 *> N is INTEGER 00081 *> The order of the matrices A and B. N >= 0. 00082 *> \endverbatim 00083 *> 00084 *> \param[in] KA 00085 *> \verbatim 00086 *> KA is INTEGER 00087 *> The number of superdiagonals of the matrix A if UPLO = 'U', 00088 *> or the number of subdiagonals if UPLO = 'L'. KA >= 0. 00089 *> \endverbatim 00090 *> 00091 *> \param[in] KB 00092 *> \verbatim 00093 *> KB is INTEGER 00094 *> The number of superdiagonals of the matrix B if UPLO = 'U', 00095 *> or the number of subdiagonals if UPLO = 'L'. KB >= 0. 00096 *> \endverbatim 00097 *> 00098 *> \param[in,out] AB 00099 *> \verbatim 00100 *> AB is COMPLEX array, dimension (LDAB, N) 00101 *> On entry, the upper or lower triangle of the Hermitian band 00102 *> matrix A, stored in the first ka+1 rows of the array. The 00103 *> j-th column of A is stored in the j-th column of the array AB 00104 *> as follows: 00105 *> if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j; 00106 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+ka). 00107 *> 00108 *> On exit, the contents of AB are destroyed. 00109 *> \endverbatim 00110 *> 00111 *> \param[in] LDAB 00112 *> \verbatim 00113 *> LDAB is INTEGER 00114 *> The leading dimension of the array AB. LDAB >= KA+1. 00115 *> \endverbatim 00116 *> 00117 *> \param[in,out] BB 00118 *> \verbatim 00119 *> BB is COMPLEX array, dimension (LDBB, N) 00120 *> On entry, the upper or lower triangle of the Hermitian band 00121 *> matrix B, stored in the first kb+1 rows of the array. The 00122 *> j-th column of B is stored in the j-th column of the array BB 00123 *> as follows: 00124 *> if UPLO = 'U', BB(kb+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j; 00125 *> if UPLO = 'L', BB(1+i-j,j) = B(i,j) for j<=i<=min(n,j+kb). 00126 *> 00127 *> On exit, the factor S from the split Cholesky factorization 00128 *> B = S**H*S, as returned by CPBSTF. 00129 *> \endverbatim 00130 *> 00131 *> \param[in] LDBB 00132 *> \verbatim 00133 *> LDBB is INTEGER 00134 *> The leading dimension of the array BB. LDBB >= KB+1. 00135 *> \endverbatim 00136 *> 00137 *> \param[out] Q 00138 *> \verbatim 00139 *> Q is COMPLEX array, dimension (LDQ, N) 00140 *> If JOBZ = 'V', the n-by-n matrix used in the reduction of 00141 *> A*x = (lambda)*B*x to standard form, i.e. C*x = (lambda)*x, 00142 *> and consequently C to tridiagonal form. 00143 *> If JOBZ = 'N', the array Q is not referenced. 00144 *> \endverbatim 00145 *> 00146 *> \param[in] LDQ 00147 *> \verbatim 00148 *> LDQ is INTEGER 00149 *> The leading dimension of the array Q. If JOBZ = 'N', 00150 *> LDQ >= 1. If JOBZ = 'V', LDQ >= max(1,N). 00151 *> \endverbatim 00152 *> 00153 *> \param[in] VL 00154 *> \verbatim 00155 *> VL is REAL 00156 *> \endverbatim 00157 *> 00158 *> \param[in] VU 00159 *> \verbatim 00160 *> VU is REAL 00161 *> 00162 *> If RANGE='V', the lower and upper bounds of the interval to 00163 *> be searched for eigenvalues. VL < VU. 00164 *> Not referenced if RANGE = 'A' or 'I'. 00165 *> \endverbatim 00166 *> 00167 *> \param[in] IL 00168 *> \verbatim 00169 *> IL is INTEGER 00170 *> \endverbatim 00171 *> 00172 *> \param[in] IU 00173 *> \verbatim 00174 *> IU is INTEGER 00175 *> 00176 *> If RANGE='I', the indices (in ascending order) of the 00177 *> smallest and largest eigenvalues to be returned. 00178 *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0. 00179 *> Not referenced if RANGE = 'A' or 'V'. 00180 *> \endverbatim 00181 *> 00182 *> \param[in] ABSTOL 00183 *> \verbatim 00184 *> ABSTOL is REAL 00185 *> The absolute error tolerance for the eigenvalues. 00186 *> An approximate eigenvalue is accepted as converged 00187 *> when it is determined to lie in an interval [a,b] 00188 *> of width less than or equal to 00189 *> 00190 *> ABSTOL + EPS * max( |a|,|b| ) , 00191 *> 00192 *> where EPS is the machine precision. If ABSTOL is less than 00193 *> or equal to zero, then EPS*|T| will be used in its place, 00194 *> where |T| is the 1-norm of the tridiagonal matrix obtained 00195 *> by reducing AP to tridiagonal form. 00196 *> 00197 *> Eigenvalues will be computed most accurately when ABSTOL is 00198 *> set to twice the underflow threshold 2*SLAMCH('S'), not zero. 00199 *> If this routine returns with INFO>0, indicating that some 00200 *> eigenvectors did not converge, try setting ABSTOL to 00201 *> 2*SLAMCH('S'). 00202 *> \endverbatim 00203 *> 00204 *> \param[out] M 00205 *> \verbatim 00206 *> M is INTEGER 00207 *> The total number of eigenvalues found. 0 <= M <= N. 00208 *> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1. 00209 *> \endverbatim 00210 *> 00211 *> \param[out] W 00212 *> \verbatim 00213 *> W is REAL array, dimension (N) 00214 *> If INFO = 0, the eigenvalues in ascending order. 00215 *> \endverbatim 00216 *> 00217 *> \param[out] Z 00218 *> \verbatim 00219 *> Z is COMPLEX array, dimension (LDZ, N) 00220 *> If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of 00221 *> eigenvectors, with the i-th column of Z holding the 00222 *> eigenvector associated with W(i). The eigenvectors are 00223 *> normalized so that Z**H*B*Z = I. 00224 *> If JOBZ = 'N', then Z is not referenced. 00225 *> \endverbatim 00226 *> 00227 *> \param[in] LDZ 00228 *> \verbatim 00229 *> LDZ is INTEGER 00230 *> The leading dimension of the array Z. LDZ >= 1, and if 00231 *> JOBZ = 'V', LDZ >= N. 00232 *> \endverbatim 00233 *> 00234 *> \param[out] WORK 00235 *> \verbatim 00236 *> WORK is COMPLEX array, dimension (N) 00237 *> \endverbatim 00238 *> 00239 *> \param[out] RWORK 00240 *> \verbatim 00241 *> RWORK is REAL array, dimension (7*N) 00242 *> \endverbatim 00243 *> 00244 *> \param[out] IWORK 00245 *> \verbatim 00246 *> IWORK is INTEGER array, dimension (5*N) 00247 *> \endverbatim 00248 *> 00249 *> \param[out] IFAIL 00250 *> \verbatim 00251 *> IFAIL is INTEGER array, dimension (N) 00252 *> If JOBZ = 'V', then if INFO = 0, the first M elements of 00253 *> IFAIL are zero. If INFO > 0, then IFAIL contains the 00254 *> indices of the eigenvectors that failed to converge. 00255 *> If JOBZ = 'N', then IFAIL is not referenced. 00256 *> \endverbatim 00257 *> 00258 *> \param[out] INFO 00259 *> \verbatim 00260 *> INFO is INTEGER 00261 *> = 0: successful exit 00262 *> < 0: if INFO = -i, the i-th argument had an illegal value 00263 *> > 0: if INFO = i, and i is: 00264 *> <= N: then i eigenvectors failed to converge. Their 00265 *> indices are stored in array IFAIL. 00266 *> > N: if INFO = N + i, for 1 <= i <= N, then CPBSTF 00267 *> returned INFO = i: B is not positive definite. 00268 *> The factorization of B could not be completed and 00269 *> no eigenvalues or eigenvectors were computed. 00270 *> \endverbatim 00271 * 00272 * Authors: 00273 * ======== 00274 * 00275 *> \author Univ. of Tennessee 00276 *> \author Univ. of California Berkeley 00277 *> \author Univ. of Colorado Denver 00278 *> \author NAG Ltd. 00279 * 00280 *> \date November 2011 00281 * 00282 *> \ingroup complexOTHEReigen 00283 * 00284 *> \par Contributors: 00285 * ================== 00286 *> 00287 *> Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA 00288 * 00289 * ===================================================================== 00290 SUBROUTINE CHBGVX( JOBZ, RANGE, UPLO, N, KA, KB, AB, LDAB, BB, 00291 $ LDBB, Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W, Z, 00292 $ LDZ, WORK, RWORK, IWORK, IFAIL, INFO ) 00293 * 00294 * -- LAPACK driver routine (version 3.4.0) -- 00295 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00296 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00297 * November 2011 00298 * 00299 * .. Scalar Arguments .. 00300 CHARACTER JOBZ, RANGE, UPLO 00301 INTEGER IL, INFO, IU, KA, KB, LDAB, LDBB, LDQ, LDZ, M, 00302 $ N 00303 REAL ABSTOL, VL, VU 00304 * .. 00305 * .. Array Arguments .. 00306 INTEGER IFAIL( * ), IWORK( * ) 00307 REAL RWORK( * ), W( * ) 00308 COMPLEX AB( LDAB, * ), BB( LDBB, * ), Q( LDQ, * ), 00309 $ WORK( * ), Z( LDZ, * ) 00310 * .. 00311 * 00312 * ===================================================================== 00313 * 00314 * .. Parameters .. 00315 REAL ZERO 00316 PARAMETER ( ZERO = 0.0E+0 ) 00317 COMPLEX CZERO, CONE 00318 PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ), 00319 $ CONE = ( 1.0E+0, 0.0E+0 ) ) 00320 * .. 00321 * .. Local Scalars .. 00322 LOGICAL ALLEIG, INDEIG, TEST, UPPER, VALEIG, WANTZ 00323 CHARACTER ORDER, VECT 00324 INTEGER I, IINFO, INDD, INDE, INDEE, INDIBL, INDISP, 00325 $ INDIWK, INDRWK, INDWRK, ITMP1, J, JJ, NSPLIT 00326 REAL TMP1 00327 * .. 00328 * .. External Functions .. 00329 LOGICAL LSAME 00330 EXTERNAL LSAME 00331 * .. 00332 * .. External Subroutines .. 00333 EXTERNAL CCOPY, CGEMV, CHBGST, CHBTRD, CLACPY, CPBSTF, 00334 $ CSTEIN, CSTEQR, CSWAP, SCOPY, SSTEBZ, SSTERF, 00335 $ XERBLA 00336 * .. 00337 * .. Intrinsic Functions .. 00338 INTRINSIC MIN 00339 * .. 00340 * .. Executable Statements .. 00341 * 00342 * Test the input parameters. 00343 * 00344 WANTZ = LSAME( JOBZ, 'V' ) 00345 UPPER = LSAME( UPLO, 'U' ) 00346 ALLEIG = LSAME( RANGE, 'A' ) 00347 VALEIG = LSAME( RANGE, 'V' ) 00348 INDEIG = LSAME( RANGE, 'I' ) 00349 * 00350 INFO = 0 00351 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN 00352 INFO = -1 00353 ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN 00354 INFO = -2 00355 ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN 00356 INFO = -3 00357 ELSE IF( N.LT.0 ) THEN 00358 INFO = -4 00359 ELSE IF( KA.LT.0 ) THEN 00360 INFO = -5 00361 ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN 00362 INFO = -6 00363 ELSE IF( LDAB.LT.KA+1 ) THEN 00364 INFO = -8 00365 ELSE IF( LDBB.LT.KB+1 ) THEN 00366 INFO = -10 00367 ELSE IF( LDQ.LT.1 .OR. ( WANTZ .AND. LDQ.LT.N ) ) THEN 00368 INFO = -12 00369 ELSE 00370 IF( VALEIG ) THEN 00371 IF( N.GT.0 .AND. VU.LE.VL ) 00372 $ INFO = -14 00373 ELSE IF( INDEIG ) THEN 00374 IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN 00375 INFO = -15 00376 ELSE IF ( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN 00377 INFO = -16 00378 END IF 00379 END IF 00380 END IF 00381 IF( INFO.EQ.0) THEN 00382 IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN 00383 INFO = -21 00384 END IF 00385 END IF 00386 * 00387 IF( INFO.NE.0 ) THEN 00388 CALL XERBLA( 'CHBGVX', -INFO ) 00389 RETURN 00390 END IF 00391 * 00392 * Quick return if possible 00393 * 00394 M = 0 00395 IF( N.EQ.0 ) 00396 $ RETURN 00397 * 00398 * Form a split Cholesky factorization of B. 00399 * 00400 CALL CPBSTF( UPLO, N, KB, BB, LDBB, INFO ) 00401 IF( INFO.NE.0 ) THEN 00402 INFO = N + INFO 00403 RETURN 00404 END IF 00405 * 00406 * Transform problem to standard eigenvalue problem. 00407 * 00408 CALL CHBGST( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Q, LDQ, 00409 $ WORK, RWORK, IINFO ) 00410 * 00411 * Solve the standard eigenvalue problem. 00412 * Reduce Hermitian band matrix to tridiagonal form. 00413 * 00414 INDD = 1 00415 INDE = INDD + N 00416 INDRWK = INDE + N 00417 INDWRK = 1 00418 IF( WANTZ ) THEN 00419 VECT = 'U' 00420 ELSE 00421 VECT = 'N' 00422 END IF 00423 CALL CHBTRD( VECT, UPLO, N, KA, AB, LDAB, RWORK( INDD ), 00424 $ RWORK( INDE ), Q, LDQ, WORK( INDWRK ), IINFO ) 00425 * 00426 * If all eigenvalues are desired and ABSTOL is less than or equal 00427 * to zero, then call SSTERF or CSTEQR. If this fails for some 00428 * eigenvalue, then try SSTEBZ. 00429 * 00430 TEST = .FALSE. 00431 IF( INDEIG ) THEN 00432 IF( IL.EQ.1 .AND. IU.EQ.N ) THEN 00433 TEST = .TRUE. 00434 END IF 00435 END IF 00436 IF( ( ALLEIG .OR. TEST ) .AND. ( ABSTOL.LE.ZERO ) ) THEN 00437 CALL SCOPY( N, RWORK( INDD ), 1, W, 1 ) 00438 INDEE = INDRWK + 2*N 00439 CALL SCOPY( N-1, RWORK( INDE ), 1, RWORK( INDEE ), 1 ) 00440 IF( .NOT.WANTZ ) THEN 00441 CALL SSTERF( N, W, RWORK( INDEE ), INFO ) 00442 ELSE 00443 CALL CLACPY( 'A', N, N, Q, LDQ, Z, LDZ ) 00444 CALL CSTEQR( JOBZ, N, W, RWORK( INDEE ), Z, LDZ, 00445 $ RWORK( INDRWK ), INFO ) 00446 IF( INFO.EQ.0 ) THEN 00447 DO 10 I = 1, N 00448 IFAIL( I ) = 0 00449 10 CONTINUE 00450 END IF 00451 END IF 00452 IF( INFO.EQ.0 ) THEN 00453 M = N 00454 GO TO 30 00455 END IF 00456 INFO = 0 00457 END IF 00458 * 00459 * Otherwise, call SSTEBZ and, if eigenvectors are desired, 00460 * call CSTEIN. 00461 * 00462 IF( WANTZ ) THEN 00463 ORDER = 'B' 00464 ELSE 00465 ORDER = 'E' 00466 END IF 00467 INDIBL = 1 00468 INDISP = INDIBL + N 00469 INDIWK = INDISP + N 00470 CALL SSTEBZ( RANGE, ORDER, N, VL, VU, IL, IU, ABSTOL, 00471 $ RWORK( INDD ), RWORK( INDE ), M, NSPLIT, W, 00472 $ IWORK( INDIBL ), IWORK( INDISP ), RWORK( INDRWK ), 00473 $ IWORK( INDIWK ), INFO ) 00474 * 00475 IF( WANTZ ) THEN 00476 CALL CSTEIN( N, RWORK( INDD ), RWORK( INDE ), M, W, 00477 $ IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ, 00478 $ RWORK( INDRWK ), IWORK( INDIWK ), IFAIL, INFO ) 00479 * 00480 * Apply unitary matrix used in reduction to tridiagonal 00481 * form to eigenvectors returned by CSTEIN. 00482 * 00483 DO 20 J = 1, M 00484 CALL CCOPY( N, Z( 1, J ), 1, WORK( 1 ), 1 ) 00485 CALL CGEMV( 'N', N, N, CONE, Q, LDQ, WORK, 1, CZERO, 00486 $ Z( 1, J ), 1 ) 00487 20 CONTINUE 00488 END IF 00489 * 00490 30 CONTINUE 00491 * 00492 * If eigenvalues are not in order, then sort them, along with 00493 * eigenvectors. 00494 * 00495 IF( WANTZ ) THEN 00496 DO 50 J = 1, M - 1 00497 I = 0 00498 TMP1 = W( J ) 00499 DO 40 JJ = J + 1, M 00500 IF( W( JJ ).LT.TMP1 ) THEN 00501 I = JJ 00502 TMP1 = W( JJ ) 00503 END IF 00504 40 CONTINUE 00505 * 00506 IF( I.NE.0 ) THEN 00507 ITMP1 = IWORK( INDIBL+I-1 ) 00508 W( I ) = W( J ) 00509 IWORK( INDIBL+I-1 ) = IWORK( INDIBL+J-1 ) 00510 W( J ) = TMP1 00511 IWORK( INDIBL+J-1 ) = ITMP1 00512 CALL CSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 ) 00513 IF( INFO.NE.0 ) THEN 00514 ITMP1 = IFAIL( I ) 00515 IFAIL( I ) = IFAIL( J ) 00516 IFAIL( J ) = ITMP1 00517 END IF 00518 END IF 00519 50 CONTINUE 00520 END IF 00521 * 00522 RETURN 00523 * 00524 * End of CHBGVX 00525 * 00526 END