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


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