Annotation of rpl/lapack/lapack/zheevr.f, revision 1.1
1.1 ! bertrand 1: SUBROUTINE ZHEEVR( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
! 2: $ ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK,
! 3: $ RWORK, LRWORK, IWORK, LIWORK, INFO )
! 4: *
! 5: * -- LAPACK driver routine (version 3.2) --
! 6: * -- LAPACK is a software package provided by Univ. of Tennessee, --
! 7: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
! 8: * November 2006
! 9: *
! 10: * .. Scalar Arguments ..
! 11: CHARACTER JOBZ, RANGE, UPLO
! 12: INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LRWORK, LWORK,
! 13: $ M, N
! 14: DOUBLE PRECISION ABSTOL, VL, VU
! 15: * ..
! 16: * .. Array Arguments ..
! 17: INTEGER ISUPPZ( * ), IWORK( * )
! 18: DOUBLE PRECISION RWORK( * ), W( * )
! 19: COMPLEX*16 A( LDA, * ), WORK( * ), Z( LDZ, * )
! 20: * ..
! 21: *
! 22: * Purpose
! 23: * =======
! 24: *
! 25: * ZHEEVR computes selected eigenvalues and, optionally, eigenvectors
! 26: * of a complex Hermitian matrix A. Eigenvalues and eigenvectors can
! 27: * be selected by specifying either a range of values or a range of
! 28: * indices for the desired eigenvalues.
! 29: *
! 30: * ZHEEVR first reduces the matrix A to tridiagonal form T with a call
! 31: * to ZHETRD. Then, whenever possible, ZHEEVR calls ZSTEMR to compute
! 32: * eigenspectrum using Relatively Robust Representations. ZSTEMR
! 33: * computes eigenvalues by the dqds algorithm, while orthogonal
! 34: * eigenvectors are computed from various "good" L D L^T representations
! 35: * (also known as Relatively Robust Representations). Gram-Schmidt
! 36: * orthogonalization is avoided as far as possible. More specifically,
! 37: * the various steps of the algorithm are as follows.
! 38: *
! 39: * For each unreduced block (submatrix) of T,
! 40: * (a) Compute T - sigma I = L D L^T, so that L and D
! 41: * define all the wanted eigenvalues to high relative accuracy.
! 42: * This means that small relative changes in the entries of D and L
! 43: * cause only small relative changes in the eigenvalues and
! 44: * eigenvectors. The standard (unfactored) representation of the
! 45: * tridiagonal matrix T does not have this property in general.
! 46: * (b) Compute the eigenvalues to suitable accuracy.
! 47: * If the eigenvectors are desired, the algorithm attains full
! 48: * accuracy of the computed eigenvalues only right before
! 49: * the corresponding vectors have to be computed, see steps c) and d).
! 50: * (c) For each cluster of close eigenvalues, select a new
! 51: * shift close to the cluster, find a new factorization, and refine
! 52: * the shifted eigenvalues to suitable accuracy.
! 53: * (d) For each eigenvalue with a large enough relative separation compute
! 54: * the corresponding eigenvector by forming a rank revealing twisted
! 55: * factorization. Go back to (c) for any clusters that remain.
! 56: *
! 57: * The desired accuracy of the output can be specified by the input
! 58: * parameter ABSTOL.
! 59: *
! 60: * For more details, see DSTEMR's documentation and:
! 61: * - Inderjit S. Dhillon and Beresford N. Parlett: "Multiple representations
! 62: * to compute orthogonal eigenvectors of symmetric tridiagonal matrices,"
! 63: * Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004.
! 64: * - Inderjit Dhillon and Beresford Parlett: "Orthogonal Eigenvectors and
! 65: * Relative Gaps," SIAM Journal on Matrix Analysis and Applications, Vol. 25,
! 66: * 2004. Also LAPACK Working Note 154.
! 67: * - Inderjit Dhillon: "A new O(n^2) algorithm for the symmetric
! 68: * tridiagonal eigenvalue/eigenvector problem",
! 69: * Computer Science Division Technical Report No. UCB/CSD-97-971,
! 70: * UC Berkeley, May 1997.
! 71: *
! 72: *
! 73: * Note 1 : ZHEEVR calls ZSTEMR when the full spectrum is requested
! 74: * on machines which conform to the ieee-754 floating point standard.
! 75: * ZHEEVR calls DSTEBZ and ZSTEIN on non-ieee machines and
! 76: * when partial spectrum requests are made.
! 77: *
! 78: * Normal execution of ZSTEMR may create NaNs and infinities and
! 79: * hence may abort due to a floating point exception in environments
! 80: * which do not handle NaNs and infinities in the ieee standard default
! 81: * manner.
! 82: *
! 83: * Arguments
! 84: * =========
! 85: *
! 86: * JOBZ (input) CHARACTER*1
! 87: * = 'N': Compute eigenvalues only;
! 88: * = 'V': Compute eigenvalues and eigenvectors.
! 89: *
! 90: * RANGE (input) CHARACTER*1
! 91: * = 'A': all eigenvalues will be found.
! 92: * = 'V': all eigenvalues in the half-open interval (VL,VU]
! 93: * will be found.
! 94: * = 'I': the IL-th through IU-th eigenvalues will be found.
! 95: ********** For RANGE = 'V' or 'I' and IU - IL < N - 1, DSTEBZ and
! 96: ********** ZSTEIN are called
! 97: *
! 98: * UPLO (input) CHARACTER*1
! 99: * = 'U': Upper triangle of A is stored;
! 100: * = 'L': Lower triangle of A is stored.
! 101: *
! 102: * N (input) INTEGER
! 103: * The order of the matrix A. N >= 0.
! 104: *
! 105: * A (input/output) COMPLEX*16 array, dimension (LDA, N)
! 106: * On entry, the Hermitian matrix A. If UPLO = 'U', the
! 107: * leading N-by-N upper triangular part of A contains the
! 108: * upper triangular part of the matrix A. If UPLO = 'L',
! 109: * the leading N-by-N lower triangular part of A contains
! 110: * the lower triangular part of the matrix A.
! 111: * On exit, the lower triangle (if UPLO='L') or the upper
! 112: * triangle (if UPLO='U') of A, including the diagonal, is
! 113: * destroyed.
! 114: *
! 115: * LDA (input) INTEGER
! 116: * The leading dimension of the array A. LDA >= max(1,N).
! 117: *
! 118: * VL (input) DOUBLE PRECISION
! 119: * VU (input) DOUBLE PRECISION
! 120: * If RANGE='V', the lower and upper bounds of the interval to
! 121: * be searched for eigenvalues. VL < VU.
! 122: * Not referenced if RANGE = 'A' or 'I'.
! 123: *
! 124: * IL (input) INTEGER
! 125: * IU (input) INTEGER
! 126: * If RANGE='I', the indices (in ascending order) of the
! 127: * smallest and largest eigenvalues to be returned.
! 128: * 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
! 129: * Not referenced if RANGE = 'A' or 'V'.
! 130: *
! 131: * ABSTOL (input) DOUBLE PRECISION
! 132: * The absolute error tolerance for the eigenvalues.
! 133: * An approximate eigenvalue is accepted as converged
! 134: * when it is determined to lie in an interval [a,b]
! 135: * of width less than or equal to
! 136: *
! 137: * ABSTOL + EPS * max( |a|,|b| ) ,
! 138: *
! 139: * where EPS is the machine precision. If ABSTOL is less than
! 140: * or equal to zero, then EPS*|T| will be used in its place,
! 141: * where |T| is the 1-norm of the tridiagonal matrix obtained
! 142: * by reducing A to tridiagonal form.
! 143: *
! 144: * See "Computing Small Singular Values of Bidiagonal Matrices
! 145: * with Guaranteed High Relative Accuracy," by Demmel and
! 146: * Kahan, LAPACK Working Note #3.
! 147: *
! 148: * If high relative accuracy is important, set ABSTOL to
! 149: * DLAMCH( 'Safe minimum' ). Doing so will guarantee that
! 150: * eigenvalues are computed to high relative accuracy when
! 151: * possible in future releases. The current code does not
! 152: * make any guarantees about high relative accuracy, but
! 153: * furutre releases will. See J. Barlow and J. Demmel,
! 154: * "Computing Accurate Eigensystems of Scaled Diagonally
! 155: * Dominant Matrices", LAPACK Working Note #7, for a discussion
! 156: * of which matrices define their eigenvalues to high relative
! 157: * accuracy.
! 158: *
! 159: * M (output) INTEGER
! 160: * The total number of eigenvalues found. 0 <= M <= N.
! 161: * If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
! 162: *
! 163: * W (output) DOUBLE PRECISION array, dimension (N)
! 164: * The first M elements contain the selected eigenvalues in
! 165: * ascending order.
! 166: *
! 167: * Z (output) COMPLEX*16 array, dimension (LDZ, max(1,M))
! 168: * If JOBZ = 'V', then if INFO = 0, the first M columns of Z
! 169: * contain the orthonormal eigenvectors of the matrix A
! 170: * corresponding to the selected eigenvalues, with the i-th
! 171: * column of Z holding the eigenvector associated with W(i).
! 172: * If JOBZ = 'N', then Z is not referenced.
! 173: * Note: the user must ensure that at least max(1,M) columns are
! 174: * supplied in the array Z; if RANGE = 'V', the exact value of M
! 175: * is not known in advance and an upper bound must be used.
! 176: *
! 177: * LDZ (input) INTEGER
! 178: * The leading dimension of the array Z. LDZ >= 1, and if
! 179: * JOBZ = 'V', LDZ >= max(1,N).
! 180: *
! 181: * ISUPPZ (output) INTEGER array, dimension ( 2*max(1,M) )
! 182: * The support of the eigenvectors in Z, i.e., the indices
! 183: * indicating the nonzero elements in Z. The i-th eigenvector
! 184: * is nonzero only in elements ISUPPZ( 2*i-1 ) through
! 185: * ISUPPZ( 2*i ).
! 186: ********** Implemented only for RANGE = 'A' or 'I' and IU - IL = N - 1
! 187: *
! 188: * WORK (workspace/output) COMPLEX*16 array, dimension (MAX(1,LWORK))
! 189: * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
! 190: *
! 191: * LWORK (input) INTEGER
! 192: * The length of the array WORK. LWORK >= max(1,2*N).
! 193: * For optimal efficiency, LWORK >= (NB+1)*N,
! 194: * where NB is the max of the blocksize for ZHETRD and for
! 195: * ZUNMTR as returned by ILAENV.
! 196: *
! 197: * If LWORK = -1, then a workspace query is assumed; the routine
! 198: * only calculates the optimal sizes of the WORK, RWORK and
! 199: * IWORK arrays, returns these values as the first entries of
! 200: * the WORK, RWORK and IWORK arrays, and no error message
! 201: * related to LWORK or LRWORK or LIWORK is issued by XERBLA.
! 202: *
! 203: * RWORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LRWORK))
! 204: * On exit, if INFO = 0, RWORK(1) returns the optimal
! 205: * (and minimal) LRWORK.
! 206: *
! 207: * LRWORK (input) INTEGER
! 208: * The length of the array RWORK. LRWORK >= max(1,24*N).
! 209: *
! 210: * If LRWORK = -1, then a workspace query is assumed; the
! 211: * routine only calculates the optimal sizes of the WORK, RWORK
! 212: * and IWORK arrays, returns these values as the first entries
! 213: * of the WORK, RWORK and IWORK arrays, and no error message
! 214: * related to LWORK or LRWORK or LIWORK is issued by XERBLA.
! 215: *
! 216: * IWORK (workspace/output) INTEGER array, dimension (MAX(1,LIWORK))
! 217: * On exit, if INFO = 0, IWORK(1) returns the optimal
! 218: * (and minimal) LIWORK.
! 219: *
! 220: * LIWORK (input) INTEGER
! 221: * The dimension of the array IWORK. LIWORK >= max(1,10*N).
! 222: *
! 223: * If LIWORK = -1, then a workspace query is assumed; the
! 224: * routine only calculates the optimal sizes of the WORK, RWORK
! 225: * and IWORK arrays, returns these values as the first entries
! 226: * of the WORK, RWORK and IWORK arrays, and no error message
! 227: * related to LWORK or LRWORK or LIWORK is issued by XERBLA.
! 228: *
! 229: * INFO (output) INTEGER
! 230: * = 0: successful exit
! 231: * < 0: if INFO = -i, the i-th argument had an illegal value
! 232: * > 0: Internal error
! 233: *
! 234: * Further Details
! 235: * ===============
! 236: *
! 237: * Based on contributions by
! 238: * Inderjit Dhillon, IBM Almaden, USA
! 239: * Osni Marques, LBNL/NERSC, USA
! 240: * Ken Stanley, Computer Science Division, University of
! 241: * California at Berkeley, USA
! 242: * Jason Riedy, Computer Science Division, University of
! 243: * California at Berkeley, USA
! 244: *
! 245: * =====================================================================
! 246: *
! 247: * .. Parameters ..
! 248: DOUBLE PRECISION ZERO, ONE, TWO
! 249: PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0, TWO = 2.0D+0 )
! 250: * ..
! 251: * .. Local Scalars ..
! 252: LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
! 253: $ WANTZ, TRYRAC
! 254: CHARACTER ORDER
! 255: INTEGER I, IEEEOK, IINFO, IMAX, INDIBL, INDIFL, INDISP,
! 256: $ INDIWO, INDRD, INDRDD, INDRE, INDREE, INDRWK,
! 257: $ INDTAU, INDWK, INDWKN, ISCALE, ITMP1, J, JJ,
! 258: $ LIWMIN, LLWORK, LLRWORK, LLWRKN, LRWMIN,
! 259: $ LWKOPT, LWMIN, NB, NSPLIT
! 260: DOUBLE PRECISION ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
! 261: $ SIGMA, SMLNUM, TMP1, VLL, VUU
! 262: * ..
! 263: * .. External Functions ..
! 264: LOGICAL LSAME
! 265: INTEGER ILAENV
! 266: DOUBLE PRECISION DLAMCH, ZLANSY
! 267: EXTERNAL LSAME, ILAENV, DLAMCH, ZLANSY
! 268: * ..
! 269: * .. External Subroutines ..
! 270: EXTERNAL DCOPY, DSCAL, DSTEBZ, DSTERF, XERBLA, ZDSCAL,
! 271: $ ZHETRD, ZSTEMR, ZSTEIN, ZSWAP, ZUNMTR
! 272: * ..
! 273: * .. Intrinsic Functions ..
! 274: INTRINSIC DBLE, MAX, MIN, SQRT
! 275: * ..
! 276: * .. Executable Statements ..
! 277: *
! 278: * Test the input parameters.
! 279: *
! 280: IEEEOK = ILAENV( 10, 'ZHEEVR', 'N', 1, 2, 3, 4 )
! 281: *
! 282: LOWER = LSAME( UPLO, 'L' )
! 283: WANTZ = LSAME( JOBZ, 'V' )
! 284: ALLEIG = LSAME( RANGE, 'A' )
! 285: VALEIG = LSAME( RANGE, 'V' )
! 286: INDEIG = LSAME( RANGE, 'I' )
! 287: *
! 288: LQUERY = ( ( LWORK.EQ.-1 ) .OR. ( LRWORK.EQ.-1 ) .OR.
! 289: $ ( LIWORK.EQ.-1 ) )
! 290: *
! 291: LRWMIN = MAX( 1, 24*N )
! 292: LIWMIN = MAX( 1, 10*N )
! 293: LWMIN = MAX( 1, 2*N )
! 294: *
! 295: INFO = 0
! 296: IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
! 297: INFO = -1
! 298: ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
! 299: INFO = -2
! 300: ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN
! 301: INFO = -3
! 302: ELSE IF( N.LT.0 ) THEN
! 303: INFO = -4
! 304: ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
! 305: INFO = -6
! 306: ELSE
! 307: IF( VALEIG ) THEN
! 308: IF( N.GT.0 .AND. VU.LE.VL )
! 309: $ INFO = -8
! 310: ELSE IF( INDEIG ) THEN
! 311: IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
! 312: INFO = -9
! 313: ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
! 314: INFO = -10
! 315: END IF
! 316: END IF
! 317: END IF
! 318: IF( INFO.EQ.0 ) THEN
! 319: IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
! 320: INFO = -15
! 321: END IF
! 322: END IF
! 323: *
! 324: IF( INFO.EQ.0 ) THEN
! 325: NB = ILAENV( 1, 'ZHETRD', UPLO, N, -1, -1, -1 )
! 326: NB = MAX( NB, ILAENV( 1, 'ZUNMTR', UPLO, N, -1, -1, -1 ) )
! 327: LWKOPT = MAX( ( NB+1 )*N, LWMIN )
! 328: WORK( 1 ) = LWKOPT
! 329: RWORK( 1 ) = LRWMIN
! 330: IWORK( 1 ) = LIWMIN
! 331: *
! 332: IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
! 333: INFO = -18
! 334: ELSE IF( LRWORK.LT.LRWMIN .AND. .NOT.LQUERY ) THEN
! 335: INFO = -20
! 336: ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
! 337: INFO = -22
! 338: END IF
! 339: END IF
! 340: *
! 341: IF( INFO.NE.0 ) THEN
! 342: CALL XERBLA( 'ZHEEVR', -INFO )
! 343: RETURN
! 344: ELSE IF( LQUERY ) THEN
! 345: RETURN
! 346: END IF
! 347: *
! 348: * Quick return if possible
! 349: *
! 350: M = 0
! 351: IF( N.EQ.0 ) THEN
! 352: WORK( 1 ) = 1
! 353: RETURN
! 354: END IF
! 355: *
! 356: IF( N.EQ.1 ) THEN
! 357: WORK( 1 ) = 2
! 358: IF( ALLEIG .OR. INDEIG ) THEN
! 359: M = 1
! 360: W( 1 ) = DBLE( A( 1, 1 ) )
! 361: ELSE
! 362: IF( VL.LT.DBLE( A( 1, 1 ) ) .AND. VU.GE.DBLE( A( 1, 1 ) ) )
! 363: $ THEN
! 364: M = 1
! 365: W( 1 ) = DBLE( A( 1, 1 ) )
! 366: END IF
! 367: END IF
! 368: IF( WANTZ )
! 369: $ Z( 1, 1 ) = ONE
! 370: RETURN
! 371: END IF
! 372: *
! 373: * Get machine constants.
! 374: *
! 375: SAFMIN = DLAMCH( 'Safe minimum' )
! 376: EPS = DLAMCH( 'Precision' )
! 377: SMLNUM = SAFMIN / EPS
! 378: BIGNUM = ONE / SMLNUM
! 379: RMIN = SQRT( SMLNUM )
! 380: RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
! 381: *
! 382: * Scale matrix to allowable range, if necessary.
! 383: *
! 384: ISCALE = 0
! 385: ABSTLL = ABSTOL
! 386: IF (VALEIG) THEN
! 387: VLL = VL
! 388: VUU = VU
! 389: END IF
! 390: ANRM = ZLANSY( 'M', UPLO, N, A, LDA, RWORK )
! 391: IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
! 392: ISCALE = 1
! 393: SIGMA = RMIN / ANRM
! 394: ELSE IF( ANRM.GT.RMAX ) THEN
! 395: ISCALE = 1
! 396: SIGMA = RMAX / ANRM
! 397: END IF
! 398: IF( ISCALE.EQ.1 ) THEN
! 399: IF( LOWER ) THEN
! 400: DO 10 J = 1, N
! 401: CALL ZDSCAL( N-J+1, SIGMA, A( J, J ), 1 )
! 402: 10 CONTINUE
! 403: ELSE
! 404: DO 20 J = 1, N
! 405: CALL ZDSCAL( J, SIGMA, A( 1, J ), 1 )
! 406: 20 CONTINUE
! 407: END IF
! 408: IF( ABSTOL.GT.0 )
! 409: $ ABSTLL = ABSTOL*SIGMA
! 410: IF( VALEIG ) THEN
! 411: VLL = VL*SIGMA
! 412: VUU = VU*SIGMA
! 413: END IF
! 414: END IF
! 415:
! 416: * Initialize indices into workspaces. Note: The IWORK indices are
! 417: * used only if DSTERF or ZSTEMR fail.
! 418:
! 419: * WORK(INDTAU:INDTAU+N-1) stores the complex scalar factors of the
! 420: * elementary reflectors used in ZHETRD.
! 421: INDTAU = 1
! 422: * INDWK is the starting offset of the remaining complex workspace,
! 423: * and LLWORK is the remaining complex workspace size.
! 424: INDWK = INDTAU + N
! 425: LLWORK = LWORK - INDWK + 1
! 426:
! 427: * RWORK(INDRD:INDRD+N-1) stores the real tridiagonal's diagonal
! 428: * entries.
! 429: INDRD = 1
! 430: * RWORK(INDRE:INDRE+N-1) stores the off-diagonal entries of the
! 431: * tridiagonal matrix from ZHETRD.
! 432: INDRE = INDRD + N
! 433: * RWORK(INDRDD:INDRDD+N-1) is a copy of the diagonal entries over
! 434: * -written by ZSTEMR (the DSTERF path copies the diagonal to W).
! 435: INDRDD = INDRE + N
! 436: * RWORK(INDREE:INDREE+N-1) is a copy of the off-diagonal entries over
! 437: * -written while computing the eigenvalues in DSTERF and ZSTEMR.
! 438: INDREE = INDRDD + N
! 439: * INDRWK is the starting offset of the left-over real workspace, and
! 440: * LLRWORK is the remaining workspace size.
! 441: INDRWK = INDREE + N
! 442: LLRWORK = LRWORK - INDRWK + 1
! 443:
! 444: * IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in DSTEBZ and
! 445: * stores the block indices of each of the M<=N eigenvalues.
! 446: INDIBL = 1
! 447: * IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in DSTEBZ and
! 448: * stores the starting and finishing indices of each block.
! 449: INDISP = INDIBL + N
! 450: * IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors
! 451: * that corresponding to eigenvectors that fail to converge in
! 452: * DSTEIN. This information is discarded; if any fail, the driver
! 453: * returns INFO > 0.
! 454: INDIFL = INDISP + N
! 455: * INDIWO is the offset of the remaining integer workspace.
! 456: INDIWO = INDISP + N
! 457:
! 458: *
! 459: * Call ZHETRD to reduce Hermitian matrix to tridiagonal form.
! 460: *
! 461: CALL ZHETRD( UPLO, N, A, LDA, RWORK( INDRD ), RWORK( INDRE ),
! 462: $ WORK( INDTAU ), WORK( INDWK ), LLWORK, IINFO )
! 463: *
! 464: * If all eigenvalues are desired
! 465: * then call DSTERF or ZSTEMR and ZUNMTR.
! 466: *
! 467: TEST = .FALSE.
! 468: IF( INDEIG ) THEN
! 469: IF( IL.EQ.1 .AND. IU.EQ.N ) THEN
! 470: TEST = .TRUE.
! 471: END IF
! 472: END IF
! 473: IF( ( ALLEIG.OR.TEST ) .AND. ( IEEEOK.EQ.1 ) ) THEN
! 474: IF( .NOT.WANTZ ) THEN
! 475: CALL DCOPY( N, RWORK( INDRD ), 1, W, 1 )
! 476: CALL DCOPY( N-1, RWORK( INDRE ), 1, RWORK( INDREE ), 1 )
! 477: CALL DSTERF( N, W, RWORK( INDREE ), INFO )
! 478: ELSE
! 479: CALL DCOPY( N-1, RWORK( INDRE ), 1, RWORK( INDREE ), 1 )
! 480: CALL DCOPY( N, RWORK( INDRD ), 1, RWORK( INDRDD ), 1 )
! 481: *
! 482: IF (ABSTOL .LE. TWO*N*EPS) THEN
! 483: TRYRAC = .TRUE.
! 484: ELSE
! 485: TRYRAC = .FALSE.
! 486: END IF
! 487: CALL ZSTEMR( JOBZ, 'A', N, RWORK( INDRDD ),
! 488: $ RWORK( INDREE ), VL, VU, IL, IU, M, W,
! 489: $ Z, LDZ, N, ISUPPZ, TRYRAC,
! 490: $ RWORK( INDRWK ), LLRWORK,
! 491: $ IWORK, LIWORK, INFO )
! 492: *
! 493: * Apply unitary matrix used in reduction to tridiagonal
! 494: * form to eigenvectors returned by ZSTEIN.
! 495: *
! 496: IF( WANTZ .AND. INFO.EQ.0 ) THEN
! 497: INDWKN = INDWK
! 498: LLWRKN = LWORK - INDWKN + 1
! 499: CALL ZUNMTR( 'L', UPLO, 'N', N, M, A, LDA,
! 500: $ WORK( INDTAU ), Z, LDZ, WORK( INDWKN ),
! 501: $ LLWRKN, IINFO )
! 502: END IF
! 503: END IF
! 504: *
! 505: *
! 506: IF( INFO.EQ.0 ) THEN
! 507: M = N
! 508: GO TO 30
! 509: END IF
! 510: INFO = 0
! 511: END IF
! 512: *
! 513: * Otherwise, call DSTEBZ and, if eigenvectors are desired, ZSTEIN.
! 514: * Also call DSTEBZ and ZSTEIN if ZSTEMR fails.
! 515: *
! 516: IF( WANTZ ) THEN
! 517: ORDER = 'B'
! 518: ELSE
! 519: ORDER = 'E'
! 520: END IF
! 521:
! 522: CALL DSTEBZ( RANGE, ORDER, N, VLL, VUU, IL, IU, ABSTLL,
! 523: $ RWORK( INDRD ), RWORK( INDRE ), M, NSPLIT, W,
! 524: $ IWORK( INDIBL ), IWORK( INDISP ), RWORK( INDRWK ),
! 525: $ IWORK( INDIWO ), INFO )
! 526: *
! 527: IF( WANTZ ) THEN
! 528: CALL ZSTEIN( N, RWORK( INDRD ), RWORK( INDRE ), M, W,
! 529: $ IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ,
! 530: $ RWORK( INDRWK ), IWORK( INDIWO ), IWORK( INDIFL ),
! 531: $ INFO )
! 532: *
! 533: * Apply unitary matrix used in reduction to tridiagonal
! 534: * form to eigenvectors returned by ZSTEIN.
! 535: *
! 536: INDWKN = INDWK
! 537: LLWRKN = LWORK - INDWKN + 1
! 538: CALL ZUNMTR( 'L', UPLO, 'N', N, M, A, LDA, WORK( INDTAU ), Z,
! 539: $ LDZ, WORK( INDWKN ), LLWRKN, IINFO )
! 540: END IF
! 541: *
! 542: * If matrix was scaled, then rescale eigenvalues appropriately.
! 543: *
! 544: 30 CONTINUE
! 545: IF( ISCALE.EQ.1 ) THEN
! 546: IF( INFO.EQ.0 ) THEN
! 547: IMAX = M
! 548: ELSE
! 549: IMAX = INFO - 1
! 550: END IF
! 551: CALL DSCAL( IMAX, ONE / SIGMA, W, 1 )
! 552: END IF
! 553: *
! 554: * If eigenvalues are not in order, then sort them, along with
! 555: * eigenvectors.
! 556: *
! 557: IF( WANTZ ) THEN
! 558: DO 50 J = 1, M - 1
! 559: I = 0
! 560: TMP1 = W( J )
! 561: DO 40 JJ = J + 1, M
! 562: IF( W( JJ ).LT.TMP1 ) THEN
! 563: I = JJ
! 564: TMP1 = W( JJ )
! 565: END IF
! 566: 40 CONTINUE
! 567: *
! 568: IF( I.NE.0 ) THEN
! 569: ITMP1 = IWORK( INDIBL+I-1 )
! 570: W( I ) = W( J )
! 571: IWORK( INDIBL+I-1 ) = IWORK( INDIBL+J-1 )
! 572: W( J ) = TMP1
! 573: IWORK( INDIBL+J-1 ) = ITMP1
! 574: CALL ZSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
! 575: END IF
! 576: 50 CONTINUE
! 577: END IF
! 578: *
! 579: * Set WORK(1) to optimal workspace size.
! 580: *
! 581: WORK( 1 ) = LWKOPT
! 582: RWORK( 1 ) = LRWMIN
! 583: IWORK( 1 ) = LIWMIN
! 584: *
! 585: RETURN
! 586: *
! 587: * End of ZHEEVR
! 588: *
! 589: END
CVSweb interface <joel.bertrand@systella.fr>