Annotation of rpl/lapack/lapack/zhpgvx.f, revision 1.9
1.9 ! bertrand 1: *> \brief \b ZHPGST
! 2: *
! 3: * =========== DOCUMENTATION ===========
! 4: *
! 5: * Online html documentation available at
! 6: * http://www.netlib.org/lapack/explore-html/
! 7: *
! 8: *> \htmlonly
! 9: *> Download ZHPGVX + dependencies
! 10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhpgvx.f">
! 11: *> [TGZ]</a>
! 12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhpgvx.f">
! 13: *> [ZIP]</a>
! 14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhpgvx.f">
! 15: *> [TXT]</a>
! 16: *> \endhtmlonly
! 17: *
! 18: * Definition:
! 19: * ===========
! 20: *
! 21: * SUBROUTINE ZHPGVX( ITYPE, JOBZ, RANGE, UPLO, N, AP, BP, VL, VU,
! 22: * IL, IU, ABSTOL, M, W, Z, LDZ, WORK, RWORK,
! 23: * IWORK, IFAIL, INFO )
! 24: *
! 25: * .. Scalar Arguments ..
! 26: * CHARACTER JOBZ, RANGE, UPLO
! 27: * INTEGER IL, INFO, ITYPE, IU, LDZ, M, N
! 28: * DOUBLE PRECISION ABSTOL, VL, VU
! 29: * ..
! 30: * .. Array Arguments ..
! 31: * INTEGER IFAIL( * ), IWORK( * )
! 32: * DOUBLE PRECISION RWORK( * ), W( * )
! 33: * COMPLEX*16 AP( * ), BP( * ), WORK( * ), Z( LDZ, * )
! 34: * ..
! 35: *
! 36: *
! 37: *> \par Purpose:
! 38: * =============
! 39: *>
! 40: *> \verbatim
! 41: *>
! 42: *> ZHPGVX computes selected eigenvalues and, optionally, eigenvectors
! 43: *> of a complex generalized Hermitian-definite eigenproblem, of the form
! 44: *> A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A and
! 45: *> B are assumed to be Hermitian, stored in packed format, and B is also
! 46: *> positive definite. Eigenvalues and eigenvectors can be selected by
! 47: *> specifying either a range of values or a range of indices for the
! 48: *> desired eigenvalues.
! 49: *> \endverbatim
! 50: *
! 51: * Arguments:
! 52: * ==========
! 53: *
! 54: *> \param[in] ITYPE
! 55: *> \verbatim
! 56: *> ITYPE is INTEGER
! 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
! 61: *> \endverbatim
! 62: *>
! 63: *> \param[in] JOBZ
! 64: *> \verbatim
! 65: *> JOBZ is CHARACTER*1
! 66: *> = 'N': Compute eigenvalues only;
! 67: *> = 'V': Compute eigenvalues and eigenvectors.
! 68: *> \endverbatim
! 69: *>
! 70: *> \param[in] RANGE
! 71: *> \verbatim
! 72: *> RANGE is CHARACTER*1
! 73: *> = 'A': all eigenvalues will be found;
! 74: *> = 'V': all eigenvalues in the half-open interval (VL,VU]
! 75: *> will be found;
! 76: *> = 'I': the IL-th through IU-th eigenvalues will be found.
! 77: *> \endverbatim
! 78: *>
! 79: *> \param[in] UPLO
! 80: *> \verbatim
! 81: *> UPLO is CHARACTER*1
! 82: *> = 'U': Upper triangles of A and B are stored;
! 83: *> = 'L': Lower triangles of A and B are stored.
! 84: *> \endverbatim
! 85: *>
! 86: *> \param[in] N
! 87: *> \verbatim
! 88: *> N is INTEGER
! 89: *> The order of the matrices A and B. N >= 0.
! 90: *> \endverbatim
! 91: *>
! 92: *> \param[in,out] AP
! 93: *> \verbatim
! 94: *> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
! 95: *> On entry, the upper or lower triangle of the Hermitian 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.
! 100: *>
! 101: *> On exit, the contents of AP are destroyed.
! 102: *> \endverbatim
! 103: *>
! 104: *> \param[in,out] BP
! 105: *> \verbatim
! 106: *> BP is COMPLEX*16 array, dimension (N*(N+1)/2)
! 107: *> On entry, the upper or lower triangle of the Hermitian 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.
! 112: *>
! 113: *> On exit, the triangular factor U or L from the Cholesky
! 114: *> factorization B = U**H*U or B = L*L**H, in the same storage
! 115: *> format as B.
! 116: *> \endverbatim
! 117: *>
! 118: *> \param[in] VL
! 119: *> \verbatim
! 120: *> VL is DOUBLE PRECISION
! 121: *> \endverbatim
! 122: *>
! 123: *> \param[in] VU
! 124: *> \verbatim
! 125: *> VU is DOUBLE PRECISION
! 126: *>
! 127: *> If RANGE='V', the lower and upper bounds of the interval to
! 128: *> be searched for eigenvalues. VL < VU.
! 129: *> Not referenced if RANGE = 'A' or 'I'.
! 130: *> \endverbatim
! 131: *>
! 132: *> \param[in] IL
! 133: *> \verbatim
! 134: *> IL is INTEGER
! 135: *> \endverbatim
! 136: *>
! 137: *> \param[in] IU
! 138: *> \verbatim
! 139: *> IU is INTEGER
! 140: *>
! 141: *> If RANGE='I', the indices (in ascending order) of the
! 142: *> smallest and largest eigenvalues to be returned.
! 143: *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
! 144: *> Not referenced if RANGE = 'A' or 'V'.
! 145: *> \endverbatim
! 146: *>
! 147: *> \param[in] ABSTOL
! 148: *> \verbatim
! 149: *> ABSTOL is DOUBLE PRECISION
! 150: *> The absolute error tolerance for the eigenvalues.
! 151: *> An approximate eigenvalue is accepted as converged
! 152: *> when it is determined to lie in an interval [a,b]
! 153: *> of width less than or equal to
! 154: *>
! 155: *> ABSTOL + EPS * max( |a|,|b| ) ,
! 156: *>
! 157: *> where EPS is the machine precision. If ABSTOL is less than
! 158: *> or equal to zero, then EPS*|T| will be used in its place,
! 159: *> where |T| is the 1-norm of the tridiagonal matrix obtained
! 160: *> by reducing AP to tridiagonal form.
! 161: *>
! 162: *> Eigenvalues will be computed most accurately when ABSTOL is
! 163: *> set to twice the underflow threshold 2*DLAMCH('S'), not zero.
! 164: *> If this routine returns with INFO>0, indicating that some
! 165: *> eigenvectors did not converge, try setting ABSTOL to
! 166: *> 2*DLAMCH('S').
! 167: *> \endverbatim
! 168: *>
! 169: *> \param[out] M
! 170: *> \verbatim
! 171: *> M is INTEGER
! 172: *> The total number of eigenvalues found. 0 <= M <= N.
! 173: *> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
! 174: *> \endverbatim
! 175: *>
! 176: *> \param[out] W
! 177: *> \verbatim
! 178: *> W is DOUBLE PRECISION array, dimension (N)
! 179: *> On normal exit, the first M elements contain the selected
! 180: *> eigenvalues in ascending order.
! 181: *> \endverbatim
! 182: *>
! 183: *> \param[out] Z
! 184: *> \verbatim
! 185: *> Z is COMPLEX*16 array, dimension (LDZ, N)
! 186: *> If JOBZ = 'N', then Z is not referenced.
! 187: *> If JOBZ = 'V', then if INFO = 0, the first M columns of Z
! 188: *> contain the orthonormal eigenvectors of the matrix A
! 189: *> corresponding to the selected eigenvalues, with the i-th
! 190: *> column of Z holding the eigenvector associated with W(i).
! 191: *> The eigenvectors are normalized as follows:
! 192: *> if ITYPE = 1 or 2, Z**H*B*Z = I;
! 193: *> if ITYPE = 3, Z**H*inv(B)*Z = I.
! 194: *>
! 195: *> If an eigenvector fails to converge, then that column of Z
! 196: *> contains the latest approximation to the eigenvector, and the
! 197: *> index of the eigenvector is returned in IFAIL.
! 198: *> Note: the user must ensure that at least max(1,M) columns are
! 199: *> supplied in the array Z; if RANGE = 'V', the exact value of M
! 200: *> is not known in advance and an upper bound must be used.
! 201: *> \endverbatim
! 202: *>
! 203: *> \param[in] LDZ
! 204: *> \verbatim
! 205: *> LDZ is INTEGER
! 206: *> The leading dimension of the array Z. LDZ >= 1, and if
! 207: *> JOBZ = 'V', LDZ >= max(1,N).
! 208: *> \endverbatim
! 209: *>
! 210: *> \param[out] WORK
! 211: *> \verbatim
! 212: *> WORK is COMPLEX*16 array, dimension (2*N)
! 213: *> \endverbatim
! 214: *>
! 215: *> \param[out] RWORK
! 216: *> \verbatim
! 217: *> RWORK is DOUBLE PRECISION array, dimension (7*N)
! 218: *> \endverbatim
! 219: *>
! 220: *> \param[out] IWORK
! 221: *> \verbatim
! 222: *> IWORK is INTEGER array, dimension (5*N)
! 223: *> \endverbatim
! 224: *>
! 225: *> \param[out] IFAIL
! 226: *> \verbatim
! 227: *> IFAIL is INTEGER array, dimension (N)
! 228: *> If JOBZ = 'V', then if INFO = 0, the first M elements of
! 229: *> IFAIL are zero. If INFO > 0, then IFAIL contains the
! 230: *> indices of the eigenvectors that failed to converge.
! 231: *> If JOBZ = 'N', then IFAIL is not referenced.
! 232: *> \endverbatim
! 233: *>
! 234: *> \param[out] INFO
! 235: *> \verbatim
! 236: *> INFO is INTEGER
! 237: *> = 0: successful exit
! 238: *> < 0: if INFO = -i, the i-th argument had an illegal value
! 239: *> > 0: ZPPTRF or ZHPEVX returned an error code:
! 240: *> <= N: if INFO = i, ZHPEVX failed to converge;
! 241: *> i eigenvectors failed to converge. Their indices
! 242: *> are stored in array IFAIL.
! 243: *> > N: if INFO = N + i, for 1 <= i <= n, then the leading
! 244: *> minor of order i of B is not positive definite.
! 245: *> The factorization of B could not be completed and
! 246: *> no eigenvalues or eigenvectors were computed.
! 247: *> \endverbatim
! 248: *
! 249: * Authors:
! 250: * ========
! 251: *
! 252: *> \author Univ. of Tennessee
! 253: *> \author Univ. of California Berkeley
! 254: *> \author Univ. of Colorado Denver
! 255: *> \author NAG Ltd.
! 256: *
! 257: *> \date November 2011
! 258: *
! 259: *> \ingroup complex16OTHEReigen
! 260: *
! 261: *> \par Contributors:
! 262: * ==================
! 263: *>
! 264: *> Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
! 265: *
! 266: * =====================================================================
1.1 bertrand 267: SUBROUTINE ZHPGVX( ITYPE, JOBZ, RANGE, UPLO, N, AP, BP, VL, VU,
268: $ IL, IU, ABSTOL, M, W, Z, LDZ, WORK, RWORK,
269: $ IWORK, IFAIL, INFO )
270: *
1.9 ! bertrand 271: * -- LAPACK driver routine (version 3.4.0) --
1.1 bertrand 272: * -- LAPACK is a software package provided by Univ. of Tennessee, --
273: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.9 ! bertrand 274: * November 2011
1.1 bertrand 275: *
276: * .. Scalar Arguments ..
277: CHARACTER JOBZ, RANGE, UPLO
278: INTEGER IL, INFO, ITYPE, IU, LDZ, M, N
279: DOUBLE PRECISION ABSTOL, VL, VU
280: * ..
281: * .. Array Arguments ..
282: INTEGER IFAIL( * ), IWORK( * )
283: DOUBLE PRECISION RWORK( * ), W( * )
284: COMPLEX*16 AP( * ), BP( * ), WORK( * ), Z( LDZ, * )
285: * ..
286: *
287: * =====================================================================
288: *
289: * .. Local Scalars ..
290: LOGICAL ALLEIG, INDEIG, UPPER, VALEIG, WANTZ
291: CHARACTER TRANS
292: INTEGER J
293: * ..
294: * .. External Functions ..
295: LOGICAL LSAME
296: EXTERNAL LSAME
297: * ..
298: * .. External Subroutines ..
299: EXTERNAL XERBLA, ZHPEVX, ZHPGST, ZPPTRF, ZTPMV, ZTPSV
300: * ..
301: * .. Intrinsic Functions ..
302: INTRINSIC MIN
303: * ..
304: * .. Executable Statements ..
305: *
306: * Test the input parameters.
307: *
308: WANTZ = LSAME( JOBZ, 'V' )
309: UPPER = LSAME( UPLO, 'U' )
310: ALLEIG = LSAME( RANGE, 'A' )
311: VALEIG = LSAME( RANGE, 'V' )
312: INDEIG = LSAME( RANGE, 'I' )
313: *
314: INFO = 0
315: IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
316: INFO = -1
317: ELSE IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
318: INFO = -2
319: ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
320: INFO = -3
321: ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
322: INFO = -4
323: ELSE IF( N.LT.0 ) THEN
324: INFO = -5
325: ELSE
326: IF( VALEIG ) THEN
327: IF( N.GT.0 .AND. VU.LE.VL ) THEN
328: INFO = -9
329: END IF
330: ELSE IF( INDEIG ) THEN
331: IF( IL.LT.1 ) THEN
332: INFO = -10
333: ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
334: INFO = -11
335: END IF
336: END IF
337: END IF
338: IF( INFO.EQ.0 ) THEN
339: IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
340: INFO = -16
341: END IF
342: END IF
343: *
344: IF( INFO.NE.0 ) THEN
345: CALL XERBLA( 'ZHPGVX', -INFO )
346: RETURN
347: END IF
348: *
349: * Quick return if possible
350: *
351: IF( N.EQ.0 )
352: $ RETURN
353: *
354: * Form a Cholesky factorization of B.
355: *
356: CALL ZPPTRF( UPLO, N, BP, INFO )
357: IF( INFO.NE.0 ) THEN
358: INFO = N + INFO
359: RETURN
360: END IF
361: *
362: * Transform problem to standard eigenvalue problem and solve.
363: *
364: CALL ZHPGST( ITYPE, UPLO, N, AP, BP, INFO )
365: CALL ZHPEVX( JOBZ, RANGE, UPLO, N, AP, VL, VU, IL, IU, ABSTOL, M,
366: $ W, Z, LDZ, WORK, RWORK, IWORK, IFAIL, INFO )
367: *
368: IF( WANTZ ) THEN
369: *
370: * Backtransform eigenvectors to the original problem.
371: *
372: IF( INFO.GT.0 )
373: $ M = INFO - 1
374: IF( ITYPE.EQ.1 .OR. ITYPE.EQ.2 ) THEN
375: *
376: * For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
1.8 bertrand 377: * backtransform eigenvectors: x = inv(L)**H *y or inv(U)*y
1.1 bertrand 378: *
379: IF( UPPER ) THEN
380: TRANS = 'N'
381: ELSE
382: TRANS = 'C'
383: END IF
384: *
385: DO 10 J = 1, M
386: CALL ZTPSV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
387: $ 1 )
388: 10 CONTINUE
389: *
390: ELSE IF( ITYPE.EQ.3 ) THEN
391: *
392: * For B*A*x=(lambda)*x;
1.8 bertrand 393: * backtransform eigenvectors: x = L*y or U**H *y
1.1 bertrand 394: *
395: IF( UPPER ) THEN
396: TRANS = 'C'
397: ELSE
398: TRANS = 'N'
399: END IF
400: *
401: DO 20 J = 1, M
402: CALL ZTPMV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
403: $ 1 )
404: 20 CONTINUE
405: END IF
406: END IF
407: *
408: RETURN
409: *
410: * End of ZHPGVX
411: *
412: END
CVSweb interface <joel.bertrand@systella.fr>