![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief <b> DSYEVR computes the eigenvalues and, optionally, the left and/or right eigenvectors for SY matrices</b> 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download DSYEVR + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dsyevr.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dsyevr.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dsyevr.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE DSYEVR( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU, 00022 * ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK, 00023 * IWORK, LIWORK, INFO ) 00024 * 00025 * .. Scalar Arguments .. 00026 * CHARACTER JOBZ, RANGE, UPLO 00027 * INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LWORK, M, N 00028 * DOUBLE PRECISION ABSTOL, VL, VU 00029 * .. 00030 * .. Array Arguments .. 00031 * INTEGER ISUPPZ( * ), IWORK( * ) 00032 * DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * ), Z( LDZ, * ) 00033 * .. 00034 * 00035 * 00036 *> \par Purpose: 00037 * ============= 00038 *> 00039 *> \verbatim 00040 *> 00041 *> DSYEVR computes selected eigenvalues and, optionally, eigenvectors 00042 *> of a real symmetric matrix A. Eigenvalues and eigenvectors can be 00043 *> selected by specifying either a range of values or a range of 00044 *> indices for the desired eigenvalues. 00045 *> 00046 *> DSYEVR first reduces the matrix A to tridiagonal form T with a call 00047 *> to DSYTRD. Then, whenever possible, DSYEVR calls DSTEMR to compute 00048 *> the eigenspectrum using Relatively Robust Representations. DSTEMR 00049 *> computes eigenvalues by the dqds algorithm, while orthogonal 00050 *> eigenvectors are computed from various "good" L D L^T representations 00051 *> (also known as Relatively Robust Representations). Gram-Schmidt 00052 *> orthogonalization is avoided as far as possible. More specifically, 00053 *> the various steps of the algorithm are as follows. 00054 *> 00055 *> For each unreduced block (submatrix) of T, 00056 *> (a) Compute T - sigma I = L D L^T, so that L and D 00057 *> define all the wanted eigenvalues to high relative accuracy. 00058 *> This means that small relative changes in the entries of D and L 00059 *> cause only small relative changes in the eigenvalues and 00060 *> eigenvectors. The standard (unfactored) representation of the 00061 *> tridiagonal matrix T does not have this property in general. 00062 *> (b) Compute the eigenvalues to suitable accuracy. 00063 *> If the eigenvectors are desired, the algorithm attains full 00064 *> accuracy of the computed eigenvalues only right before 00065 *> the corresponding vectors have to be computed, see steps c) and d). 00066 *> (c) For each cluster of close eigenvalues, select a new 00067 *> shift close to the cluster, find a new factorization, and refine 00068 *> the shifted eigenvalues to suitable accuracy. 00069 *> (d) For each eigenvalue with a large enough relative separation compute 00070 *> the corresponding eigenvector by forming a rank revealing twisted 00071 *> factorization. Go back to (c) for any clusters that remain. 00072 *> 00073 *> The desired accuracy of the output can be specified by the input 00074 *> parameter ABSTOL. 00075 *> 00076 *> For more details, see DSTEMR's documentation and: 00077 *> - Inderjit S. Dhillon and Beresford N. Parlett: "Multiple representations 00078 *> to compute orthogonal eigenvectors of symmetric tridiagonal matrices," 00079 *> Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004. 00080 *> - Inderjit Dhillon and Beresford Parlett: "Orthogonal Eigenvectors and 00081 *> Relative Gaps," SIAM Journal on Matrix Analysis and Applications, Vol. 25, 00082 *> 2004. Also LAPACK Working Note 154. 00083 *> - Inderjit Dhillon: "A new O(n^2) algorithm for the symmetric 00084 *> tridiagonal eigenvalue/eigenvector problem", 00085 *> Computer Science Division Technical Report No. UCB/CSD-97-971, 00086 *> UC Berkeley, May 1997. 00087 *> 00088 *> 00089 *> Note 1 : DSYEVR calls DSTEMR when the full spectrum is requested 00090 *> on machines which conform to the ieee-754 floating point standard. 00091 *> DSYEVR calls DSTEBZ and SSTEIN on non-ieee machines and 00092 *> when partial spectrum requests are made. 00093 *> 00094 *> Normal execution of DSTEMR may create NaNs and infinities and 00095 *> hence may abort due to a floating point exception in environments 00096 *> which do not handle NaNs and infinities in the ieee standard default 00097 *> manner. 00098 *> \endverbatim 00099 * 00100 * Arguments: 00101 * ========== 00102 * 00103 *> \param[in] JOBZ 00104 *> \verbatim 00105 *> JOBZ is CHARACTER*1 00106 *> = 'N': Compute eigenvalues only; 00107 *> = 'V': Compute eigenvalues and eigenvectors. 00108 *> \endverbatim 00109 *> 00110 *> \param[in] RANGE 00111 *> \verbatim 00112 *> RANGE is CHARACTER*1 00113 *> = 'A': all eigenvalues will be found. 00114 *> = 'V': all eigenvalues in the half-open interval (VL,VU] 00115 *> will be found. 00116 *> = 'I': the IL-th through IU-th eigenvalues will be found. 00117 *> For RANGE = 'V' or 'I' and IU - IL < N - 1, DSTEBZ and 00118 *> DSTEIN are called 00119 *> \endverbatim 00120 *> 00121 *> \param[in] UPLO 00122 *> \verbatim 00123 *> UPLO is CHARACTER*1 00124 *> = 'U': Upper triangle of A is stored; 00125 *> = 'L': Lower triangle of A is stored. 00126 *> \endverbatim 00127 *> 00128 *> \param[in] N 00129 *> \verbatim 00130 *> N is INTEGER 00131 *> The order of the matrix A. N >= 0. 00132 *> \endverbatim 00133 *> 00134 *> \param[in,out] A 00135 *> \verbatim 00136 *> A is DOUBLE PRECISION array, dimension (LDA, N) 00137 *> On entry, the symmetric matrix A. If UPLO = 'U', the 00138 *> leading N-by-N upper triangular part of A contains the 00139 *> upper triangular part of the matrix A. If UPLO = 'L', 00140 *> the leading N-by-N lower triangular part of A contains 00141 *> the lower triangular part of the matrix A. 00142 *> On exit, the lower triangle (if UPLO='L') or the upper 00143 *> triangle (if UPLO='U') of A, including the diagonal, is 00144 *> destroyed. 00145 *> \endverbatim 00146 *> 00147 *> \param[in] LDA 00148 *> \verbatim 00149 *> LDA is INTEGER 00150 *> The leading dimension of the array A. LDA >= max(1,N). 00151 *> \endverbatim 00152 *> 00153 *> \param[in] VL 00154 *> \verbatim 00155 *> VL is DOUBLE PRECISION 00156 *> \endverbatim 00157 *> 00158 *> \param[in] VU 00159 *> \verbatim 00160 *> VU is DOUBLE PRECISION 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 *> If RANGE='I', the indices (in ascending order) of the 00175 *> smallest and largest eigenvalues to be returned. 00176 *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0. 00177 *> Not referenced if RANGE = 'A' or 'V'. 00178 *> \endverbatim 00179 *> 00180 *> \param[in] ABSTOL 00181 *> \verbatim 00182 *> ABSTOL is DOUBLE PRECISION 00183 *> The absolute error tolerance for the eigenvalues. 00184 *> An approximate eigenvalue is accepted as converged 00185 *> when it is determined to lie in an interval [a,b] 00186 *> of width less than or equal to 00187 *> 00188 *> ABSTOL + EPS * max( |a|,|b| ) , 00189 *> 00190 *> where EPS is the machine precision. If ABSTOL is less than 00191 *> or equal to zero, then EPS*|T| will be used in its place, 00192 *> where |T| is the 1-norm of the tridiagonal matrix obtained 00193 *> by reducing A to tridiagonal form. 00194 *> 00195 *> See "Computing Small Singular Values of Bidiagonal Matrices 00196 *> with Guaranteed High Relative Accuracy," by Demmel and 00197 *> Kahan, LAPACK Working Note #3. 00198 *> 00199 *> If high relative accuracy is important, set ABSTOL to 00200 *> DLAMCH( 'Safe minimum' ). Doing so will guarantee that 00201 *> eigenvalues are computed to high relative accuracy when 00202 *> possible in future releases. The current code does not 00203 *> make any guarantees about high relative accuracy, but 00204 *> future releases will. See J. Barlow and J. Demmel, 00205 *> "Computing Accurate Eigensystems of Scaled Diagonally 00206 *> Dominant Matrices", LAPACK Working Note #7, for a discussion 00207 *> of which matrices define their eigenvalues to high relative 00208 *> accuracy. 00209 *> \endverbatim 00210 *> 00211 *> \param[out] M 00212 *> \verbatim 00213 *> M is INTEGER 00214 *> The total number of eigenvalues found. 0 <= M <= N. 00215 *> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1. 00216 *> \endverbatim 00217 *> 00218 *> \param[out] W 00219 *> \verbatim 00220 *> W is DOUBLE PRECISION array, dimension (N) 00221 *> The first M elements contain the selected eigenvalues in 00222 *> ascending order. 00223 *> \endverbatim 00224 *> 00225 *> \param[out] Z 00226 *> \verbatim 00227 *> Z is DOUBLE PRECISION array, dimension (LDZ, max(1,M)) 00228 *> If JOBZ = 'V', then if INFO = 0, the first M columns of Z 00229 *> contain the orthonormal eigenvectors of the matrix A 00230 *> corresponding to the selected eigenvalues, with the i-th 00231 *> column of Z holding the eigenvector associated with W(i). 00232 *> If JOBZ = 'N', then Z is not referenced. 00233 *> Note: the user must ensure that at least max(1,M) columns are 00234 *> supplied in the array Z; if RANGE = 'V', the exact value of M 00235 *> is not known in advance and an upper bound must be used. 00236 *> Supplying N columns is always safe. 00237 *> \endverbatim 00238 *> 00239 *> \param[in] LDZ 00240 *> \verbatim 00241 *> LDZ is INTEGER 00242 *> The leading dimension of the array Z. LDZ >= 1, and if 00243 *> JOBZ = 'V', LDZ >= max(1,N). 00244 *> \endverbatim 00245 *> 00246 *> \param[out] ISUPPZ 00247 *> \verbatim 00248 *> ISUPPZ is INTEGER array, dimension ( 2*max(1,M) ) 00249 *> The support of the eigenvectors in Z, i.e., the indices 00250 *> indicating the nonzero elements in Z. The i-th eigenvector 00251 *> is nonzero only in elements ISUPPZ( 2*i-1 ) through 00252 *> ISUPPZ( 2*i ). 00253 *> Implemented only for RANGE = 'A' or 'I' and IU - IL = N - 1 00254 *> \endverbatim 00255 *> 00256 *> \param[out] WORK 00257 *> \verbatim 00258 *> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)) 00259 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK. 00260 *> \endverbatim 00261 *> 00262 *> \param[in] LWORK 00263 *> \verbatim 00264 *> LWORK is INTEGER 00265 *> The dimension of the array WORK. LWORK >= max(1,26*N). 00266 *> For optimal efficiency, LWORK >= (NB+6)*N, 00267 *> where NB is the max of the blocksize for DSYTRD and DORMTR 00268 *> returned by ILAENV. 00269 *> 00270 *> If LWORK = -1, then a workspace query is assumed; the routine 00271 *> only calculates the optimal size of the WORK array, returns 00272 *> this value as the first entry of the WORK array, and no error 00273 *> message related to LWORK is issued by XERBLA. 00274 *> \endverbatim 00275 *> 00276 *> \param[out] IWORK 00277 *> \verbatim 00278 *> IWORK is INTEGER array, dimension (MAX(1,LIWORK)) 00279 *> On exit, if INFO = 0, IWORK(1) returns the optimal LWORK. 00280 *> \endverbatim 00281 *> 00282 *> \param[in] LIWORK 00283 *> \verbatim 00284 *> LIWORK is INTEGER 00285 *> The dimension of the array IWORK. LIWORK >= max(1,10*N). 00286 *> 00287 *> If LIWORK = -1, then a workspace query is assumed; the 00288 *> routine only calculates the optimal size of the IWORK array, 00289 *> returns this value as the first entry of the IWORK array, and 00290 *> no error message related to LIWORK is issued by XERBLA. 00291 *> \endverbatim 00292 *> 00293 *> \param[out] INFO 00294 *> \verbatim 00295 *> INFO is INTEGER 00296 *> = 0: successful exit 00297 *> < 0: if INFO = -i, the i-th argument had an illegal value 00298 *> > 0: Internal error 00299 *> \endverbatim 00300 * 00301 * Authors: 00302 * ======== 00303 * 00304 *> \author Univ. of Tennessee 00305 *> \author Univ. of California Berkeley 00306 *> \author Univ. of Colorado Denver 00307 *> \author NAG Ltd. 00308 * 00309 *> \date November 2011 00310 * 00311 *> \ingroup doubleSYeigen 00312 * 00313 *> \par Contributors: 00314 * ================== 00315 *> 00316 *> Inderjit Dhillon, IBM Almaden, USA \n 00317 *> Osni Marques, LBNL/NERSC, USA \n 00318 *> Ken Stanley, Computer Science Division, University of 00319 *> California at Berkeley, USA \n 00320 *> Jason Riedy, Computer Science Division, University of 00321 *> California at Berkeley, USA \n 00322 *> 00323 * ===================================================================== 00324 SUBROUTINE DSYEVR( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU, 00325 $ ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK, 00326 $ IWORK, LIWORK, INFO ) 00327 * 00328 * -- LAPACK driver routine (version 3.4.0) -- 00329 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00330 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00331 * November 2011 00332 * 00333 * .. Scalar Arguments .. 00334 CHARACTER JOBZ, RANGE, UPLO 00335 INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LWORK, M, N 00336 DOUBLE PRECISION ABSTOL, VL, VU 00337 * .. 00338 * .. Array Arguments .. 00339 INTEGER ISUPPZ( * ), IWORK( * ) 00340 DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * ), Z( LDZ, * ) 00341 * .. 00342 * 00343 * ===================================================================== 00344 * 00345 * .. Parameters .. 00346 DOUBLE PRECISION ZERO, ONE, TWO 00347 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0, TWO = 2.0D+0 ) 00348 * .. 00349 * .. Local Scalars .. 00350 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, VALEIG, WANTZ, 00351 $ TRYRAC 00352 CHARACTER ORDER 00353 INTEGER I, IEEEOK, IINFO, IMAX, INDD, INDDD, INDE, 00354 $ INDEE, INDIBL, INDIFL, INDISP, INDIWO, INDTAU, 00355 $ INDWK, INDWKN, ISCALE, J, JJ, LIWMIN, 00356 $ LLWORK, LLWRKN, LWKOPT, LWMIN, NB, NSPLIT 00357 DOUBLE PRECISION ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, 00358 $ SIGMA, SMLNUM, TMP1, VLL, VUU 00359 * .. 00360 * .. External Functions .. 00361 LOGICAL LSAME 00362 INTEGER ILAENV 00363 DOUBLE PRECISION DLAMCH, DLANSY 00364 EXTERNAL LSAME, ILAENV, DLAMCH, DLANSY 00365 * .. 00366 * .. External Subroutines .. 00367 EXTERNAL DCOPY, DORMTR, DSCAL, DSTEBZ, DSTEMR, DSTEIN, 00368 $ DSTERF, DSWAP, DSYTRD, XERBLA 00369 * .. 00370 * .. Intrinsic Functions .. 00371 INTRINSIC MAX, MIN, SQRT 00372 * .. 00373 * .. Executable Statements .. 00374 * 00375 * Test the input parameters. 00376 * 00377 IEEEOK = ILAENV( 10, 'DSYEVR', 'N', 1, 2, 3, 4 ) 00378 * 00379 LOWER = LSAME( UPLO, 'L' ) 00380 WANTZ = LSAME( JOBZ, 'V' ) 00381 ALLEIG = LSAME( RANGE, 'A' ) 00382 VALEIG = LSAME( RANGE, 'V' ) 00383 INDEIG = LSAME( RANGE, 'I' ) 00384 * 00385 LQUERY = ( ( LWORK.EQ.-1 ) .OR. ( LIWORK.EQ.-1 ) ) 00386 * 00387 LWMIN = MAX( 1, 26*N ) 00388 LIWMIN = MAX( 1, 10*N ) 00389 * 00390 INFO = 0 00391 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN 00392 INFO = -1 00393 ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN 00394 INFO = -2 00395 ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN 00396 INFO = -3 00397 ELSE IF( N.LT.0 ) THEN 00398 INFO = -4 00399 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN 00400 INFO = -6 00401 ELSE 00402 IF( VALEIG ) THEN 00403 IF( N.GT.0 .AND. VU.LE.VL ) 00404 $ INFO = -8 00405 ELSE IF( INDEIG ) THEN 00406 IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN 00407 INFO = -9 00408 ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN 00409 INFO = -10 00410 END IF 00411 END IF 00412 END IF 00413 IF( INFO.EQ.0 ) THEN 00414 IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN 00415 INFO = -15 00416 ELSE IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN 00417 INFO = -18 00418 ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN 00419 INFO = -20 00420 END IF 00421 END IF 00422 * 00423 IF( INFO.EQ.0 ) THEN 00424 NB = ILAENV( 1, 'DSYTRD', UPLO, N, -1, -1, -1 ) 00425 NB = MAX( NB, ILAENV( 1, 'DORMTR', UPLO, N, -1, -1, -1 ) ) 00426 LWKOPT = MAX( ( NB+1 )*N, LWMIN ) 00427 WORK( 1 ) = LWKOPT 00428 IWORK( 1 ) = LIWMIN 00429 END IF 00430 * 00431 IF( INFO.NE.0 ) THEN 00432 CALL XERBLA( 'DSYEVR', -INFO ) 00433 RETURN 00434 ELSE IF( LQUERY ) THEN 00435 RETURN 00436 END IF 00437 * 00438 * Quick return if possible 00439 * 00440 M = 0 00441 IF( N.EQ.0 ) THEN 00442 WORK( 1 ) = 1 00443 RETURN 00444 END IF 00445 * 00446 IF( N.EQ.1 ) THEN 00447 WORK( 1 ) = 7 00448 IF( ALLEIG .OR. INDEIG ) THEN 00449 M = 1 00450 W( 1 ) = A( 1, 1 ) 00451 ELSE 00452 IF( VL.LT.A( 1, 1 ) .AND. VU.GE.A( 1, 1 ) ) THEN 00453 M = 1 00454 W( 1 ) = A( 1, 1 ) 00455 END IF 00456 END IF 00457 IF( WANTZ ) THEN 00458 Z( 1, 1 ) = ONE 00459 ISUPPZ( 1 ) = 1 00460 ISUPPZ( 2 ) = 1 00461 END IF 00462 RETURN 00463 END IF 00464 * 00465 * Get machine constants. 00466 * 00467 SAFMIN = DLAMCH( 'Safe minimum' ) 00468 EPS = DLAMCH( 'Precision' ) 00469 SMLNUM = SAFMIN / EPS 00470 BIGNUM = ONE / SMLNUM 00471 RMIN = SQRT( SMLNUM ) 00472 RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) ) 00473 * 00474 * Scale matrix to allowable range, if necessary. 00475 * 00476 ISCALE = 0 00477 ABSTLL = ABSTOL 00478 IF (VALEIG) THEN 00479 VLL = VL 00480 VUU = VU 00481 END IF 00482 ANRM = DLANSY( 'M', UPLO, N, A, LDA, WORK ) 00483 IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN 00484 ISCALE = 1 00485 SIGMA = RMIN / ANRM 00486 ELSE IF( ANRM.GT.RMAX ) THEN 00487 ISCALE = 1 00488 SIGMA = RMAX / ANRM 00489 END IF 00490 IF( ISCALE.EQ.1 ) THEN 00491 IF( LOWER ) THEN 00492 DO 10 J = 1, N 00493 CALL DSCAL( N-J+1, SIGMA, A( J, J ), 1 ) 00494 10 CONTINUE 00495 ELSE 00496 DO 20 J = 1, N 00497 CALL DSCAL( J, SIGMA, A( 1, J ), 1 ) 00498 20 CONTINUE 00499 END IF 00500 IF( ABSTOL.GT.0 ) 00501 $ ABSTLL = ABSTOL*SIGMA 00502 IF( VALEIG ) THEN 00503 VLL = VL*SIGMA 00504 VUU = VU*SIGMA 00505 END IF 00506 END IF 00507 00508 * Initialize indices into workspaces. Note: The IWORK indices are 00509 * used only if DSTERF or DSTEMR fail. 00510 00511 * WORK(INDTAU:INDTAU+N-1) stores the scalar factors of the 00512 * elementary reflectors used in DSYTRD. 00513 INDTAU = 1 00514 * WORK(INDD:INDD+N-1) stores the tridiagonal's diagonal entries. 00515 INDD = INDTAU + N 00516 * WORK(INDE:INDE+N-1) stores the off-diagonal entries of the 00517 * tridiagonal matrix from DSYTRD. 00518 INDE = INDD + N 00519 * WORK(INDDD:INDDD+N-1) is a copy of the diagonal entries over 00520 * -written by DSTEMR (the DSTERF path copies the diagonal to W). 00521 INDDD = INDE + N 00522 * WORK(INDEE:INDEE+N-1) is a copy of the off-diagonal entries over 00523 * -written while computing the eigenvalues in DSTERF and DSTEMR. 00524 INDEE = INDDD + N 00525 * INDWK is the starting offset of the left-over workspace, and 00526 * LLWORK is the remaining workspace size. 00527 INDWK = INDEE + N 00528 LLWORK = LWORK - INDWK + 1 00529 00530 * IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in DSTEBZ and 00531 * stores the block indices of each of the M<=N eigenvalues. 00532 INDIBL = 1 00533 * IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in DSTEBZ and 00534 * stores the starting and finishing indices of each block. 00535 INDISP = INDIBL + N 00536 * IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors 00537 * that corresponding to eigenvectors that fail to converge in 00538 * DSTEIN. This information is discarded; if any fail, the driver 00539 * returns INFO > 0. 00540 INDIFL = INDISP + N 00541 * INDIWO is the offset of the remaining integer workspace. 00542 INDIWO = INDISP + N 00543 00544 * 00545 * Call DSYTRD to reduce symmetric matrix to tridiagonal form. 00546 * 00547 CALL DSYTRD( UPLO, N, A, LDA, WORK( INDD ), WORK( INDE ), 00548 $ WORK( INDTAU ), WORK( INDWK ), LLWORK, IINFO ) 00549 * 00550 * If all eigenvalues are desired 00551 * then call DSTERF or DSTEMR and DORMTR. 00552 * 00553 IF( ( ALLEIG .OR. ( INDEIG .AND. IL.EQ.1 .AND. IU.EQ.N ) ) .AND. 00554 $ IEEEOK.EQ.1 ) THEN 00555 IF( .NOT.WANTZ ) THEN 00556 CALL DCOPY( N, WORK( INDD ), 1, W, 1 ) 00557 CALL DCOPY( N-1, WORK( INDE ), 1, WORK( INDEE ), 1 ) 00558 CALL DSTERF( N, W, WORK( INDEE ), INFO ) 00559 ELSE 00560 CALL DCOPY( N-1, WORK( INDE ), 1, WORK( INDEE ), 1 ) 00561 CALL DCOPY( N, WORK( INDD ), 1, WORK( INDDD ), 1 ) 00562 * 00563 IF (ABSTOL .LE. TWO*N*EPS) THEN 00564 TRYRAC = .TRUE. 00565 ELSE 00566 TRYRAC = .FALSE. 00567 END IF 00568 CALL DSTEMR( JOBZ, 'A', N, WORK( INDDD ), WORK( INDEE ), 00569 $ VL, VU, IL, IU, M, W, Z, LDZ, N, ISUPPZ, 00570 $ TRYRAC, WORK( INDWK ), LWORK, IWORK, LIWORK, 00571 $ INFO ) 00572 * 00573 * 00574 * 00575 * Apply orthogonal matrix used in reduction to tridiagonal 00576 * form to eigenvectors returned by DSTEIN. 00577 * 00578 IF( WANTZ .AND. INFO.EQ.0 ) THEN 00579 INDWKN = INDE 00580 LLWRKN = LWORK - INDWKN + 1 00581 CALL DORMTR( 'L', UPLO, 'N', N, M, A, LDA, 00582 $ WORK( INDTAU ), Z, LDZ, WORK( INDWKN ), 00583 $ LLWRKN, IINFO ) 00584 END IF 00585 END IF 00586 * 00587 * 00588 IF( INFO.EQ.0 ) THEN 00589 * Everything worked. Skip DSTEBZ/DSTEIN. IWORK(:) are 00590 * undefined. 00591 M = N 00592 GO TO 30 00593 END IF 00594 INFO = 0 00595 END IF 00596 * 00597 * Otherwise, call DSTEBZ and, if eigenvectors are desired, DSTEIN. 00598 * Also call DSTEBZ and DSTEIN if DSTEMR fails. 00599 * 00600 IF( WANTZ ) THEN 00601 ORDER = 'B' 00602 ELSE 00603 ORDER = 'E' 00604 END IF 00605 00606 CALL DSTEBZ( RANGE, ORDER, N, VLL, VUU, IL, IU, ABSTLL, 00607 $ WORK( INDD ), WORK( INDE ), M, NSPLIT, W, 00608 $ IWORK( INDIBL ), IWORK( INDISP ), WORK( INDWK ), 00609 $ IWORK( INDIWO ), INFO ) 00610 * 00611 IF( WANTZ ) THEN 00612 CALL DSTEIN( N, WORK( INDD ), WORK( INDE ), M, W, 00613 $ IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ, 00614 $ WORK( INDWK ), IWORK( INDIWO ), IWORK( INDIFL ), 00615 $ INFO ) 00616 * 00617 * Apply orthogonal matrix used in reduction to tridiagonal 00618 * form to eigenvectors returned by DSTEIN. 00619 * 00620 INDWKN = INDE 00621 LLWRKN = LWORK - INDWKN + 1 00622 CALL DORMTR( 'L', UPLO, 'N', N, M, A, LDA, WORK( INDTAU ), Z, 00623 $ LDZ, WORK( INDWKN ), LLWRKN, IINFO ) 00624 END IF 00625 * 00626 * If matrix was scaled, then rescale eigenvalues appropriately. 00627 * 00628 * Jump here if DSTEMR/DSTEIN succeeded. 00629 30 CONTINUE 00630 IF( ISCALE.EQ.1 ) THEN 00631 IF( INFO.EQ.0 ) THEN 00632 IMAX = M 00633 ELSE 00634 IMAX = INFO - 1 00635 END IF 00636 CALL DSCAL( IMAX, ONE / SIGMA, W, 1 ) 00637 END IF 00638 * 00639 * If eigenvalues are not in order, then sort them, along with 00640 * eigenvectors. Note: We do not sort the IFAIL portion of IWORK. 00641 * It may not be initialized (if DSTEMR/DSTEIN succeeded), and we do 00642 * not return this detailed information to the user. 00643 * 00644 IF( WANTZ ) THEN 00645 DO 50 J = 1, M - 1 00646 I = 0 00647 TMP1 = W( J ) 00648 DO 40 JJ = J + 1, M 00649 IF( W( JJ ).LT.TMP1 ) THEN 00650 I = JJ 00651 TMP1 = W( JJ ) 00652 END IF 00653 40 CONTINUE 00654 * 00655 IF( I.NE.0 ) THEN 00656 W( I ) = W( J ) 00657 W( J ) = TMP1 00658 CALL DSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 ) 00659 END IF 00660 50 CONTINUE 00661 END IF 00662 * 00663 * Set WORK(1) to optimal workspace size. 00664 * 00665 WORK( 1 ) = LWKOPT 00666 IWORK( 1 ) = LIWMIN 00667 * 00668 RETURN 00669 * 00670 * End of DSYEVR 00671 * 00672 END