3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DSPGVX + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dspgvx.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dspgvx.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dspgvx.f">
21 * SUBROUTINE DSPGVX( ITYPE, JOBZ, RANGE, UPLO, N, AP, BP, VL, VU,
22 * IL, IU, ABSTOL, M, W, Z, LDZ, WORK, IWORK,
25 * .. Scalar Arguments ..
26 * CHARACTER JOBZ, RANGE, UPLO
27 * INTEGER IL, INFO, ITYPE, IU, LDZ, M, N
28 * DOUBLE PRECISION ABSTOL, VL, VU
30 * .. Array Arguments ..
31 * INTEGER IFAIL( * ), IWORK( * )
32 * DOUBLE PRECISION AP( * ), BP( * ), W( * ), WORK( * ),
42 *> DSPGVX computes selected eigenvalues, and optionally, eigenvectors
43 *> of a real generalized symmetric-definite eigenproblem, of the form
44 *> A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A
45 *> and B are assumed to be symmetric, stored in packed storage, and B
46 *> is also positive definite. Eigenvalues and eigenvectors can be
47 *> selected by specifying either a range of values or a range of indices
48 *> for the desired eigenvalues.
57 *> Specifies the problem type to be solved:
58 *> = 1: A*x = (lambda)*B*x
59 *> = 2: A*B*x = (lambda)*x
60 *> = 3: B*A*x = (lambda)*x
65 *> JOBZ is CHARACTER*1
66 *> = 'N': Compute eigenvalues only;
67 *> = 'V': Compute eigenvalues and eigenvectors.
72 *> RANGE is CHARACTER*1
73 *> = 'A': all eigenvalues will be found.
74 *> = 'V': all eigenvalues in the half-open interval (VL,VU]
76 *> = 'I': the IL-th through IU-th eigenvalues will be found.
81 *> UPLO is CHARACTER*1
82 *> = 'U': Upper triangle of A and B are stored;
83 *> = 'L': Lower triangle of A and B are stored.
89 *> The order of the matrix pencil (A,B). N >= 0.
94 *> AP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
95 *> On entry, the upper or lower triangle of the symmetric matrix
96 *> A, packed columnwise in a linear array. The j-th column of A
97 *> is stored in the array AP as follows:
98 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
99 *> if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
101 *> On exit, the contents of AP are destroyed.
106 *> BP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
107 *> On entry, the upper or lower triangle of the symmetric matrix
108 *> B, packed columnwise in a linear array. The j-th column of B
109 *> is stored in the array BP as follows:
110 *> if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j;
111 *> if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n.
113 *> On exit, the triangular factor U or L from the Cholesky
114 *> factorization B = U**T*U or B = L*L**T, in the same storage
120 *> VL is DOUBLE PRECISION
122 *> If RANGE='V', the lower bound of the interval to
123 *> be searched for eigenvalues. VL < VU.
124 *> Not referenced if RANGE = 'A' or 'I'.
129 *> VU is DOUBLE PRECISION
131 *> If RANGE='V', the upper bound of the interval to
132 *> be searched for eigenvalues. VL < VU.
133 *> Not referenced if RANGE = 'A' or 'I'.
140 *> If RANGE='I', the index of the
141 *> smallest eigenvalue to be returned.
142 *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
143 *> Not referenced if RANGE = 'A' or 'V'.
150 *> If RANGE='I', the index of the
151 *> largest eigenvalue to be returned.
152 *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
153 *> Not referenced if RANGE = 'A' or 'V'.
158 *> ABSTOL is DOUBLE PRECISION
159 *> The absolute error tolerance for the eigenvalues.
160 *> An approximate eigenvalue is accepted as converged
161 *> when it is determined to lie in an interval [a,b]
162 *> of width less than or equal to
164 *> ABSTOL + EPS * max( |a|,|b| ) ,
166 *> where EPS is the machine precision. If ABSTOL is less than
167 *> or equal to zero, then EPS*|T| will be used in its place,
168 *> where |T| is the 1-norm of the tridiagonal matrix obtained
169 *> by reducing A to tridiagonal form.
171 *> Eigenvalues will be computed most accurately when ABSTOL is
172 *> set to twice the underflow threshold 2*DLAMCH('S'), not zero.
173 *> If this routine returns with INFO>0, indicating that some
174 *> eigenvectors did not converge, try setting ABSTOL to
181 *> The total number of eigenvalues found. 0 <= M <= N.
182 *> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
187 *> W is DOUBLE PRECISION array, dimension (N)
188 *> On normal exit, the first M elements contain the selected
189 *> eigenvalues in ascending order.
194 *> Z is DOUBLE PRECISION array, dimension (LDZ, max(1,M))
195 *> If JOBZ = 'N', then Z is not referenced.
196 *> If JOBZ = 'V', then if INFO = 0, the first M columns of Z
197 *> contain the orthonormal eigenvectors of the matrix A
198 *> corresponding to the selected eigenvalues, with the i-th
199 *> column of Z holding the eigenvector associated with W(i).
200 *> The eigenvectors are normalized as follows:
201 *> if ITYPE = 1 or 2, Z**T*B*Z = I;
202 *> if ITYPE = 3, Z**T*inv(B)*Z = I.
204 *> If an eigenvector fails to converge, then that column of Z
205 *> contains the latest approximation to the eigenvector, and the
206 *> index of the eigenvector is returned in IFAIL.
207 *> Note: the user must ensure that at least max(1,M) columns are
208 *> supplied in the array Z; if RANGE = 'V', the exact value of M
209 *> is not known in advance and an upper bound must be used.
215 *> The leading dimension of the array Z. LDZ >= 1, and if
216 *> JOBZ = 'V', LDZ >= max(1,N).
221 *> WORK is DOUBLE PRECISION array, dimension (8*N)
226 *> IWORK is INTEGER array, dimension (5*N)
231 *> IFAIL is INTEGER array, dimension (N)
232 *> If JOBZ = 'V', then if INFO = 0, the first M elements of
233 *> IFAIL are zero. If INFO > 0, then IFAIL contains the
234 *> indices of the eigenvectors that failed to converge.
235 *> If JOBZ = 'N', then IFAIL is not referenced.
241 *> = 0: successful exit
242 *> < 0: if INFO = -i, the i-th argument had an illegal value
243 *> > 0: DPPTRF or DSPEVX returned an error code:
244 *> <= N: if INFO = i, DSPEVX failed to converge;
245 *> i eigenvectors failed to converge. Their indices
246 *> are stored in array IFAIL.
247 *> > N: if INFO = N + i, for 1 <= i <= N, then the leading
248 *> minor of order i of B is not positive definite.
249 *> The factorization of B could not be completed and
250 *> no eigenvalues or eigenvectors were computed.
256 *> \author Univ. of Tennessee
257 *> \author Univ. of California Berkeley
258 *> \author Univ. of Colorado Denver
263 *> \ingroup doubleOTHEReigen
265 *> \par Contributors:
268 *> Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
270 * =====================================================================
271 SUBROUTINE DSPGVX( ITYPE, JOBZ, RANGE, UPLO, N, AP, BP, VL, VU,
272 $ IL, IU, ABSTOL, M, W, Z, LDZ, WORK, IWORK,
275 * -- LAPACK driver routine (version 3.6.1) --
276 * -- LAPACK is a software package provided by Univ. of Tennessee, --
277 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
280 * .. Scalar Arguments ..
281 CHARACTER JOBZ, RANGE, UPLO
282 INTEGER IL, INFO, ITYPE, IU, LDZ, M, N
283 DOUBLE PRECISION ABSTOL, VL, VU
285 * .. Array Arguments ..
286 INTEGER IFAIL( * ), IWORK( * )
287 DOUBLE PRECISION AP( * ), BP( * ), W( * ), WORK( * ),
291 * =====================================================================
293 * .. Local Scalars ..
294 LOGICAL ALLEIG, INDEIG, UPPER, VALEIG, WANTZ
298 * .. External Functions ..
302 * .. External Subroutines ..
303 EXTERNAL DPPTRF, DSPEVX, DSPGST, DTPMV, DTPSV, XERBLA
305 * .. Intrinsic Functions ..
308 * .. Executable Statements ..
310 * Test the input parameters.
312 UPPER = LSAME( UPLO, 'U' )
313 WANTZ = LSAME( JOBZ, 'V' )
314 ALLEIG = LSAME( RANGE, 'A' )
315 VALEIG = LSAME( RANGE, 'V' )
316 INDEIG = LSAME( RANGE, 'I' )
319 IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
321 ELSE IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
323 ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
325 ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
327 ELSE IF( N.LT.0 ) THEN
331 IF( N.GT.0 .AND. VU.LE.VL ) THEN
334 ELSE IF( INDEIG ) THEN
337 ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
343 IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
349 CALL XERBLA( 'DSPGVX', -INFO )
353 * Quick return if possible
359 * Form a Cholesky factorization of B.
361 CALL DPPTRF( UPLO, N, BP, INFO )
367 * Transform problem to standard eigenvalue problem and solve.
369 CALL DSPGST( ITYPE, UPLO, N, AP, BP, INFO )
370 CALL DSPEVX( JOBZ, RANGE, UPLO, N, AP, VL, VU, IL, IU, ABSTOL, M,
371 $ W, Z, LDZ, WORK, IWORK, IFAIL, INFO )
375 * Backtransform eigenvectors to the original problem.
379 IF( ITYPE.EQ.1 .OR. ITYPE.EQ.2 ) THEN
381 * For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
382 * backtransform eigenvectors: x = inv(L)**T*y or inv(U)*y
391 CALL DTPSV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
395 ELSE IF( ITYPE.EQ.3 ) THEN
397 * For B*A*x=(lambda)*x;
398 * backtransform eigenvectors: x = L*y or U**T*y
407 CALL DTPMV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),