![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief <b> DSTEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER 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 DSTEV + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dstev.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dstev.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dstev.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE DSTEV( JOBZ, N, D, E, Z, LDZ, WORK, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * CHARACTER JOBZ 00025 * INTEGER INFO, LDZ, N 00026 * .. 00027 * .. Array Arguments .. 00028 * DOUBLE PRECISION D( * ), E( * ), WORK( * ), Z( LDZ, * ) 00029 * .. 00030 * 00031 * 00032 *> \par Purpose: 00033 * ============= 00034 *> 00035 *> \verbatim 00036 *> 00037 *> DSTEV computes all eigenvalues and, optionally, eigenvectors of a 00038 *> real symmetric tridiagonal matrix A. 00039 *> \endverbatim 00040 * 00041 * Arguments: 00042 * ========== 00043 * 00044 *> \param[in] JOBZ 00045 *> \verbatim 00046 *> JOBZ is CHARACTER*1 00047 *> = 'N': Compute eigenvalues only; 00048 *> = 'V': Compute eigenvalues and eigenvectors. 00049 *> \endverbatim 00050 *> 00051 *> \param[in] N 00052 *> \verbatim 00053 *> N is INTEGER 00054 *> The order of the matrix. N >= 0. 00055 *> \endverbatim 00056 *> 00057 *> \param[in,out] D 00058 *> \verbatim 00059 *> D is DOUBLE PRECISION array, dimension (N) 00060 *> On entry, the n diagonal elements of the tridiagonal matrix 00061 *> A. 00062 *> On exit, if INFO = 0, the eigenvalues in ascending order. 00063 *> \endverbatim 00064 *> 00065 *> \param[in,out] E 00066 *> \verbatim 00067 *> E is DOUBLE PRECISION array, dimension (N-1) 00068 *> On entry, the (n-1) subdiagonal elements of the tridiagonal 00069 *> matrix A, stored in elements 1 to N-1 of E. 00070 *> On exit, the contents of E are destroyed. 00071 *> \endverbatim 00072 *> 00073 *> \param[out] Z 00074 *> \verbatim 00075 *> Z is DOUBLE PRECISION array, dimension (LDZ, N) 00076 *> If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal 00077 *> eigenvectors of the matrix A, with the i-th column of Z 00078 *> holding the eigenvector associated with D(i). 00079 *> If JOBZ = 'N', then Z is not referenced. 00080 *> \endverbatim 00081 *> 00082 *> \param[in] LDZ 00083 *> \verbatim 00084 *> LDZ is INTEGER 00085 *> The leading dimension of the array Z. LDZ >= 1, and if 00086 *> JOBZ = 'V', LDZ >= max(1,N). 00087 *> \endverbatim 00088 *> 00089 *> \param[out] WORK 00090 *> \verbatim 00091 *> WORK is DOUBLE PRECISION array, dimension (max(1,2*N-2)) 00092 *> If JOBZ = 'N', WORK is not referenced. 00093 *> \endverbatim 00094 *> 00095 *> \param[out] INFO 00096 *> \verbatim 00097 *> INFO is INTEGER 00098 *> = 0: successful exit 00099 *> < 0: if INFO = -i, the i-th argument had an illegal value 00100 *> > 0: if INFO = i, the algorithm failed to converge; i 00101 *> off-diagonal elements of E did not converge to zero. 00102 *> \endverbatim 00103 * 00104 * Authors: 00105 * ======== 00106 * 00107 *> \author Univ. of Tennessee 00108 *> \author Univ. of California Berkeley 00109 *> \author Univ. of Colorado Denver 00110 *> \author NAG Ltd. 00111 * 00112 *> \date November 2011 00113 * 00114 *> \ingroup doubleOTHEReigen 00115 * 00116 * ===================================================================== 00117 SUBROUTINE DSTEV( JOBZ, N, D, E, Z, LDZ, WORK, INFO ) 00118 * 00119 * -- LAPACK driver routine (version 3.4.0) -- 00120 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00121 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00122 * November 2011 00123 * 00124 * .. Scalar Arguments .. 00125 CHARACTER JOBZ 00126 INTEGER INFO, LDZ, N 00127 * .. 00128 * .. Array Arguments .. 00129 DOUBLE PRECISION D( * ), E( * ), WORK( * ), Z( LDZ, * ) 00130 * .. 00131 * 00132 * ===================================================================== 00133 * 00134 * .. Parameters .. 00135 DOUBLE PRECISION ZERO, ONE 00136 PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) 00137 * .. 00138 * .. Local Scalars .. 00139 LOGICAL WANTZ 00140 INTEGER IMAX, ISCALE 00141 DOUBLE PRECISION BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA, SMLNUM, 00142 $ TNRM 00143 * .. 00144 * .. External Functions .. 00145 LOGICAL LSAME 00146 DOUBLE PRECISION DLAMCH, DLANST 00147 EXTERNAL LSAME, DLAMCH, DLANST 00148 * .. 00149 * .. External Subroutines .. 00150 EXTERNAL DSCAL, DSTEQR, DSTERF, XERBLA 00151 * .. 00152 * .. Intrinsic Functions .. 00153 INTRINSIC SQRT 00154 * .. 00155 * .. Executable Statements .. 00156 * 00157 * Test the input parameters. 00158 * 00159 WANTZ = LSAME( JOBZ, 'V' ) 00160 * 00161 INFO = 0 00162 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN 00163 INFO = -1 00164 ELSE IF( N.LT.0 ) THEN 00165 INFO = -2 00166 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN 00167 INFO = -6 00168 END IF 00169 * 00170 IF( INFO.NE.0 ) THEN 00171 CALL XERBLA( 'DSTEV ', -INFO ) 00172 RETURN 00173 END IF 00174 * 00175 * Quick return if possible 00176 * 00177 IF( N.EQ.0 ) 00178 $ RETURN 00179 * 00180 IF( N.EQ.1 ) THEN 00181 IF( WANTZ ) 00182 $ Z( 1, 1 ) = ONE 00183 RETURN 00184 END IF 00185 * 00186 * Get machine constants. 00187 * 00188 SAFMIN = DLAMCH( 'Safe minimum' ) 00189 EPS = DLAMCH( 'Precision' ) 00190 SMLNUM = SAFMIN / EPS 00191 BIGNUM = ONE / SMLNUM 00192 RMIN = SQRT( SMLNUM ) 00193 RMAX = SQRT( BIGNUM ) 00194 * 00195 * Scale matrix to allowable range, if necessary. 00196 * 00197 ISCALE = 0 00198 TNRM = DLANST( 'M', N, D, E ) 00199 IF( TNRM.GT.ZERO .AND. TNRM.LT.RMIN ) THEN 00200 ISCALE = 1 00201 SIGMA = RMIN / TNRM 00202 ELSE IF( TNRM.GT.RMAX ) THEN 00203 ISCALE = 1 00204 SIGMA = RMAX / TNRM 00205 END IF 00206 IF( ISCALE.EQ.1 ) THEN 00207 CALL DSCAL( N, SIGMA, D, 1 ) 00208 CALL DSCAL( N-1, SIGMA, E( 1 ), 1 ) 00209 END IF 00210 * 00211 * For eigenvalues only, call DSTERF. For eigenvalues and 00212 * eigenvectors, call DSTEQR. 00213 * 00214 IF( .NOT.WANTZ ) THEN 00215 CALL DSTERF( N, D, E, INFO ) 00216 ELSE 00217 CALL DSTEQR( 'I', N, D, E, Z, LDZ, WORK, INFO ) 00218 END IF 00219 * 00220 * If matrix was scaled, then rescale eigenvalues appropriately. 00221 * 00222 IF( ISCALE.EQ.1 ) THEN 00223 IF( INFO.EQ.0 ) THEN 00224 IMAX = N 00225 ELSE 00226 IMAX = INFO - 1 00227 END IF 00228 CALL DSCAL( IMAX, ONE / SIGMA, D, 1 ) 00229 END IF 00230 * 00231 RETURN 00232 * 00233 * End of DSTEV 00234 * 00235 END