Annotation of rpl/lapack/lapack/dspgv.f, revision 1.7

1.1       bertrand    1:       SUBROUTINE DSPGV( ITYPE, JOBZ, UPLO, N, AP, BP, W, Z, LDZ, WORK,
                      2:      $                  INFO )
                      3: *
                      4: *  -- LAPACK driver routine (version 3.2) --
                      5: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                      6: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
                      7: *     November 2006
                      8: *
                      9: *     .. Scalar Arguments ..
                     10:       CHARACTER          JOBZ, UPLO
                     11:       INTEGER            INFO, ITYPE, LDZ, N
                     12: *     ..
                     13: *     .. Array Arguments ..
                     14:       DOUBLE PRECISION   AP( * ), BP( * ), W( * ), WORK( * ),
                     15:      $                   Z( LDZ, * )
                     16: *     ..
                     17: *
                     18: *  Purpose
                     19: *  =======
                     20: *
                     21: *  DSPGV computes all the eigenvalues and, optionally, the eigenvectors
                     22: *  of a real generalized symmetric-definite eigenproblem, of the form
                     23: *  A*x=(lambda)*B*x,  A*Bx=(lambda)*x,  or B*A*x=(lambda)*x.
                     24: *  Here A and B are assumed to be symmetric, stored in packed format,
                     25: *  and B is also positive definite.
                     26: *
                     27: *  Arguments
                     28: *  =========
                     29: *
                     30: *  ITYPE   (input) INTEGER
                     31: *          Specifies the problem type to be solved:
                     32: *          = 1:  A*x = (lambda)*B*x
                     33: *          = 2:  A*B*x = (lambda)*x
                     34: *          = 3:  B*A*x = (lambda)*x
                     35: *
                     36: *  JOBZ    (input) CHARACTER*1
                     37: *          = 'N':  Compute eigenvalues only;
                     38: *          = 'V':  Compute eigenvalues and eigenvectors.
                     39: *
                     40: *  UPLO    (input) CHARACTER*1
                     41: *          = 'U':  Upper triangles of A and B are stored;
                     42: *          = 'L':  Lower triangles of A and B are stored.
                     43: *
                     44: *  N       (input) INTEGER
                     45: *          The order of the matrices A and B.  N >= 0.
                     46: *
                     47: *  AP      (input/output) DOUBLE PRECISION array, dimension
                     48: *                            (N*(N+1)/2)
                     49: *          On entry, the upper or lower triangle of the symmetric matrix
                     50: *          A, packed columnwise in a linear array.  The j-th column of A
                     51: *          is stored in the array AP as follows:
                     52: *          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
                     53: *          if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
                     54: *
                     55: *          On exit, the contents of AP are destroyed.
                     56: *
                     57: *  BP      (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2)
                     58: *          On entry, the upper or lower triangle of the symmetric matrix
                     59: *          B, packed columnwise in a linear array.  The j-th column of B
                     60: *          is stored in the array BP as follows:
                     61: *          if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j;
                     62: *          if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n.
                     63: *
                     64: *          On exit, the triangular factor U or L from the Cholesky
                     65: *          factorization B = U**T*U or B = L*L**T, in the same storage
                     66: *          format as B.
                     67: *
                     68: *  W       (output) DOUBLE PRECISION array, dimension (N)
                     69: *          If INFO = 0, the eigenvalues in ascending order.
                     70: *
                     71: *  Z       (output) DOUBLE PRECISION array, dimension (LDZ, N)
                     72: *          If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
                     73: *          eigenvectors.  The eigenvectors are normalized as follows:
                     74: *          if ITYPE = 1 or 2, Z**T*B*Z = I;
                     75: *          if ITYPE = 3, Z**T*inv(B)*Z = I.
                     76: *          If JOBZ = 'N', then Z is not referenced.
                     77: *
                     78: *  LDZ     (input) INTEGER
                     79: *          The leading dimension of the array Z.  LDZ >= 1, and if
                     80: *          JOBZ = 'V', LDZ >= max(1,N).
                     81: *
                     82: *  WORK    (workspace) DOUBLE PRECISION array, dimension (3*N)
                     83: *
                     84: *  INFO    (output) INTEGER
                     85: *          = 0:  successful exit
                     86: *          < 0:  if INFO = -i, the i-th argument had an illegal value
                     87: *          > 0:  DPPTRF or DSPEV returned an error code:
                     88: *             <= N:  if INFO = i, DSPEV failed to converge;
                     89: *                    i off-diagonal elements of an intermediate
                     90: *                    tridiagonal form did not converge to zero.
                     91: *             > N:   if INFO = n + i, for 1 <= i <= n, then the leading
                     92: *                    minor of order i of B is not positive definite.
                     93: *                    The factorization of B could not be completed and
                     94: *                    no eigenvalues or eigenvectors were computed.
                     95: *
                     96: *  =====================================================================
                     97: *
                     98: *     .. Local Scalars ..
                     99:       LOGICAL            UPPER, WANTZ
                    100:       CHARACTER          TRANS
                    101:       INTEGER            J, NEIG
                    102: *     ..
                    103: *     .. External Functions ..
                    104:       LOGICAL            LSAME
                    105:       EXTERNAL           LSAME
                    106: *     ..
                    107: *     .. External Subroutines ..
                    108:       EXTERNAL           DPPTRF, DSPEV, DSPGST, DTPMV, DTPSV, XERBLA
                    109: *     ..
                    110: *     .. Executable Statements ..
                    111: *
                    112: *     Test the input parameters.
                    113: *
                    114:       WANTZ = LSAME( JOBZ, 'V' )
                    115:       UPPER = LSAME( UPLO, 'U' )
                    116: *
                    117:       INFO = 0
                    118:       IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
                    119:          INFO = -1
                    120:       ELSE IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
                    121:          INFO = -2
                    122:       ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
                    123:          INFO = -3
                    124:       ELSE IF( N.LT.0 ) THEN
                    125:          INFO = -4
                    126:       ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
                    127:          INFO = -9
                    128:       END IF
                    129:       IF( INFO.NE.0 ) THEN
                    130:          CALL XERBLA( 'DSPGV ', -INFO )
                    131:          RETURN
                    132:       END IF
                    133: *
                    134: *     Quick return if possible
                    135: *
                    136:       IF( N.EQ.0 )
                    137:      $   RETURN
                    138: *
                    139: *     Form a Cholesky factorization of B.
                    140: *
                    141:       CALL DPPTRF( UPLO, N, BP, INFO )
                    142:       IF( INFO.NE.0 ) THEN
                    143:          INFO = N + INFO
                    144:          RETURN
                    145:       END IF
                    146: *
                    147: *     Transform problem to standard eigenvalue problem and solve.
                    148: *
                    149:       CALL DSPGST( ITYPE, UPLO, N, AP, BP, INFO )
                    150:       CALL DSPEV( JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, INFO )
                    151: *
                    152:       IF( WANTZ ) THEN
                    153: *
                    154: *        Backtransform eigenvectors to the original problem.
                    155: *
                    156:          NEIG = N
                    157:          IF( INFO.GT.0 )
                    158:      $      NEIG = INFO - 1
                    159:          IF( ITYPE.EQ.1 .OR. ITYPE.EQ.2 ) THEN
                    160: *
                    161: *           For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
                    162: *           backtransform eigenvectors: x = inv(L)'*y or inv(U)*y
                    163: *
                    164:             IF( UPPER ) THEN
                    165:                TRANS = 'N'
                    166:             ELSE
                    167:                TRANS = 'T'
                    168:             END IF
                    169: *
                    170:             DO 10 J = 1, NEIG
                    171:                CALL DTPSV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
                    172:      $                     1 )
                    173:    10       CONTINUE
                    174: *
                    175:          ELSE IF( ITYPE.EQ.3 ) THEN
                    176: *
                    177: *           For B*A*x=(lambda)*x;
                    178: *           backtransform eigenvectors: x = L*y or U'*y
                    179: *
                    180:             IF( UPPER ) THEN
                    181:                TRANS = 'T'
                    182:             ELSE
                    183:                TRANS = 'N'
                    184:             END IF
                    185: *
                    186:             DO 20 J = 1, NEIG
                    187:                CALL DTPMV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
                    188:      $                     1 )
                    189:    20       CONTINUE
                    190:          END IF
                    191:       END IF
                    192:       RETURN
                    193: *
                    194: *     End of DSPGV
                    195: *
                    196:       END

CVSweb interface <joel.bertrand@systella.fr>