00001 /* cstegr.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Subroutine */ int cstegr_(char *jobz, char *range, integer *n, real *d__, 00017 real *e, real *vl, real *vu, integer *il, integer *iu, real *abstol, 00018 integer *m, real *w, complex *z__, integer *ldz, integer *isuppz, 00019 real *work, integer *lwork, integer *iwork, integer *liwork, integer * 00020 info) 00021 { 00022 /* System generated locals */ 00023 integer z_dim1, z_offset; 00024 00025 /* Local variables */ 00026 extern /* Subroutine */ int cstemr_(char *, char *, integer *, real *, 00027 real *, real *, real *, integer *, integer *, integer *, real *, 00028 complex *, integer *, integer *, integer *, logical *, real *, 00029 integer *, integer *, integer *, integer *); 00030 logical tryrac; 00031 00032 00033 00034 /* -- LAPACK computational routine (version 3.2) -- */ 00035 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00036 /* November 2006 */ 00037 00038 /* .. Scalar Arguments .. */ 00039 /* .. */ 00040 /* .. Array Arguments .. */ 00041 /* .. */ 00042 00043 /* Purpose */ 00044 /* ======= */ 00045 00046 /* CSTEGR computes selected eigenvalues and, optionally, eigenvectors */ 00047 /* of a real symmetric tridiagonal matrix T. Any such unreduced matrix has */ 00048 /* a well defined set of pairwise different real eigenvalues, the corresponding */ 00049 /* real eigenvectors are pairwise orthogonal. */ 00050 00051 /* The spectrum may be computed either completely or partially by specifying */ 00052 /* either an interval (VL,VU] or a range of indices IL:IU for the desired */ 00053 /* eigenvalues. */ 00054 00055 /* CSTEGR is a compatability wrapper around the improved CSTEMR routine. */ 00056 /* See SSTEMR for further details. */ 00057 00058 /* One important change is that the ABSTOL parameter no longer provides any */ 00059 /* benefit and hence is no longer used. */ 00060 00061 /* Note : CSTEGR and CSTEMR work only on machines which follow */ 00062 /* IEEE-754 floating-point standard in their handling of infinities and */ 00063 /* NaNs. Normal execution may create these exceptiona values and hence */ 00064 /* may abort due to a floating point exception in environments which */ 00065 /* do not conform to the IEEE-754 standard. */ 00066 00067 /* Arguments */ 00068 /* ========= */ 00069 00070 /* JOBZ (input) CHARACTER*1 */ 00071 /* = 'N': Compute eigenvalues only; */ 00072 /* = 'V': Compute eigenvalues and eigenvectors. */ 00073 00074 /* RANGE (input) CHARACTER*1 */ 00075 /* = 'A': all eigenvalues will be found. */ 00076 /* = 'V': all eigenvalues in the half-open interval (VL,VU] */ 00077 /* will be found. */ 00078 /* = 'I': the IL-th through IU-th eigenvalues will be found. */ 00079 00080 /* N (input) INTEGER */ 00081 /* The order of the matrix. N >= 0. */ 00082 00083 /* D (input/output) REAL array, dimension (N) */ 00084 /* On entry, the N diagonal elements of the tridiagonal matrix */ 00085 /* T. On exit, D is overwritten. */ 00086 00087 /* E (input/output) REAL array, dimension (N) */ 00088 /* On entry, the (N-1) subdiagonal elements of the tridiagonal */ 00089 /* matrix T in elements 1 to N-1 of E. E(N) need not be set on */ 00090 /* input, but is used internally as workspace. */ 00091 /* On exit, E is overwritten. */ 00092 00093 /* VL (input) REAL */ 00094 /* VU (input) REAL */ 00095 /* If RANGE='V', the lower and upper bounds of the interval to */ 00096 /* be searched for eigenvalues. VL < VU. */ 00097 /* Not referenced if RANGE = 'A' or 'I'. */ 00098 00099 /* IL (input) INTEGER */ 00100 /* IU (input) INTEGER */ 00101 /* If RANGE='I', the indices (in ascending order) of the */ 00102 /* smallest and largest eigenvalues to be returned. */ 00103 /* 1 <= IL <= IU <= N, if N > 0. */ 00104 /* Not referenced if RANGE = 'A' or 'V'. */ 00105 00106 /* ABSTOL (input) REAL */ 00107 /* Unused. Was the absolute error tolerance for the */ 00108 /* eigenvalues/eigenvectors in previous versions. */ 00109 00110 /* M (output) INTEGER */ 00111 /* The total number of eigenvalues found. 0 <= M <= N. */ 00112 /* If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1. */ 00113 00114 /* W (output) REAL array, dimension (N) */ 00115 /* The first M elements contain the selected eigenvalues in */ 00116 /* ascending order. */ 00117 00118 /* Z (output) COMPLEX array, dimension (LDZ, max(1,M) ) */ 00119 /* If JOBZ = 'V', and if INFO = 0, then the first M columns of Z */ 00120 /* contain the orthonormal eigenvectors of the matrix T */ 00121 /* corresponding to the selected eigenvalues, with the i-th */ 00122 /* column of Z holding the eigenvector associated with W(i). */ 00123 /* If JOBZ = 'N', then Z is not referenced. */ 00124 /* Note: the user must ensure that at least max(1,M) columns are */ 00125 /* supplied in the array Z; if RANGE = 'V', the exact value of M */ 00126 /* is not known in advance and an upper bound must be used. */ 00127 /* Supplying N columns is always safe. */ 00128 00129 /* LDZ (input) INTEGER */ 00130 /* The leading dimension of the array Z. LDZ >= 1, and if */ 00131 /* JOBZ = 'V', then LDZ >= max(1,N). */ 00132 00133 /* ISUPPZ (output) INTEGER ARRAY, dimension ( 2*max(1,M) ) */ 00134 /* The support of the eigenvectors in Z, i.e., the indices */ 00135 /* indicating the nonzero elements in Z. The i-th computed eigenvector */ 00136 /* is nonzero only in elements ISUPPZ( 2*i-1 ) through */ 00137 /* ISUPPZ( 2*i ). This is relevant in the case when the matrix */ 00138 /* is split. ISUPPZ is only accessed when JOBZ is 'V' and N > 0. */ 00139 00140 /* WORK (workspace/output) REAL array, dimension (LWORK) */ 00141 /* On exit, if INFO = 0, WORK(1) returns the optimal */ 00142 /* (and minimal) LWORK. */ 00143 00144 /* LWORK (input) INTEGER */ 00145 /* The dimension of the array WORK. LWORK >= max(1,18*N) */ 00146 /* if JOBZ = 'V', and LWORK >= max(1,12*N) if JOBZ = 'N'. */ 00147 /* If LWORK = -1, then a workspace query is assumed; the routine */ 00148 /* only calculates the optimal size of the WORK array, returns */ 00149 /* this value as the first entry of the WORK array, and no error */ 00150 /* message related to LWORK is issued by XERBLA. */ 00151 00152 /* IWORK (workspace/output) INTEGER array, dimension (LIWORK) */ 00153 /* On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK. */ 00154 00155 /* LIWORK (input) INTEGER */ 00156 /* The dimension of the array IWORK. LIWORK >= max(1,10*N) */ 00157 /* if the eigenvectors are desired, and LIWORK >= max(1,8*N) */ 00158 /* if only the eigenvalues are to be computed. */ 00159 /* If LIWORK = -1, then a workspace query is assumed; the */ 00160 /* routine only calculates the optimal size of the IWORK array, */ 00161 /* returns this value as the first entry of the IWORK array, and */ 00162 /* no error message related to LIWORK is issued by XERBLA. */ 00163 00164 /* INFO (output) INTEGER */ 00165 /* On exit, INFO */ 00166 /* = 0: successful exit */ 00167 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00168 /* > 0: if INFO = 1X, internal error in SLARRE, */ 00169 /* if INFO = 2X, internal error in CLARRV. */ 00170 /* Here, the digit X = ABS( IINFO ) < 10, where IINFO is */ 00171 /* the nonzero error code returned by SLARRE or */ 00172 /* CLARRV, respectively. */ 00173 00174 /* Further Details */ 00175 /* =============== */ 00176 00177 /* Based on contributions by */ 00178 /* Inderjit Dhillon, IBM Almaden, USA */ 00179 /* Osni Marques, LBNL/NERSC, USA */ 00180 /* Christof Voemel, LBNL/NERSC, USA */ 00181 00182 /* ===================================================================== */ 00183 00184 /* .. Local Scalars .. */ 00185 /* .. */ 00186 /* .. External Subroutines .. */ 00187 /* .. */ 00188 /* .. Executable Statements .. */ 00189 /* Parameter adjustments */ 00190 --d__; 00191 --e; 00192 --w; 00193 z_dim1 = *ldz; 00194 z_offset = 1 + z_dim1; 00195 z__ -= z_offset; 00196 --isuppz; 00197 --work; 00198 --iwork; 00199 00200 /* Function Body */ 00201 *info = 0; 00202 tryrac = FALSE_; 00203 cstemr_(jobz, range, n, &d__[1], &e[1], vl, vu, il, iu, m, &w[1], &z__[ 00204 z_offset], ldz, n, &isuppz[1], &tryrac, &work[1], lwork, &iwork[1] 00205 , liwork, info); 00206 00207 /* End of CSTEGR */ 00208 00209 return 0; 00210 } /* cstegr_ */