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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:48