zhbgv.c
Go to the documentation of this file.
00001 /* zhbgv.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int zhbgv_(char *jobz, char *uplo, integer *n, integer *ka, 
00017         integer *kb, doublecomplex *ab, integer *ldab, doublecomplex *bb, 
00018         integer *ldbb, doublereal *w, doublecomplex *z__, integer *ldz, 
00019         doublecomplex *work, doublereal *rwork, integer *info)
00020 {
00021     /* System generated locals */
00022     integer ab_dim1, ab_offset, bb_dim1, bb_offset, z_dim1, z_offset, i__1;
00023 
00024     /* Local variables */
00025     integer inde;
00026     char vect[1];
00027     extern logical lsame_(char *, char *);
00028     integer iinfo;
00029     logical upper, wantz;
00030     extern /* Subroutine */ int xerbla_(char *, integer *), dsterf_(
00031             integer *, doublereal *, doublereal *, integer *), zhbtrd_(char *, 
00032              char *, integer *, integer *, doublecomplex *, integer *, 
00033             doublereal *, doublereal *, doublecomplex *, integer *, 
00034             doublecomplex *, integer *);
00035     integer indwrk;
00036     extern /* Subroutine */ int zhbgst_(char *, char *, integer *, integer *, 
00037             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00038              doublecomplex *, integer *, doublecomplex *, doublereal *, 
00039             integer *), zpbstf_(char *, integer *, integer *, 
00040             doublecomplex *, integer *, integer *), zsteqr_(char *, 
00041             integer *, doublereal *, doublereal *, doublecomplex *, integer *, 
00042              doublereal *, integer *);
00043 
00044 
00045 /*  -- LAPACK driver routine (version 3.2) -- */
00046 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00047 /*     November 2006 */
00048 
00049 /*     .. Scalar Arguments .. */
00050 /*     .. */
00051 /*     .. Array Arguments .. */
00052 /*     .. */
00053 
00054 /*  Purpose */
00055 /*  ======= */
00056 
00057 /*  ZHBGV computes all the eigenvalues, and optionally, the eigenvectors */
00058 /*  of a complex generalized Hermitian-definite banded eigenproblem, of */
00059 /*  the form A*x=(lambda)*B*x. Here A and B are assumed to be Hermitian */
00060 /*  and banded, and B is also positive definite. */
00061 
00062 /*  Arguments */
00063 /*  ========= */
00064 
00065 /*  JOBZ    (input) CHARACTER*1 */
00066 /*          = 'N':  Compute eigenvalues only; */
00067 /*          = 'V':  Compute eigenvalues and eigenvectors. */
00068 
00069 /*  UPLO    (input) CHARACTER*1 */
00070 /*          = 'U':  Upper triangles of A and B are stored; */
00071 /*          = 'L':  Lower triangles of A and B are stored. */
00072 
00073 /*  N       (input) INTEGER */
00074 /*          The order of the matrices A and B.  N >= 0. */
00075 
00076 /*  KA      (input) INTEGER */
00077 /*          The number of superdiagonals of the matrix A if UPLO = 'U', */
00078 /*          or the number of subdiagonals if UPLO = 'L'. KA >= 0. */
00079 
00080 /*  KB      (input) INTEGER */
00081 /*          The number of superdiagonals of the matrix B if UPLO = 'U', */
00082 /*          or the number of subdiagonals if UPLO = 'L'. KB >= 0. */
00083 
00084 /*  AB      (input/output) COMPLEX*16 array, dimension (LDAB, N) */
00085 /*          On entry, the upper or lower triangle of the Hermitian band */
00086 /*          matrix A, stored in the first ka+1 rows of the array.  The */
00087 /*          j-th column of A is stored in the j-th column of the array AB */
00088 /*          as follows: */
00089 /*          if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j; */
00090 /*          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+ka). */
00091 
00092 /*          On exit, the contents of AB are destroyed. */
00093 
00094 /*  LDAB    (input) INTEGER */
00095 /*          The leading dimension of the array AB.  LDAB >= KA+1. */
00096 
00097 /*  BB      (input/output) COMPLEX*16 array, dimension (LDBB, N) */
00098 /*          On entry, the upper or lower triangle of the Hermitian band */
00099 /*          matrix B, stored in the first kb+1 rows of the array.  The */
00100 /*          j-th column of B is stored in the j-th column of the array BB */
00101 /*          as follows: */
00102 /*          if UPLO = 'U', BB(kb+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j; */
00103 /*          if UPLO = 'L', BB(1+i-j,j)    = B(i,j) for j<=i<=min(n,j+kb). */
00104 
00105 /*          On exit, the factor S from the split Cholesky factorization */
00106 /*          B = S**H*S, as returned by ZPBSTF. */
00107 
00108 /*  LDBB    (input) INTEGER */
00109 /*          The leading dimension of the array BB.  LDBB >= KB+1. */
00110 
00111 /*  W       (output) DOUBLE PRECISION array, dimension (N) */
00112 /*          If INFO = 0, the eigenvalues in ascending order. */
00113 
00114 /*  Z       (output) COMPLEX*16 array, dimension (LDZ, N) */
00115 /*          If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of */
00116 /*          eigenvectors, with the i-th column of Z holding the */
00117 /*          eigenvector associated with W(i). The eigenvectors are */
00118 /*          normalized so that Z**H*B*Z = I. */
00119 /*          If JOBZ = 'N', then Z is not referenced. */
00120 
00121 /*  LDZ     (input) INTEGER */
00122 /*          The leading dimension of the array Z.  LDZ >= 1, and if */
00123 /*          JOBZ = 'V', LDZ >= N. */
00124 
00125 /*  WORK    (workspace) COMPLEX*16 array, dimension (N) */
00126 
00127 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (3*N) */
00128 
00129 /*  INFO    (output) INTEGER */
00130 /*          = 0:  successful exit */
00131 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00132 /*          > 0:  if INFO = i, and i is: */
00133 /*             <= N:  the algorithm failed to converge: */
00134 /*                    i off-diagonal elements of an intermediate */
00135 /*                    tridiagonal form did not converge to zero; */
00136 /*             > N:   if INFO = N + i, for 1 <= i <= N, then ZPBSTF */
00137 /*                    returned INFO = i: B is not positive definite. */
00138 /*                    The factorization of B could not be completed and */
00139 /*                    no eigenvalues or eigenvectors were computed. */
00140 
00141 /*  ===================================================================== */
00142 
00143 /*     .. Local Scalars .. */
00144 /*     .. */
00145 /*     .. External Functions .. */
00146 /*     .. */
00147 /*     .. External Subroutines .. */
00148 /*     .. */
00149 /*     .. Executable Statements .. */
00150 
00151 /*     Test the input parameters. */
00152 
00153     /* Parameter adjustments */
00154     ab_dim1 = *ldab;
00155     ab_offset = 1 + ab_dim1;
00156     ab -= ab_offset;
00157     bb_dim1 = *ldbb;
00158     bb_offset = 1 + bb_dim1;
00159     bb -= bb_offset;
00160     --w;
00161     z_dim1 = *ldz;
00162     z_offset = 1 + z_dim1;
00163     z__ -= z_offset;
00164     --work;
00165     --rwork;
00166 
00167     /* Function Body */
00168     wantz = lsame_(jobz, "V");
00169     upper = lsame_(uplo, "U");
00170 
00171     *info = 0;
00172     if (! (wantz || lsame_(jobz, "N"))) {
00173         *info = -1;
00174     } else if (! (upper || lsame_(uplo, "L"))) {
00175         *info = -2;
00176     } else if (*n < 0) {
00177         *info = -3;
00178     } else if (*ka < 0) {
00179         *info = -4;
00180     } else if (*kb < 0 || *kb > *ka) {
00181         *info = -5;
00182     } else if (*ldab < *ka + 1) {
00183         *info = -7;
00184     } else if (*ldbb < *kb + 1) {
00185         *info = -9;
00186     } else if (*ldz < 1 || wantz && *ldz < *n) {
00187         *info = -12;
00188     }
00189     if (*info != 0) {
00190         i__1 = -(*info);
00191         xerbla_("ZHBGV ", &i__1);
00192         return 0;
00193     }
00194 
00195 /*     Quick return if possible */
00196 
00197     if (*n == 0) {
00198         return 0;
00199     }
00200 
00201 /*     Form a split Cholesky factorization of B. */
00202 
00203     zpbstf_(uplo, n, kb, &bb[bb_offset], ldbb, info);
00204     if (*info != 0) {
00205         *info = *n + *info;
00206         return 0;
00207     }
00208 
00209 /*     Transform problem to standard eigenvalue problem. */
00210 
00211     inde = 1;
00212     indwrk = inde + *n;
00213     zhbgst_(jobz, uplo, n, ka, kb, &ab[ab_offset], ldab, &bb[bb_offset], ldbb, 
00214              &z__[z_offset], ldz, &work[1], &rwork[indwrk], &iinfo);
00215 
00216 /*     Reduce to tridiagonal form. */
00217 
00218     if (wantz) {
00219         *(unsigned char *)vect = 'U';
00220     } else {
00221         *(unsigned char *)vect = 'N';
00222     }
00223     zhbtrd_(vect, uplo, n, ka, &ab[ab_offset], ldab, &w[1], &rwork[inde], &
00224             z__[z_offset], ldz, &work[1], &iinfo);
00225 
00226 /*     For eigenvalues only, call DSTERF.  For eigenvectors, call ZSTEQR. */
00227 
00228     if (! wantz) {
00229         dsterf_(n, &w[1], &rwork[inde], info);
00230     } else {
00231         zsteqr_(jobz, n, &w[1], &rwork[inde], &z__[z_offset], ldz, &rwork[
00232                 indwrk], info);
00233     }
00234     return 0;
00235 
00236 /*     End of ZHBGV */
00237 
00238 } /* zhbgv_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:36