Annotation of rpl/lapack/lapack/dspgvx.f, revision 1.12

1.9       bertrand    1: *> \brief \b DSPGST
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
                      5: * Online html documentation available at 
                      6: *            http://www.netlib.org/lapack/explore-html/ 
                      7: *
                      8: *> \htmlonly
                      9: *> Download DSPGVX + dependencies 
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dspgvx.f"> 
                     11: *> [TGZ]</a> 
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dspgvx.f"> 
                     13: *> [ZIP]</a> 
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dspgvx.f"> 
                     15: *> [TXT]</a>
                     16: *> \endhtmlonly 
                     17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE DSPGVX( ITYPE, JOBZ, RANGE, UPLO, N, AP, BP, VL, VU,
                     22: *                          IL, IU, ABSTOL, M, W, Z, LDZ, WORK, IWORK,
                     23: *                          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   AP( * ), BP( * ), W( * ), WORK( * ),
                     33: *      $                   Z( LDZ, * )
                     34: *       ..
                     35: *  
                     36: *
                     37: *> \par Purpose:
                     38: *  =============
                     39: *>
                     40: *> \verbatim
                     41: *>
                     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.
                     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 triangle of A and B are stored;
                     83: *>          = 'L':  Lower triangle of A and B are stored.
                     84: *> \endverbatim
                     85: *>
                     86: *> \param[in] N
                     87: *> \verbatim
                     88: *>          N is INTEGER
                     89: *>          The order of the matrix pencil (A,B).  N >= 0.
                     90: *> \endverbatim
                     91: *>
                     92: *> \param[in,out] AP
                     93: *> \verbatim
                     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.
                    100: *>
                    101: *>          On exit, the contents of AP are destroyed.
                    102: *> \endverbatim
                    103: *>
                    104: *> \param[in,out] BP
                    105: *> \verbatim
                    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.
                    112: *>
                    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
                    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 A 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 DOUBLE PRECISION array, dimension (LDZ, max(1,M))
                    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**T*B*Z = I;
                    193: *>          if ITYPE = 3, Z**T*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 DOUBLE PRECISION array, dimension (8*N)
                    213: *> \endverbatim
                    214: *>
                    215: *> \param[out] IWORK
                    216: *> \verbatim
                    217: *>          IWORK is INTEGER array, dimension (5*N)
                    218: *> \endverbatim
                    219: *>
                    220: *> \param[out] IFAIL
                    221: *> \verbatim
                    222: *>          IFAIL is INTEGER array, dimension (N)
                    223: *>          If JOBZ = 'V', then if INFO = 0, the first M elements of
                    224: *>          IFAIL are zero.  If INFO > 0, then IFAIL contains the
                    225: *>          indices of the eigenvectors that failed to converge.
                    226: *>          If JOBZ = 'N', then IFAIL is not referenced.
                    227: *> \endverbatim
                    228: *>
                    229: *> \param[out] INFO
                    230: *> \verbatim
                    231: *>          INFO is INTEGER
                    232: *>          = 0:  successful exit
                    233: *>          < 0:  if INFO = -i, the i-th argument had an illegal value
                    234: *>          > 0:  DPPTRF or DSPEVX returned an error code:
                    235: *>             <= N:  if INFO = i, DSPEVX failed to converge;
                    236: *>                    i eigenvectors failed to converge.  Their indices
                    237: *>                    are stored in array IFAIL.
                    238: *>             > N:   if INFO = N + i, for 1 <= i <= N, then the leading
                    239: *>                    minor of order i of B is not positive definite.
                    240: *>                    The factorization of B could not be completed and
                    241: *>                    no eigenvalues or eigenvectors were computed.
                    242: *> \endverbatim
                    243: *
                    244: *  Authors:
                    245: *  ========
                    246: *
                    247: *> \author Univ. of Tennessee 
                    248: *> \author Univ. of California Berkeley 
                    249: *> \author Univ. of Colorado Denver 
                    250: *> \author NAG Ltd. 
                    251: *
                    252: *> \date November 2011
                    253: *
                    254: *> \ingroup doubleOTHEReigen
                    255: *
                    256: *> \par Contributors:
                    257: *  ==================
                    258: *>
                    259: *>     Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
                    260: *
                    261: *  =====================================================================
1.1       bertrand  262:       SUBROUTINE DSPGVX( ITYPE, JOBZ, RANGE, UPLO, N, AP, BP, VL, VU,
                    263:      $                   IL, IU, ABSTOL, M, W, Z, LDZ, WORK, IWORK,
                    264:      $                   IFAIL, INFO )
                    265: *
1.9       bertrand  266: *  -- LAPACK driver routine (version 3.4.0) --
1.1       bertrand  267: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    268: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.9       bertrand  269: *     November 2011
1.1       bertrand  270: *
                    271: *     .. Scalar Arguments ..
                    272:       CHARACTER          JOBZ, RANGE, UPLO
                    273:       INTEGER            IL, INFO, ITYPE, IU, LDZ, M, N
                    274:       DOUBLE PRECISION   ABSTOL, VL, VU
                    275: *     ..
                    276: *     .. Array Arguments ..
                    277:       INTEGER            IFAIL( * ), IWORK( * )
                    278:       DOUBLE PRECISION   AP( * ), BP( * ), W( * ), WORK( * ),
                    279:      $                   Z( LDZ, * )
                    280: *     ..
                    281: *
                    282: * =====================================================================
                    283: *
                    284: *     .. Local Scalars ..
                    285:       LOGICAL            ALLEIG, INDEIG, UPPER, VALEIG, WANTZ
                    286:       CHARACTER          TRANS
                    287:       INTEGER            J
                    288: *     ..
                    289: *     .. External Functions ..
                    290:       LOGICAL            LSAME
                    291:       EXTERNAL           LSAME
                    292: *     ..
                    293: *     .. External Subroutines ..
                    294:       EXTERNAL           DPPTRF, DSPEVX, DSPGST, DTPMV, DTPSV, XERBLA
                    295: *     ..
                    296: *     .. Intrinsic Functions ..
                    297:       INTRINSIC          MIN
                    298: *     ..
                    299: *     .. Executable Statements ..
                    300: *
                    301: *     Test the input parameters.
                    302: *
                    303:       UPPER = LSAME( UPLO, 'U' )
                    304:       WANTZ = LSAME( JOBZ, 'V' )
                    305:       ALLEIG = LSAME( RANGE, 'A' )
                    306:       VALEIG = LSAME( RANGE, 'V' )
                    307:       INDEIG = LSAME( RANGE, 'I' )
                    308: *
                    309:       INFO = 0
                    310:       IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
                    311:          INFO = -1
                    312:       ELSE IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
                    313:          INFO = -2
                    314:       ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
                    315:          INFO = -3
                    316:       ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
                    317:          INFO = -4
                    318:       ELSE IF( N.LT.0 ) THEN
                    319:          INFO = -5
                    320:       ELSE
                    321:          IF( VALEIG ) THEN
                    322:             IF( N.GT.0 .AND. VU.LE.VL ) THEN
                    323:                INFO = -9
                    324:             END IF
                    325:          ELSE IF( INDEIG ) THEN
                    326:             IF( IL.LT.1 ) THEN
                    327:                INFO = -10
                    328:             ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
                    329:                INFO = -11
                    330:             END IF
                    331:          END IF
                    332:       END IF
                    333:       IF( INFO.EQ.0 ) THEN
                    334:          IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
                    335:             INFO = -16
                    336:          END IF
                    337:       END IF
                    338: *
                    339:       IF( INFO.NE.0 ) THEN
                    340:          CALL XERBLA( 'DSPGVX', -INFO )
                    341:          RETURN
                    342:       END IF
                    343: *
                    344: *     Quick return if possible
                    345: *
                    346:       M = 0
                    347:       IF( N.EQ.0 )
                    348:      $   RETURN
                    349: *
                    350: *     Form a Cholesky factorization of B.
                    351: *
                    352:       CALL DPPTRF( UPLO, N, BP, INFO )
                    353:       IF( INFO.NE.0 ) THEN
                    354:          INFO = N + INFO
                    355:          RETURN
                    356:       END IF
                    357: *
                    358: *     Transform problem to standard eigenvalue problem and solve.
                    359: *
                    360:       CALL DSPGST( ITYPE, UPLO, N, AP, BP, INFO )
                    361:       CALL DSPEVX( JOBZ, RANGE, UPLO, N, AP, VL, VU, IL, IU, ABSTOL, M,
                    362:      $             W, Z, LDZ, WORK, IWORK, IFAIL, INFO )
                    363: *
                    364:       IF( WANTZ ) THEN
                    365: *
                    366: *        Backtransform eigenvectors to the original problem.
                    367: *
                    368:          IF( INFO.GT.0 )
                    369:      $      M = INFO - 1
                    370:          IF( ITYPE.EQ.1 .OR. ITYPE.EQ.2 ) THEN
                    371: *
                    372: *           For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
1.8       bertrand  373: *           backtransform eigenvectors: x = inv(L)**T*y or inv(U)*y
1.1       bertrand  374: *
                    375:             IF( UPPER ) THEN
                    376:                TRANS = 'N'
                    377:             ELSE
                    378:                TRANS = 'T'
                    379:             END IF
                    380: *
                    381:             DO 10 J = 1, M
                    382:                CALL DTPSV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
                    383:      $                     1 )
                    384:    10       CONTINUE
                    385: *
                    386:          ELSE IF( ITYPE.EQ.3 ) THEN
                    387: *
                    388: *           For B*A*x=(lambda)*x;
1.8       bertrand  389: *           backtransform eigenvectors: x = L*y or U**T*y
1.1       bertrand  390: *
                    391:             IF( UPPER ) THEN
                    392:                TRANS = 'T'
                    393:             ELSE
                    394:                TRANS = 'N'
                    395:             END IF
                    396: *
                    397:             DO 20 J = 1, M
                    398:                CALL DTPMV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
                    399:      $                     1 )
                    400:    20       CONTINUE
                    401:          END IF
                    402:       END IF
                    403: *
                    404:       RETURN
                    405: *
                    406: *     End of DSPGVX
                    407: *
                    408:       END

CVSweb interface <joel.bertrand@systella.fr>