LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
chpgv.f
Go to the documentation of this file.
00001 *> \brief \b CHPGST
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download CHPGV + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/chpgv.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/chpgv.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/chpgv.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE CHPGV( ITYPE, JOBZ, UPLO, N, AP, BP, W, Z, LDZ, WORK,
00022 *                         RWORK, INFO )
00023 * 
00024 *       .. Scalar Arguments ..
00025 *       CHARACTER          JOBZ, UPLO
00026 *       INTEGER            INFO, ITYPE, LDZ, N
00027 *       ..
00028 *       .. Array Arguments ..
00029 *       REAL               RWORK( * ), W( * )
00030 *       COMPLEX            AP( * ), BP( * ), WORK( * ), Z( LDZ, * )
00031 *       ..
00032 *  
00033 *
00034 *> \par Purpose:
00035 *  =============
00036 *>
00037 *> \verbatim
00038 *>
00039 *> CHPGV computes all the eigenvalues and, optionally, the eigenvectors
00040 *> of a complex generalized Hermitian-definite eigenproblem, of the form
00041 *> A*x=(lambda)*B*x,  A*Bx=(lambda)*x,  or B*A*x=(lambda)*x.
00042 *> Here A and B are assumed to be Hermitian, stored in packed format,
00043 *> and B is also positive definite.
00044 *> \endverbatim
00045 *
00046 *  Arguments:
00047 *  ==========
00048 *
00049 *> \param[in] ITYPE
00050 *> \verbatim
00051 *>          ITYPE is INTEGER
00052 *>          Specifies the problem type to be solved:
00053 *>          = 1:  A*x = (lambda)*B*x
00054 *>          = 2:  A*B*x = (lambda)*x
00055 *>          = 3:  B*A*x = (lambda)*x
00056 *> \endverbatim
00057 *>
00058 *> \param[in] JOBZ
00059 *> \verbatim
00060 *>          JOBZ is CHARACTER*1
00061 *>          = 'N':  Compute eigenvalues only;
00062 *>          = 'V':  Compute eigenvalues and eigenvectors.
00063 *> \endverbatim
00064 *>
00065 *> \param[in] UPLO
00066 *> \verbatim
00067 *>          UPLO is CHARACTER*1
00068 *>          = 'U':  Upper triangles of A and B are stored;
00069 *>          = 'L':  Lower triangles of A and B are stored.
00070 *> \endverbatim
00071 *>
00072 *> \param[in] N
00073 *> \verbatim
00074 *>          N is INTEGER
00075 *>          The order of the matrices A and B.  N >= 0.
00076 *> \endverbatim
00077 *>
00078 *> \param[in,out] AP
00079 *> \verbatim
00080 *>          AP is COMPLEX array, dimension (N*(N+1)/2)
00081 *>          On entry, the upper or lower triangle of the Hermitian matrix
00082 *>          A, packed columnwise in a linear array.  The j-th column of A
00083 *>          is stored in the array AP as follows:
00084 *>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
00085 *>          if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
00086 *>
00087 *>          On exit, the contents of AP are destroyed.
00088 *> \endverbatim
00089 *>
00090 *> \param[in,out] BP
00091 *> \verbatim
00092 *>          BP is COMPLEX array, dimension (N*(N+1)/2)
00093 *>          On entry, the upper or lower triangle of the Hermitian matrix
00094 *>          B, packed columnwise in a linear array.  The j-th column of B
00095 *>          is stored in the array BP as follows:
00096 *>          if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j;
00097 *>          if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n.
00098 *>
00099 *>          On exit, the triangular factor U or L from the Cholesky
00100 *>          factorization B = U**H*U or B = L*L**H, in the same storage
00101 *>          format as B.
00102 *> \endverbatim
00103 *>
00104 *> \param[out] W
00105 *> \verbatim
00106 *>          W is REAL array, dimension (N)
00107 *>          If INFO = 0, the eigenvalues in ascending order.
00108 *> \endverbatim
00109 *>
00110 *> \param[out] Z
00111 *> \verbatim
00112 *>          Z is COMPLEX array, dimension (LDZ, N)
00113 *>          If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
00114 *>          eigenvectors.  The eigenvectors are normalized as follows:
00115 *>          if ITYPE = 1 or 2, Z**H*B*Z = I;
00116 *>          if ITYPE = 3, Z**H*inv(B)*Z = I.
00117 *>          If JOBZ = 'N', then Z is not referenced.
00118 *> \endverbatim
00119 *>
00120 *> \param[in] LDZ
00121 *> \verbatim
00122 *>          LDZ is INTEGER
00123 *>          The leading dimension of the array Z.  LDZ >= 1, and if
00124 *>          JOBZ = 'V', LDZ >= max(1,N).
00125 *> \endverbatim
00126 *>
00127 *> \param[out] WORK
00128 *> \verbatim
00129 *>          WORK is COMPLEX array, dimension (max(1, 2*N-1))
00130 *> \endverbatim
00131 *>
00132 *> \param[out] RWORK
00133 *> \verbatim
00134 *>          RWORK is REAL array, dimension (max(1, 3*N-2))
00135 *> \endverbatim
00136 *>
00137 *> \param[out] INFO
00138 *> \verbatim
00139 *>          INFO is INTEGER
00140 *>          = 0:  successful exit
00141 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00142 *>          > 0:  CPPTRF or CHPEV returned an error code:
00143 *>             <= N:  if INFO = i, CHPEV failed to converge;
00144 *>                    i off-diagonal elements of an intermediate
00145 *>                    tridiagonal form did not convergeto zero;
00146 *>             > N:   if INFO = N + i, for 1 <= i <= n, then the leading
00147 *>                    minor of order i of B is not positive definite.
00148 *>                    The factorization of B could not be completed and
00149 *>                    no eigenvalues or eigenvectors were computed.
00150 *> \endverbatim
00151 *
00152 *  Authors:
00153 *  ========
00154 *
00155 *> \author Univ. of Tennessee 
00156 *> \author Univ. of California Berkeley 
00157 *> \author Univ. of Colorado Denver 
00158 *> \author NAG Ltd. 
00159 *
00160 *> \date November 2011
00161 *
00162 *> \ingroup complexOTHEReigen
00163 *
00164 *  =====================================================================
00165       SUBROUTINE CHPGV( ITYPE, JOBZ, UPLO, N, AP, BP, W, Z, LDZ, WORK,
00166      $                  RWORK, INFO )
00167 *
00168 *  -- LAPACK driver routine (version 3.4.0) --
00169 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00170 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00171 *     November 2011
00172 *
00173 *     .. Scalar Arguments ..
00174       CHARACTER          JOBZ, UPLO
00175       INTEGER            INFO, ITYPE, LDZ, N
00176 *     ..
00177 *     .. Array Arguments ..
00178       REAL               RWORK( * ), W( * )
00179       COMPLEX            AP( * ), BP( * ), WORK( * ), Z( LDZ, * )
00180 *     ..
00181 *
00182 *  =====================================================================
00183 *
00184 *     .. Local Scalars ..
00185       LOGICAL            UPPER, WANTZ
00186       CHARACTER          TRANS
00187       INTEGER            J, NEIG
00188 *     ..
00189 *     .. External Functions ..
00190       LOGICAL            LSAME
00191       EXTERNAL           LSAME
00192 *     ..
00193 *     .. External Subroutines ..
00194       EXTERNAL           CHPEV, CHPGST, CPPTRF, CTPMV, CTPSV, XERBLA
00195 *     ..
00196 *     .. Executable Statements ..
00197 *
00198 *     Test the input parameters.
00199 *
00200       WANTZ = LSAME( JOBZ, 'V' )
00201       UPPER = LSAME( UPLO, 'U' )
00202 *
00203       INFO = 0
00204       IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
00205          INFO = -1
00206       ELSE IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
00207          INFO = -2
00208       ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
00209          INFO = -3
00210       ELSE IF( N.LT.0 ) THEN
00211          INFO = -4
00212       ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
00213          INFO = -9
00214       END IF
00215       IF( INFO.NE.0 ) THEN
00216          CALL XERBLA( 'CHPGV ', -INFO )
00217          RETURN
00218       END IF
00219 *
00220 *     Quick return if possible
00221 *
00222       IF( N.EQ.0 )
00223      $   RETURN
00224 *
00225 *     Form a Cholesky factorization of B.
00226 *
00227       CALL CPPTRF( UPLO, N, BP, INFO )
00228       IF( INFO.NE.0 ) THEN
00229          INFO = N + INFO
00230          RETURN
00231       END IF
00232 *
00233 *     Transform problem to standard eigenvalue problem and solve.
00234 *
00235       CALL CHPGST( ITYPE, UPLO, N, AP, BP, INFO )
00236       CALL CHPEV( JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, RWORK, INFO )
00237 *
00238       IF( WANTZ ) THEN
00239 *
00240 *        Backtransform eigenvectors to the original problem.
00241 *
00242          NEIG = N
00243          IF( INFO.GT.0 )
00244      $      NEIG = INFO - 1
00245          IF( ITYPE.EQ.1 .OR. ITYPE.EQ.2 ) THEN
00246 *
00247 *           For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
00248 *           backtransform eigenvectors: x = inv(L)**H*y or inv(U)*y
00249 *
00250             IF( UPPER ) THEN
00251                TRANS = 'N'
00252             ELSE
00253                TRANS = 'C'
00254             END IF
00255 *
00256             DO 10 J = 1, NEIG
00257                CALL CTPSV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
00258      $                     1 )
00259    10       CONTINUE
00260 *
00261          ELSE IF( ITYPE.EQ.3 ) THEN
00262 *
00263 *           For B*A*x=(lambda)*x;
00264 *           backtransform eigenvectors: x = L*y or U**H*y
00265 *
00266             IF( UPPER ) THEN
00267                TRANS = 'C'
00268             ELSE
00269                TRANS = 'N'
00270             END IF
00271 *
00272             DO 20 J = 1, NEIG
00273                CALL CTPMV( UPLO, TRANS, 'Non-unit', N, BP, Z( 1, J ),
00274      $                     1 )
00275    20       CONTINUE
00276          END IF
00277       END IF
00278       RETURN
00279 *
00280 *     End of CHPGV
00281 *
00282       END
 All Files Functions