Annotation of rpl/lapack/lapack/dsbgvx.f, revision 1.1
1.1 ! bertrand 1: SUBROUTINE DSBGVX( JOBZ, RANGE, UPLO, N, KA, KB, AB, LDAB, BB,
! 2: $ LDBB, Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W, Z,
! 3: $ LDZ, WORK, IWORK, IFAIL, INFO )
! 4: *
! 5: * -- LAPACK driver routine (version 3.2) --
! 6: * -- LAPACK is a software package provided by Univ. of Tennessee, --
! 7: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
! 8: * November 2006
! 9: *
! 10: * .. Scalar Arguments ..
! 11: CHARACTER JOBZ, RANGE, UPLO
! 12: INTEGER IL, INFO, IU, KA, KB, LDAB, LDBB, LDQ, LDZ, M,
! 13: $ N
! 14: DOUBLE PRECISION ABSTOL, VL, VU
! 15: * ..
! 16: * .. Array Arguments ..
! 17: INTEGER IFAIL( * ), IWORK( * )
! 18: DOUBLE PRECISION AB( LDAB, * ), BB( LDBB, * ), Q( LDQ, * ),
! 19: $ W( * ), WORK( * ), Z( LDZ, * )
! 20: * ..
! 21: *
! 22: * Purpose
! 23: * =======
! 24: *
! 25: * DSBGVX computes selected eigenvalues, and optionally, eigenvectors
! 26: * of a real generalized symmetric-definite banded eigenproblem, of
! 27: * the form A*x=(lambda)*B*x. Here A and B are assumed to be symmetric
! 28: * and banded, and B is also positive definite. Eigenvalues and
! 29: * eigenvectors can be selected by specifying either all eigenvalues,
! 30: * a range of values or a range of indices for the desired eigenvalues.
! 31: *
! 32: * Arguments
! 33: * =========
! 34: *
! 35: * JOBZ (input) CHARACTER*1
! 36: * = 'N': Compute eigenvalues only;
! 37: * = 'V': Compute eigenvalues and eigenvectors.
! 38: *
! 39: * RANGE (input) CHARACTER*1
! 40: * = 'A': all eigenvalues will be found.
! 41: * = 'V': all eigenvalues in the half-open interval (VL,VU]
! 42: * will be found.
! 43: * = 'I': the IL-th through IU-th eigenvalues will be found.
! 44: *
! 45: * UPLO (input) CHARACTER*1
! 46: * = 'U': Upper triangles of A and B are stored;
! 47: * = 'L': Lower triangles of A and B are stored.
! 48: *
! 49: * N (input) INTEGER
! 50: * The order of the matrices A and B. N >= 0.
! 51: *
! 52: * KA (input) INTEGER
! 53: * The number of superdiagonals of the matrix A if UPLO = 'U',
! 54: * or the number of subdiagonals if UPLO = 'L'. KA >= 0.
! 55: *
! 56: * KB (input) INTEGER
! 57: * The number of superdiagonals of the matrix B if UPLO = 'U',
! 58: * or the number of subdiagonals if UPLO = 'L'. KB >= 0.
! 59: *
! 60: * AB (input/output) DOUBLE PRECISION array, dimension (LDAB, N)
! 61: * On entry, the upper or lower triangle of the symmetric band
! 62: * matrix A, stored in the first ka+1 rows of the array. The
! 63: * j-th column of A is stored in the j-th column of the array AB
! 64: * as follows:
! 65: * if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j;
! 66: * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+ka).
! 67: *
! 68: * On exit, the contents of AB are destroyed.
! 69: *
! 70: * LDAB (input) INTEGER
! 71: * The leading dimension of the array AB. LDAB >= KA+1.
! 72: *
! 73: * BB (input/output) DOUBLE PRECISION array, dimension (LDBB, N)
! 74: * On entry, the upper or lower triangle of the symmetric band
! 75: * matrix B, stored in the first kb+1 rows of the array. The
! 76: * j-th column of B is stored in the j-th column of the array BB
! 77: * as follows:
! 78: * if UPLO = 'U', BB(ka+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j;
! 79: * if UPLO = 'L', BB(1+i-j,j) = B(i,j) for j<=i<=min(n,j+kb).
! 80: *
! 81: * On exit, the factor S from the split Cholesky factorization
! 82: * B = S**T*S, as returned by DPBSTF.
! 83: *
! 84: * LDBB (input) INTEGER
! 85: * The leading dimension of the array BB. LDBB >= KB+1.
! 86: *
! 87: * Q (output) DOUBLE PRECISION array, dimension (LDQ, N)
! 88: * If JOBZ = 'V', the n-by-n matrix used in the reduction of
! 89: * A*x = (lambda)*B*x to standard form, i.e. C*x = (lambda)*x,
! 90: * and consequently C to tridiagonal form.
! 91: * If JOBZ = 'N', the array Q is not referenced.
! 92: *
! 93: * LDQ (input) INTEGER
! 94: * The leading dimension of the array Q. If JOBZ = 'N',
! 95: * LDQ >= 1. If JOBZ = 'V', LDQ >= max(1,N).
! 96: *
! 97: * VL (input) DOUBLE PRECISION
! 98: * VU (input) DOUBLE PRECISION
! 99: * If RANGE='V', the lower and upper bounds of the interval to
! 100: * be searched for eigenvalues. VL < VU.
! 101: * Not referenced if RANGE = 'A' or 'I'.
! 102: *
! 103: * IL (input) INTEGER
! 104: * IU (input) INTEGER
! 105: * If RANGE='I', the indices (in ascending order) of the
! 106: * smallest and largest eigenvalues to be returned.
! 107: * 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
! 108: * Not referenced if RANGE = 'A' or 'V'.
! 109: *
! 110: * ABSTOL (input) DOUBLE PRECISION
! 111: * The absolute error tolerance for the eigenvalues.
! 112: * An approximate eigenvalue is accepted as converged
! 113: * when it is determined to lie in an interval [a,b]
! 114: * of width less than or equal to
! 115: *
! 116: * ABSTOL + EPS * max( |a|,|b| ) ,
! 117: *
! 118: * where EPS is the machine precision. If ABSTOL is less than
! 119: * or equal to zero, then EPS*|T| will be used in its place,
! 120: * where |T| is the 1-norm of the tridiagonal matrix obtained
! 121: * by reducing A to tridiagonal form.
! 122: *
! 123: * Eigenvalues will be computed most accurately when ABSTOL is
! 124: * set to twice the underflow threshold 2*DLAMCH('S'), not zero.
! 125: * If this routine returns with INFO>0, indicating that some
! 126: * eigenvectors did not converge, try setting ABSTOL to
! 127: * 2*DLAMCH('S').
! 128: *
! 129: * M (output) INTEGER
! 130: * The total number of eigenvalues found. 0 <= M <= N.
! 131: * If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
! 132: *
! 133: * W (output) DOUBLE PRECISION array, dimension (N)
! 134: * If INFO = 0, the eigenvalues in ascending order.
! 135: *
! 136: * Z (output) DOUBLE PRECISION array, dimension (LDZ, N)
! 137: * If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
! 138: * eigenvectors, with the i-th column of Z holding the
! 139: * eigenvector associated with W(i). The eigenvectors are
! 140: * normalized so Z**T*B*Z = I.
! 141: * If JOBZ = 'N', then Z is not referenced.
! 142: *
! 143: * LDZ (input) INTEGER
! 144: * The leading dimension of the array Z. LDZ >= 1, and if
! 145: * JOBZ = 'V', LDZ >= max(1,N).
! 146: *
! 147: * WORK (workspace/output) DOUBLE PRECISION array, dimension (7*N)
! 148: *
! 149: * IWORK (workspace/output) INTEGER array, dimension (5*N)
! 150: *
! 151: * IFAIL (output) INTEGER array, dimension (M)
! 152: * If JOBZ = 'V', then if INFO = 0, the first M elements of
! 153: * IFAIL are zero. If INFO > 0, then IFAIL contains the
! 154: * indices of the eigenvalues that failed to converge.
! 155: * If JOBZ = 'N', then IFAIL is not referenced.
! 156: *
! 157: * INFO (output) INTEGER
! 158: * = 0 : successful exit
! 159: * < 0 : if INFO = -i, the i-th argument had an illegal value
! 160: * <= N: if INFO = i, then i eigenvectors failed to converge.
! 161: * Their indices are stored in IFAIL.
! 162: * > N : DPBSTF returned an error code; i.e.,
! 163: * if INFO = N + i, for 1 <= i <= N, then the leading
! 164: * minor of order i of B is not positive definite.
! 165: * The factorization of B could not be completed and
! 166: * no eigenvalues or eigenvectors were computed.
! 167: *
! 168: * Further Details
! 169: * ===============
! 170: *
! 171: * Based on contributions by
! 172: * Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
! 173: *
! 174: * =====================================================================
! 175: *
! 176: * .. Parameters ..
! 177: DOUBLE PRECISION ZERO, ONE
! 178: PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
! 179: * ..
! 180: * .. Local Scalars ..
! 181: LOGICAL ALLEIG, INDEIG, TEST, UPPER, VALEIG, WANTZ
! 182: CHARACTER ORDER, VECT
! 183: INTEGER I, IINFO, INDD, INDE, INDEE, INDIBL, INDISP,
! 184: $ INDIWO, INDWRK, ITMP1, J, JJ, NSPLIT
! 185: DOUBLE PRECISION TMP1
! 186: * ..
! 187: * .. External Functions ..
! 188: LOGICAL LSAME
! 189: EXTERNAL LSAME
! 190: * ..
! 191: * .. External Subroutines ..
! 192: EXTERNAL DCOPY, DGEMV, DLACPY, DPBSTF, DSBGST, DSBTRD,
! 193: $ DSTEBZ, DSTEIN, DSTEQR, DSTERF, DSWAP, XERBLA
! 194: * ..
! 195: * .. Intrinsic Functions ..
! 196: INTRINSIC MIN
! 197: * ..
! 198: * .. Executable Statements ..
! 199: *
! 200: * Test the input parameters.
! 201: *
! 202: WANTZ = LSAME( JOBZ, 'V' )
! 203: UPPER = LSAME( UPLO, 'U' )
! 204: ALLEIG = LSAME( RANGE, 'A' )
! 205: VALEIG = LSAME( RANGE, 'V' )
! 206: INDEIG = LSAME( RANGE, 'I' )
! 207: *
! 208: INFO = 0
! 209: IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
! 210: INFO = -1
! 211: ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
! 212: INFO = -2
! 213: ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
! 214: INFO = -3
! 215: ELSE IF( N.LT.0 ) THEN
! 216: INFO = -4
! 217: ELSE IF( KA.LT.0 ) THEN
! 218: INFO = -5
! 219: ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
! 220: INFO = -6
! 221: ELSE IF( LDAB.LT.KA+1 ) THEN
! 222: INFO = -8
! 223: ELSE IF( LDBB.LT.KB+1 ) THEN
! 224: INFO = -10
! 225: ELSE IF( LDQ.LT.1 .OR. ( WANTZ .AND. LDQ.LT.N ) ) THEN
! 226: INFO = -12
! 227: ELSE
! 228: IF( VALEIG ) THEN
! 229: IF( N.GT.0 .AND. VU.LE.VL )
! 230: $ INFO = -14
! 231: ELSE IF( INDEIG ) THEN
! 232: IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
! 233: INFO = -15
! 234: ELSE IF ( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
! 235: INFO = -16
! 236: END IF
! 237: END IF
! 238: END IF
! 239: IF( INFO.EQ.0) THEN
! 240: IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
! 241: INFO = -21
! 242: END IF
! 243: END IF
! 244: *
! 245: IF( INFO.NE.0 ) THEN
! 246: CALL XERBLA( 'DSBGVX', -INFO )
! 247: RETURN
! 248: END IF
! 249: *
! 250: * Quick return if possible
! 251: *
! 252: M = 0
! 253: IF( N.EQ.0 )
! 254: $ RETURN
! 255: *
! 256: * Form a split Cholesky factorization of B.
! 257: *
! 258: CALL DPBSTF( UPLO, N, KB, BB, LDBB, INFO )
! 259: IF( INFO.NE.0 ) THEN
! 260: INFO = N + INFO
! 261: RETURN
! 262: END IF
! 263: *
! 264: * Transform problem to standard eigenvalue problem.
! 265: *
! 266: CALL DSBGST( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Q, LDQ,
! 267: $ WORK, IINFO )
! 268: *
! 269: * Reduce symmetric band matrix to tridiagonal form.
! 270: *
! 271: INDD = 1
! 272: INDE = INDD + N
! 273: INDWRK = INDE + N
! 274: IF( WANTZ ) THEN
! 275: VECT = 'U'
! 276: ELSE
! 277: VECT = 'N'
! 278: END IF
! 279: CALL DSBTRD( VECT, UPLO, N, KA, AB, LDAB, WORK( INDD ),
! 280: $ WORK( INDE ), Q, LDQ, WORK( INDWRK ), IINFO )
! 281: *
! 282: * If all eigenvalues are desired and ABSTOL is less than or equal
! 283: * to zero, then call DSTERF or SSTEQR. If this fails for some
! 284: * eigenvalue, then try DSTEBZ.
! 285: *
! 286: TEST = .FALSE.
! 287: IF( INDEIG ) THEN
! 288: IF( IL.EQ.1 .AND. IU.EQ.N ) THEN
! 289: TEST = .TRUE.
! 290: END IF
! 291: END IF
! 292: IF( ( ALLEIG .OR. TEST ) .AND. ( ABSTOL.LE.ZERO ) ) THEN
! 293: CALL DCOPY( N, WORK( INDD ), 1, W, 1 )
! 294: INDEE = INDWRK + 2*N
! 295: CALL DCOPY( N-1, WORK( INDE ), 1, WORK( INDEE ), 1 )
! 296: IF( .NOT.WANTZ ) THEN
! 297: CALL DSTERF( N, W, WORK( INDEE ), INFO )
! 298: ELSE
! 299: CALL DLACPY( 'A', N, N, Q, LDQ, Z, LDZ )
! 300: CALL DSTEQR( JOBZ, N, W, WORK( INDEE ), Z, LDZ,
! 301: $ WORK( INDWRK ), INFO )
! 302: IF( INFO.EQ.0 ) THEN
! 303: DO 10 I = 1, N
! 304: IFAIL( I ) = 0
! 305: 10 CONTINUE
! 306: END IF
! 307: END IF
! 308: IF( INFO.EQ.0 ) THEN
! 309: M = N
! 310: GO TO 30
! 311: END IF
! 312: INFO = 0
! 313: END IF
! 314: *
! 315: * Otherwise, call DSTEBZ and, if eigenvectors are desired,
! 316: * call DSTEIN.
! 317: *
! 318: IF( WANTZ ) THEN
! 319: ORDER = 'B'
! 320: ELSE
! 321: ORDER = 'E'
! 322: END IF
! 323: INDIBL = 1
! 324: INDISP = INDIBL + N
! 325: INDIWO = INDISP + N
! 326: CALL DSTEBZ( RANGE, ORDER, N, VL, VU, IL, IU, ABSTOL,
! 327: $ WORK( INDD ), WORK( INDE ), M, NSPLIT, W,
! 328: $ IWORK( INDIBL ), IWORK( INDISP ), WORK( INDWRK ),
! 329: $ IWORK( INDIWO ), INFO )
! 330: *
! 331: IF( WANTZ ) THEN
! 332: CALL DSTEIN( N, WORK( INDD ), WORK( INDE ), M, W,
! 333: $ IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ,
! 334: $ WORK( INDWRK ), IWORK( INDIWO ), IFAIL, INFO )
! 335: *
! 336: * Apply transformation matrix used in reduction to tridiagonal
! 337: * form to eigenvectors returned by DSTEIN.
! 338: *
! 339: DO 20 J = 1, M
! 340: CALL DCOPY( N, Z( 1, J ), 1, WORK( 1 ), 1 )
! 341: CALL DGEMV( 'N', N, N, ONE, Q, LDQ, WORK, 1, ZERO,
! 342: $ Z( 1, J ), 1 )
! 343: 20 CONTINUE
! 344: END IF
! 345: *
! 346: 30 CONTINUE
! 347: *
! 348: * If eigenvalues are not in order, then sort them, along with
! 349: * eigenvectors.
! 350: *
! 351: IF( WANTZ ) THEN
! 352: DO 50 J = 1, M - 1
! 353: I = 0
! 354: TMP1 = W( J )
! 355: DO 40 JJ = J + 1, M
! 356: IF( W( JJ ).LT.TMP1 ) THEN
! 357: I = JJ
! 358: TMP1 = W( JJ )
! 359: END IF
! 360: 40 CONTINUE
! 361: *
! 362: IF( I.NE.0 ) THEN
! 363: ITMP1 = IWORK( INDIBL+I-1 )
! 364: W( I ) = W( J )
! 365: IWORK( INDIBL+I-1 ) = IWORK( INDIBL+J-1 )
! 366: W( J ) = TMP1
! 367: IWORK( INDIBL+J-1 ) = ITMP1
! 368: CALL DSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
! 369: IF( INFO.NE.0 ) THEN
! 370: ITMP1 = IFAIL( I )
! 371: IFAIL( I ) = IFAIL( J )
! 372: IFAIL( J ) = ITMP1
! 373: END IF
! 374: END IF
! 375: 50 CONTINUE
! 376: END IF
! 377: *
! 378: RETURN
! 379: *
! 380: * End of DSBGVX
! 381: *
! 382: END
CVSweb interface <joel.bertrand@systella.fr>