LAPACK 3.3.0

chbgv.f

Go to the documentation of this file.
00001       SUBROUTINE CHBGV( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, W, Z,
00002      $                  LDZ, WORK, RWORK, INFO )
00003 *
00004 *  -- LAPACK driver routine (version 3.2) --
00005 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00006 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00007 *     November 2006
00008 *
00009 *     .. Scalar Arguments ..
00010       CHARACTER          JOBZ, UPLO
00011       INTEGER            INFO, KA, KB, LDAB, LDBB, LDZ, N
00012 *     ..
00013 *     .. Array Arguments ..
00014       REAL               RWORK( * ), W( * )
00015       COMPLEX            AB( LDAB, * ), BB( LDBB, * ), WORK( * ),
00016      $                   Z( LDZ, * )
00017 *     ..
00018 *
00019 *  Purpose
00020 *  =======
00021 *
00022 *  CHBGV computes all the eigenvalues, and optionally, the eigenvectors
00023 *  of a complex generalized Hermitian-definite banded eigenproblem, of
00024 *  the form A*x=(lambda)*B*x. Here A and B are assumed to be Hermitian
00025 *  and banded, and B is also positive definite.
00026 *
00027 *  Arguments
00028 *  =========
00029 *
00030 *  JOBZ    (input) CHARACTER*1
00031 *          = 'N':  Compute eigenvalues only;
00032 *          = 'V':  Compute eigenvalues and eigenvectors.
00033 *
00034 *  UPLO    (input) CHARACTER*1
00035 *          = 'U':  Upper triangles of A and B are stored;
00036 *          = 'L':  Lower triangles of A and B are stored.
00037 *
00038 *  N       (input) INTEGER
00039 *          The order of the matrices A and B.  N >= 0.
00040 *
00041 *  KA      (input) INTEGER
00042 *          The number of superdiagonals of the matrix A if UPLO = 'U',
00043 *          or the number of subdiagonals if UPLO = 'L'. KA >= 0.
00044 *
00045 *  KB      (input) INTEGER
00046 *          The number of superdiagonals of the matrix B if UPLO = 'U',
00047 *          or the number of subdiagonals if UPLO = 'L'. KB >= 0.
00048 *
00049 *  AB      (input/output) COMPLEX array, dimension (LDAB, N)
00050 *          On entry, the upper or lower triangle of the Hermitian band
00051 *          matrix A, stored in the first ka+1 rows of the array.  The
00052 *          j-th column of A is stored in the j-th column of the array AB
00053 *          as follows:
00054 *          if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j;
00055 *          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+ka).
00056 *
00057 *          On exit, the contents of AB are destroyed.
00058 *
00059 *  LDAB    (input) INTEGER
00060 *          The leading dimension of the array AB.  LDAB >= KA+1.
00061 *
00062 *  BB      (input/output) COMPLEX array, dimension (LDBB, N)
00063 *          On entry, the upper or lower triangle of the Hermitian band
00064 *          matrix B, stored in the first kb+1 rows of the array.  The
00065 *          j-th column of B is stored in the j-th column of the array BB
00066 *          as follows:
00067 *          if UPLO = 'U', BB(kb+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j;
00068 *          if UPLO = 'L', BB(1+i-j,j)    = B(i,j) for j<=i<=min(n,j+kb).
00069 *
00070 *          On exit, the factor S from the split Cholesky factorization
00071 *          B = S**H*S, as returned by CPBSTF.
00072 *
00073 *  LDBB    (input) INTEGER
00074 *          The leading dimension of the array BB.  LDBB >= KB+1.
00075 *
00076 *  W       (output) REAL array, dimension (N)
00077 *          If INFO = 0, the eigenvalues in ascending order.
00078 *
00079 *  Z       (output) COMPLEX array, dimension (LDZ, N)
00080 *          If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
00081 *          eigenvectors, with the i-th column of Z holding the
00082 *          eigenvector associated with W(i). The eigenvectors are
00083 *          normalized so that Z**H*B*Z = I.
00084 *          If JOBZ = 'N', then Z is not referenced.
00085 *
00086 *  LDZ     (input) INTEGER
00087 *          The leading dimension of the array Z.  LDZ >= 1, and if
00088 *          JOBZ = 'V', LDZ >= N.
00089 *
00090 *  WORK    (workspace) COMPLEX array, dimension (N)
00091 *
00092 *  RWORK   (workspace) REAL array, dimension (3*N)
00093 *
00094 *  INFO    (output) INTEGER
00095 *          = 0:  successful exit
00096 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00097 *          > 0:  if INFO = i, and i is:
00098 *             <= N:  the algorithm failed to converge:
00099 *                    i off-diagonal elements of an intermediate
00100 *                    tridiagonal form did not converge to zero;
00101 *             > N:   if INFO = N + i, for 1 <= i <= N, then CPBSTF
00102 *                    returned INFO = i: B is not positive definite.
00103 *                    The factorization of B could not be completed and
00104 *                    no eigenvalues or eigenvectors were computed.
00105 *
00106 *  =====================================================================
00107 *
00108 *     .. Local Scalars ..
00109       LOGICAL            UPPER, WANTZ
00110       CHARACTER          VECT
00111       INTEGER            IINFO, INDE, INDWRK
00112 *     ..
00113 *     .. External Functions ..
00114       LOGICAL            LSAME
00115       EXTERNAL           LSAME
00116 *     ..
00117 *     .. External Subroutines ..
00118       EXTERNAL           CHBGST, CHBTRD, CPBSTF, CSTEQR, SSTERF, XERBLA
00119 *     ..
00120 *     .. Executable Statements ..
00121 *
00122 *     Test the input parameters.
00123 *
00124       WANTZ = LSAME( JOBZ, 'V' )
00125       UPPER = LSAME( UPLO, 'U' )
00126 *
00127       INFO = 0
00128       IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
00129          INFO = -1
00130       ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
00131          INFO = -2
00132       ELSE IF( N.LT.0 ) THEN
00133          INFO = -3
00134       ELSE IF( KA.LT.0 ) THEN
00135          INFO = -4
00136       ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
00137          INFO = -5
00138       ELSE IF( LDAB.LT.KA+1 ) THEN
00139          INFO = -7
00140       ELSE IF( LDBB.LT.KB+1 ) THEN
00141          INFO = -9
00142       ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
00143          INFO = -12
00144       END IF
00145       IF( INFO.NE.0 ) THEN
00146          CALL XERBLA( 'CHBGV ', -INFO )
00147          RETURN
00148       END IF
00149 *
00150 *     Quick return if possible
00151 *
00152       IF( N.EQ.0 )
00153      $   RETURN
00154 *
00155 *     Form a split Cholesky factorization of B.
00156 *
00157       CALL CPBSTF( UPLO, N, KB, BB, LDBB, INFO )
00158       IF( INFO.NE.0 ) THEN
00159          INFO = N + INFO
00160          RETURN
00161       END IF
00162 *
00163 *     Transform problem to standard eigenvalue problem.
00164 *
00165       INDE = 1
00166       INDWRK = INDE + N
00167       CALL CHBGST( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Z, LDZ,
00168      $             WORK, RWORK( INDWRK ), IINFO )
00169 *
00170 *     Reduce to tridiagonal form.
00171 *
00172       IF( WANTZ ) THEN
00173          VECT = 'U'
00174       ELSE
00175          VECT = 'N'
00176       END IF
00177       CALL CHBTRD( VECT, UPLO, N, KA, AB, LDAB, W, RWORK( INDE ), Z,
00178      $             LDZ, WORK, IINFO )
00179 *
00180 *     For eigenvalues only, call SSTERF.  For eigenvectors, call CSTEQR.
00181 *
00182       IF( .NOT.WANTZ ) THEN
00183          CALL SSTERF( N, W, RWORK( INDE ), INFO )
00184       ELSE
00185          CALL CSTEQR( JOBZ, N, W, RWORK( INDE ), Z, LDZ,
00186      $                RWORK( INDWRK ), INFO )
00187       END IF
00188       RETURN
00189 *
00190 *     End of CHBGV
00191 *
00192       END
 All Files Functions