![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b DSPGST 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download DSPGV + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dspgv.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dspgv.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dspgv.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE DSPGV( ITYPE, JOBZ, UPLO, N, AP, BP, W, Z, LDZ, WORK, 00022 * INFO ) 00023 * 00024 * .. Scalar Arguments .. 00025 * CHARACTER JOBZ, UPLO 00026 * INTEGER INFO, ITYPE, LDZ, N 00027 * .. 00028 * .. Array Arguments .. 00029 * DOUBLE PRECISION AP( * ), BP( * ), W( * ), WORK( * ), 00030 * $ Z( LDZ, * ) 00031 * .. 00032 * 00033 * 00034 *> \par Purpose: 00035 * ============= 00036 *> 00037 *> \verbatim 00038 *> 00039 *> DSPGV computes all the eigenvalues and, optionally, the eigenvectors 00040 *> of a real generalized symmetric-definite eigenproblem, of the form 00041 *> A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. 00042 *> Here A and B are assumed to be symmetric, stored in packed format, 00043 *> and B is also positive definite. 00044 *> \endverbatim 00045 * 00046 * Arguments: 00047 * ========== 00048 * 00049 *> \param[in] ITYPE 00050 *> \verbatim 00051 *> ITYPE is INTEGER 00052 *> Specifies the problem type to be solved: 00053 *> = 1: A*x = (lambda)*B*x 00054 *> = 2: A*B*x = (lambda)*x 00055 *> = 3: B*A*x = (lambda)*x 00056 *> \endverbatim 00057 *> 00058 *> \param[in] JOBZ 00059 *> \verbatim 00060 *> JOBZ is CHARACTER*1 00061 *> = 'N': Compute eigenvalues only; 00062 *> = 'V': Compute eigenvalues and eigenvectors. 00063 *> \endverbatim 00064 *> 00065 *> \param[in] UPLO 00066 *> \verbatim 00067 *> UPLO is CHARACTER*1 00068 *> = 'U': Upper triangles of A and B are stored; 00069 *> = 'L': Lower triangles of A and B are stored. 00070 *> \endverbatim 00071 *> 00072 *> \param[in] N 00073 *> \verbatim 00074 *> N is INTEGER 00075 *> The order of the matrices A and B. N >= 0. 00076 *> \endverbatim 00077 *> 00078 *> \param[in,out] AP 00079 *> \verbatim 00080 *> AP is DOUBLE PRECISION array, dimension 00081 *> (N*(N+1)/2) 00082 *> On entry, the upper or lower triangle of the symmetric matrix 00083 *> A, packed columnwise in a linear array. The j-th column of A 00084 *> is stored in the array AP as follows: 00085 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; 00086 *> if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n. 00087 *> 00088 *> On exit, the contents of AP are destroyed. 00089 *> \endverbatim 00090 *> 00091 *> \param[in,out] BP 00092 *> \verbatim 00093 *> BP is DOUBLE PRECISION array, dimension (N*(N+1)/2) 00094 *> On entry, the upper or lower triangle of the symmetric matrix 00095 *> B, packed columnwise in a linear array. The j-th column of B 00096 *> is stored in the array BP as follows: 00097 *> if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j; 00098 *> if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n. 00099 *> 00100 *> On exit, the triangular factor U or L from the Cholesky 00101 *> factorization B = U**T*U or B = L*L**T, in the same storage 00102 *> format as B. 00103 *> \endverbatim 00104 *> 00105 *> \param[out] W 00106 *> \verbatim 00107 *> W is DOUBLE PRECISION array, dimension (N) 00108 *> If INFO = 0, the eigenvalues in ascending order. 00109 *> \endverbatim 00110 *> 00111 *> \param[out] Z 00112 *> \verbatim 00113 *> Z is DOUBLE PRECISION array, dimension (LDZ, N) 00114 *> If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of 00115 *> eigenvectors. The eigenvectors are normalized as follows: 00116 *> if ITYPE = 1 or 2, Z**T*B*Z = I; 00117 *> if ITYPE = 3, Z**T*inv(B)*Z = I. 00118 *> If JOBZ = 'N', then Z is not referenced. 00119 *> \endverbatim 00120 *> 00121 *> \param[in] LDZ 00122 *> \verbatim 00123 *> LDZ is INTEGER 00124 *> The leading dimension of the array Z. LDZ >= 1, and if 00125 *> JOBZ = 'V', LDZ >= max(1,N). 00126 *> \endverbatim 00127 *> 00128 *> \param[out] WORK 00129 *> \verbatim 00130 *> WORK is DOUBLE PRECISION array, dimension (3*N) 00131 *> \endverbatim 00132 *> 00133 *> \param[out] INFO 00134 *> \verbatim 00135 *> INFO is INTEGER 00136 *> = 0: successful exit 00137 *> < 0: if INFO = -i, the i-th argument had an illegal value 00138 *> > 0: DPPTRF or DSPEV returned an error code: 00139 *> <= N: if INFO = i, DSPEV failed to converge; 00140 *> i off-diagonal elements of an intermediate 00141 *> tridiagonal form did not converge to zero. 00142 *> > N: if INFO = n + i, for 1 <= i <= n, then the leading 00143 *> minor of order i of B is not positive definite. 00144 *> The factorization of B could not be completed and 00145 *> no eigenvalues or eigenvectors were computed. 00146 *> \endverbatim 00147 * 00148 * Authors: 00149 * ======== 00150 * 00151 *> \author Univ. of Tennessee 00152 *> \author Univ. of California Berkeley 00153 *> \author Univ. of Colorado Denver 00154 *> \author NAG Ltd. 00155 * 00156 *> \date November 2011 00157 * 00158 *> \ingroup doubleOTHEReigen 00159 * 00160 * ===================================================================== 00161 SUBROUTINE DSPGV( ITYPE, JOBZ, UPLO, N, AP, BP, W, Z, LDZ, WORK, 00162 $ INFO ) 00163 * 00164 * -- LAPACK driver routine (version 3.4.0) -- 00165 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00166 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00167 * November 2011 00168 * 00169 * .. Scalar Arguments .. 00170 CHARACTER JOBZ, UPLO 00171 INTEGER INFO, ITYPE, LDZ, N 00172 * .. 00173 * .. Array Arguments .. 00174 DOUBLE PRECISION AP( * ), BP( * ), W( * ), WORK( * ), 00175 $ Z( LDZ, * ) 00176 * .. 00177 * 00178 * ===================================================================== 00179 * 00180 * .. Local Scalars .. 00181 LOGICAL UPPER, WANTZ 00182 CHARACTER TRANS 00183 INTEGER J, NEIG 00184 * .. 00185 * .. External Functions .. 00186 LOGICAL LSAME 00187 EXTERNAL LSAME 00188 * .. 00189 * .. External Subroutines .. 00190 EXTERNAL DPPTRF, DSPEV, DSPGST, DTPMV, DTPSV, XERBLA 00191 * .. 00192 * .. Executable Statements .. 00193 * 00194 * Test the input parameters. 00195 * 00196 WANTZ = LSAME( JOBZ, 'V' ) 00197 UPPER = LSAME( UPLO, 'U' ) 00198 * 00199 INFO = 0 00200 IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN 00201 INFO = -1 00202 ELSE IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN 00203 INFO = -2 00204 ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN 00205 INFO = -3 00206 ELSE IF( N.LT.0 ) THEN 00207 INFO = -4 00208 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN 00209 INFO = -9 00210 END IF 00211 IF( INFO.NE.0 ) THEN 00212 CALL XERBLA( 'DSPGV ', -INFO ) 00213 RETURN 00214 END IF 00215 * 00216 * Quick return if possible 00217 * 00218 IF( N.EQ.0 ) 00219 $ RETURN 00220 * 00221 * Form a Cholesky factorization of B. 00222 * 00223 CALL DPPTRF( UPLO, N, BP, INFO ) 00224 IF( INFO.NE.0 ) THEN 00225 INFO = N + INFO 00226 RETURN 00227 END IF 00228 * 00229 * Transform problem to standard eigenvalue problem and solve. 00230 * 00231 CALL DSPGST( ITYPE, UPLO, N, AP, BP, INFO ) 00232 CALL DSPEV( JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, INFO ) 00233 * 00234 IF( WANTZ ) THEN 00235 * 00236 * Backtransform eigenvectors to the original problem. 00237 * 00238 NEIG = N 00239 IF( INFO.GT.0 ) 00240 $ NEIG = INFO - 1 00241 IF( ITYPE.EQ.1 .OR. ITYPE.EQ.2 ) THEN 00242 * 00243 * For A*x=(lambda)*B*x and A*B*x=(lambda)*x; 00244 * backtransform eigenvectors: x = inv(L)**T*y or inv(U)*y 00245 * 00246 IF( UPPER ) THEN 00247 TRANS = 'N' 00248 ELSE 00249 TRANS = 'T' 00250 END IF 00251 * 00252 DO 10 J = 1, NEIG 00253 CALL DTPSV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ), 00254 $ 1 ) 00255 10 CONTINUE 00256 * 00257 ELSE IF( ITYPE.EQ.3 ) THEN 00258 * 00259 * For B*A*x=(lambda)*x; 00260 * backtransform eigenvectors: x = L*y or U**T*y 00261 * 00262 IF( UPPER ) THEN 00263 TRANS = 'T' 00264 ELSE 00265 TRANS = 'N' 00266 END IF 00267 * 00268 DO 20 J = 1, NEIG 00269 CALL DTPMV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ), 00270 $ 1 ) 00271 20 CONTINUE 00272 END IF 00273 END IF 00274 RETURN 00275 * 00276 * End of DSPGV 00277 * 00278 END