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