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