1       SUBROUTINE DSTEGR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU,
  2      $           ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK, IWORK,
  3      $           LIWORK, INFO )
  4 
  5       IMPLICIT NONE
  6 *
  7 *
  8 *  -- LAPACK computational routine (version 3.2) --
  9 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
 10 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
 11 *     November 2006
 12 *
 13 *     .. Scalar Arguments ..
 14       CHARACTER          JOBZ, RANGE
 15       INTEGER            IL, INFO, IU, LDZ, LIWORK, LWORK, M, N
 16       DOUBLE PRECISION ABSTOL, VL, VU
 17 *     ..
 18 *     .. Array Arguments ..
 19       INTEGER            ISUPPZ( * ), IWORK( * )
 20       DOUBLE PRECISION   D( * ), E( * ), W( * ), WORK( * )
 21       DOUBLE PRECISION   Z( LDZ, * )
 22 *     ..
 23 *
 24 *  Purpose
 25 *  =======
 26 *
 27 *  DSTEGR computes selected eigenvalues and, optionally, eigenvectors
 28 *  of a real symmetric tridiagonal matrix T. Any such unreduced matrix has
 29 *  a well defined set of pairwise different real eigenvalues, the corresponding
 30 *  real eigenvectors are pairwise orthogonal.
 31 *
 32 *  The spectrum may be computed either completely or partially by specifying
 33 *  either an interval (VL,VU] or a range of indices IL:IU for the desired
 34 *  eigenvalues.
 35 *
 36 *  DSTEGR is a compatability wrapper around the improved DSTEMR routine.
 37 *  See DSTEMR for further details.
 38 *
 39 *  One important change is that the ABSTOL parameter no longer provides any
 40 *  benefit and hence is no longer used.
 41 *
 42 *  Note : DSTEGR and DSTEMR work only on machines which follow
 43 *  IEEE-754 floating-point standard in their handling of infinities and
 44 *  NaNs.  Normal execution may create these exceptiona values and hence
 45 *  may abort due to a floating point exception in environments which
 46 *  do not conform to the IEEE-754 standard.
 47 *
 48 *  Arguments
 49 *  =========
 50 *
 51 *  JOBZ    (input) CHARACTER*1
 52 *          = 'N':  Compute eigenvalues only;
 53 *          = 'V':  Compute eigenvalues and eigenvectors.
 54 *
 55 *  RANGE   (input) CHARACTER*1
 56 *          = 'A': all eigenvalues will be found.
 57 *          = 'V': all eigenvalues in the half-open interval (VL,VU]
 58 *                 will be found.
 59 *          = 'I': the IL-th through IU-th eigenvalues will be found.
 60 *
 61 *  N       (input) INTEGER
 62 *          The order of the matrix.  N >= 0.
 63 *
 64 *  D       (input/output) DOUBLE PRECISION array, dimension (N)
 65 *          On entry, the N diagonal elements of the tridiagonal matrix
 66 *          T. On exit, D is overwritten.
 67 *
 68 *  E       (input/output) DOUBLE PRECISION array, dimension (N)
 69 *          On entry, the (N-1) subdiagonal elements of the tridiagonal
 70 *          matrix T in elements 1 to N-1 of E. E(N) need not be set on
 71 *          input, but is used internally as workspace.
 72 *          On exit, E is overwritten.
 73 *
 74 *  VL      (input) DOUBLE PRECISION
 75 *  VU      (input) DOUBLE PRECISION
 76 *          If RANGE='V', the lower and upper bounds of the interval to
 77 *          be searched for eigenvalues. VL < VU.
 78 *          Not referenced if RANGE = 'A' or 'I'.
 79 *
 80 *  IL      (input) INTEGER
 81 *  IU      (input) INTEGER
 82 *          If RANGE='I', the indices (in ascending order) of the
 83 *          smallest and largest eigenvalues to be returned.
 84 *          1 <= IL <= IU <= N, if N > 0.
 85 *          Not referenced if RANGE = 'A' or 'V'.
 86 *
 87 *  ABSTOL  (input) DOUBLE PRECISION
 88 *          Unused.  Was the absolute error tolerance for the
 89 *          eigenvalues/eigenvectors in previous versions.
 90 *
 91 *  M       (output) INTEGER
 92 *          The total number of eigenvalues found.  0 <= M <= N.
 93 *          If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
 94 *
 95 *  W       (output) DOUBLE PRECISION array, dimension (N)
 96 *          The first M elements contain the selected eigenvalues in
 97 *          ascending order.
 98 *
 99 *  Z       (output) DOUBLE PRECISION array, dimension (LDZ, max(1,M) )
100 *          If JOBZ = 'V', and if INFO = 0, then the first M columns of Z
101 *          contain the orthonormal eigenvectors of the matrix T
102 *          corresponding to the selected eigenvalues, with the i-th
103 *          column of Z holding the eigenvector associated with W(i).
104 *          If JOBZ = 'N', then Z is not referenced.
105 *          Note: the user must ensure that at least max(1,M) columns are
106 *          supplied in the array Z; if RANGE = 'V', the exact value of M
107 *          is not known in advance and an upper bound must be used.
108 *          Supplying N columns is always safe.
109 *
110 *  LDZ     (input) INTEGER
111 *          The leading dimension of the array Z.  LDZ >= 1, and if
112 *          JOBZ = 'V', then LDZ >= max(1,N).
113 *
114 *  ISUPPZ  (output) INTEGER ARRAY, dimension ( 2*max(1,M) )
115 *          The support of the eigenvectors in Z, i.e., the indices
116 *          indicating the nonzero elements in Z. The i-th computed eigenvector
117 *          is nonzero only in elements ISUPPZ( 2*i-1 ) through
118 *          ISUPPZ( 2*i ). This is relevant in the case when the matrix
119 *          is split. ISUPPZ is only accessed when JOBZ is 'V' and N > 0.
120 *
121 *  WORK    (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
122 *          On exit, if INFO = 0, WORK(1) returns the optimal
123 *          (and minimal) LWORK.
124 *
125 *  LWORK   (input) INTEGER
126 *          The dimension of the array WORK. LWORK >= max(1,18*N)
127 *          if JOBZ = 'V', and LWORK >= max(1,12*N) if JOBZ = 'N'.
128 *          If LWORK = -1, then a workspace query is assumed; the routine
129 *          only calculates the optimal size of the WORK array, returns
130 *          this value as the first entry of the WORK array, and no error
131 *          message related to LWORK is issued by XERBLA.
132 *
133 *  IWORK   (workspace/output) INTEGER array, dimension (LIWORK)
134 *          On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
135 *
136 *  LIWORK  (input) INTEGER
137 *          The dimension of the array IWORK.  LIWORK >= max(1,10*N)
138 *          if the eigenvectors are desired, and LIWORK >= max(1,8*N)
139 *          if only the eigenvalues are to be computed.
140 *          If LIWORK = -1, then a workspace query is assumed; the
141 *          routine only calculates the optimal size of the IWORK array,
142 *          returns this value as the first entry of the IWORK array, and
143 *          no error message related to LIWORK is issued by XERBLA.
144 *
145 *  INFO    (output) INTEGER
146 *          On exit, INFO
147 *          = 0:  successful exit
148 *          < 0:  if INFO = -i, the i-th argument had an illegal value
149 *          > 0:  if INFO = 1X, internal error in DLARRE,
150 *                if INFO = 2X, internal error in DLARRV.
151 *                Here, the digit X = ABS( IINFO ) < 10, where IINFO is
152 *                the nonzero error code returned by DLARRE or
153 *                DLARRV, respectively.
154 *
155 *  Further Details
156 *  ===============
157 *
158 *  Based on contributions by
159 *     Inderjit Dhillon, IBM Almaden, USA
160 *     Osni Marques, LBNL/NERSC, USA
161 *     Christof Voemel, LBNL/NERSC, USA
162 *
163 *  =====================================================================
164 *
165 *     .. Local Scalars ..
166       LOGICAL TRYRAC
167 *     ..
168 *     .. External Subroutines ..
169       EXTERNAL DSTEMR
170 *     ..
171 *     .. Executable Statements ..
172       INFO = 0
173       TRYRAC = .FALSE.
174 
175       CALL DSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU,
176      $                   M, W, Z, LDZ, N, ISUPPZ, TRYRAC, WORK, LWORK,
177      $                   IWORK, LIWORK, INFO )
178 *
179 *     End of DSTEGR
180 *
181       END