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