ssbtrd.c
Go to the documentation of this file.
00001 /* ssbtrd.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 /* Table of constant values */
00017 
00018 static real c_b9 = 0.f;
00019 static real c_b10 = 1.f;
00020 static integer c__1 = 1;
00021 
00022 /* Subroutine */ int ssbtrd_(char *vect, char *uplo, integer *n, integer *kd, 
00023         real *ab, integer *ldab, real *d__, real *e, real *q, integer *ldq, 
00024         real *work, integer *info)
00025 {
00026     /* System generated locals */
00027     integer ab_dim1, ab_offset, q_dim1, q_offset, i__1, i__2, i__3, i__4, 
00028             i__5;
00029 
00030     /* Local variables */
00031     integer i__, j, k, l, i2, j1, j2, nq, nr, kd1, ibl, iqb, kdn, jin, nrt, 
00032             kdm1, inca, jend, lend, jinc, incx, last;
00033     real temp;
00034     extern /* Subroutine */ int srot_(integer *, real *, integer *, real *, 
00035             integer *, real *, real *);
00036     integer j1end, j1inc, iqend;
00037     extern logical lsame_(char *, char *);
00038     logical initq, wantq, upper;
00039     extern /* Subroutine */ int slar2v_(integer *, real *, real *, real *, 
00040             integer *, real *, real *, integer *);
00041     integer iqaend;
00042     extern /* Subroutine */ int xerbla_(char *, integer *), slaset_(
00043             char *, integer *, integer *, real *, real *, real *, integer *), slartg_(real *, real *, real *, real *, real *), slargv_(
00044             integer *, real *, integer *, real *, integer *, real *, integer *
00045 ), slartv_(integer *, real *, integer *, real *, integer *, real *
00046 , real *, integer *);
00047 
00048 
00049 /*  -- LAPACK routine (version 3.2) -- */
00050 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00051 /*     November 2006 */
00052 
00053 /*     .. Scalar Arguments .. */
00054 /*     .. */
00055 /*     .. Array Arguments .. */
00056 /*     .. */
00057 
00058 /*  Purpose */
00059 /*  ======= */
00060 
00061 /*  SSBTRD reduces a real symmetric band matrix A to symmetric */
00062 /*  tridiagonal form T by an orthogonal similarity transformation: */
00063 /*  Q**T * A * Q = T. */
00064 
00065 /*  Arguments */
00066 /*  ========= */
00067 
00068 /*  VECT    (input) CHARACTER*1 */
00069 /*          = 'N':  do not form Q; */
00070 /*          = 'V':  form Q; */
00071 /*          = 'U':  update a matrix X, by forming X*Q. */
00072 
00073 /*  UPLO    (input) CHARACTER*1 */
00074 /*          = 'U':  Upper triangle of A is stored; */
00075 /*          = 'L':  Lower triangle of A is stored. */
00076 
00077 /*  N       (input) INTEGER */
00078 /*          The order of the matrix A.  N >= 0. */
00079 
00080 /*  KD      (input) INTEGER */
00081 /*          The number of superdiagonals of the matrix A if UPLO = 'U', */
00082 /*          or the number of subdiagonals if UPLO = 'L'.  KD >= 0. */
00083 
00084 /*  AB      (input/output) REAL array, dimension (LDAB,N) */
00085 /*          On entry, the upper or lower triangle of the symmetric band */
00086 /*          matrix A, stored in the first KD+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(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j; */
00090 /*          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd). */
00091 /*          On exit, the diagonal elements of AB are overwritten by the */
00092 /*          diagonal elements of the tridiagonal matrix T; if KD > 0, the */
00093 /*          elements on the first superdiagonal (if UPLO = 'U') or the */
00094 /*          first subdiagonal (if UPLO = 'L') are overwritten by the */
00095 /*          off-diagonal elements of T; the rest of AB is overwritten by */
00096 /*          values generated during the reduction. */
00097 
00098 /*  LDAB    (input) INTEGER */
00099 /*          The leading dimension of the array AB.  LDAB >= KD+1. */
00100 
00101 /*  D       (output) REAL array, dimension (N) */
00102 /*          The diagonal elements of the tridiagonal matrix T. */
00103 
00104 /*  E       (output) REAL array, dimension (N-1) */
00105 /*          The off-diagonal elements of the tridiagonal matrix T: */
00106 /*          E(i) = T(i,i+1) if UPLO = 'U'; E(i) = T(i+1,i) if UPLO = 'L'. */
00107 
00108 /*  Q       (input/output) REAL array, dimension (LDQ,N) */
00109 /*          On entry, if VECT = 'U', then Q must contain an N-by-N */
00110 /*          matrix X; if VECT = 'N' or 'V', then Q need not be set. */
00111 
00112 /*          On exit: */
00113 /*          if VECT = 'V', Q contains the N-by-N orthogonal matrix Q; */
00114 /*          if VECT = 'U', Q contains the product X*Q; */
00115 /*          if VECT = 'N', the array Q is not referenced. */
00116 
00117 /*  LDQ     (input) INTEGER */
00118 /*          The leading dimension of the array Q. */
00119 /*          LDQ >= 1, and LDQ >= N if VECT = 'V' or 'U'. */
00120 
00121 /*  WORK    (workspace) REAL array, dimension (N) */
00122 
00123 /*  INFO    (output) INTEGER */
00124 /*          = 0:  successful exit */
00125 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00126 
00127 /*  Further Details */
00128 /*  =============== */
00129 
00130 /*  Modified by Linda Kaufman, Bell Labs. */
00131 
00132 /*  ===================================================================== */
00133 
00134 /*     .. Parameters .. */
00135 /*     .. */
00136 /*     .. Local Scalars .. */
00137 /*     .. */
00138 /*     .. External Subroutines .. */
00139 /*     .. */
00140 /*     .. Intrinsic Functions .. */
00141 /*     .. */
00142 /*     .. External Functions .. */
00143 /*     .. */
00144 /*     .. Executable Statements .. */
00145 
00146 /*     Test the input parameters */
00147 
00148     /* Parameter adjustments */
00149     ab_dim1 = *ldab;
00150     ab_offset = 1 + ab_dim1;
00151     ab -= ab_offset;
00152     --d__;
00153     --e;
00154     q_dim1 = *ldq;
00155     q_offset = 1 + q_dim1;
00156     q -= q_offset;
00157     --work;
00158 
00159     /* Function Body */
00160     initq = lsame_(vect, "V");
00161     wantq = initq || lsame_(vect, "U");
00162     upper = lsame_(uplo, "U");
00163     kd1 = *kd + 1;
00164     kdm1 = *kd - 1;
00165     incx = *ldab - 1;
00166     iqend = 1;
00167 
00168     *info = 0;
00169     if (! wantq && ! lsame_(vect, "N")) {
00170         *info = -1;
00171     } else if (! upper && ! lsame_(uplo, "L")) {
00172         *info = -2;
00173     } else if (*n < 0) {
00174         *info = -3;
00175     } else if (*kd < 0) {
00176         *info = -4;
00177     } else if (*ldab < kd1) {
00178         *info = -6;
00179     } else if (*ldq < max(1,*n) && wantq) {
00180         *info = -10;
00181     }
00182     if (*info != 0) {
00183         i__1 = -(*info);
00184         xerbla_("SSBTRD", &i__1);
00185         return 0;
00186     }
00187 
00188 /*     Quick return if possible */
00189 
00190     if (*n == 0) {
00191         return 0;
00192     }
00193 
00194 /*     Initialize Q to the unit matrix, if needed */
00195 
00196     if (initq) {
00197         slaset_("Full", n, n, &c_b9, &c_b10, &q[q_offset], ldq);
00198     }
00199 
00200 /*     Wherever possible, plane rotations are generated and applied in */
00201 /*     vector operations of length NR over the index set J1:J2:KD1. */
00202 
00203 /*     The cosines and sines of the plane rotations are stored in the */
00204 /*     arrays D and WORK. */
00205 
00206     inca = kd1 * *ldab;
00207 /* Computing MIN */
00208     i__1 = *n - 1;
00209     kdn = min(i__1,*kd);
00210     if (upper) {
00211 
00212         if (*kd > 1) {
00213 
00214 /*           Reduce to tridiagonal form, working with upper triangle */
00215 
00216             nr = 0;
00217             j1 = kdn + 2;
00218             j2 = 1;
00219 
00220             i__1 = *n - 2;
00221             for (i__ = 1; i__ <= i__1; ++i__) {
00222 
00223 /*              Reduce i-th row of matrix to tridiagonal form */
00224 
00225                 for (k = kdn + 1; k >= 2; --k) {
00226                     j1 += kdn;
00227                     j2 += kdn;
00228 
00229                     if (nr > 0) {
00230 
00231 /*                    generate plane rotations to annihilate nonzero */
00232 /*                    elements which have been created outside the band */
00233 
00234                         slargv_(&nr, &ab[(j1 - 1) * ab_dim1 + 1], &inca, &
00235                                 work[j1], &kd1, &d__[j1], &kd1);
00236 
00237 /*                    apply rotations from the right */
00238 
00239 
00240 /*                    Dependent on the the number of diagonals either */
00241 /*                    SLARTV or SROT is used */
00242 
00243                         if (nr >= (*kd << 1) - 1) {
00244                             i__2 = *kd - 1;
00245                             for (l = 1; l <= i__2; ++l) {
00246                                 slartv_(&nr, &ab[l + 1 + (j1 - 1) * ab_dim1], 
00247                                         &inca, &ab[l + j1 * ab_dim1], &inca, &
00248                                         d__[j1], &work[j1], &kd1);
00249 /* L10: */
00250                             }
00251 
00252                         } else {
00253                             jend = j1 + (nr - 1) * kd1;
00254                             i__2 = jend;
00255                             i__3 = kd1;
00256                             for (jinc = j1; i__3 < 0 ? jinc >= i__2 : jinc <= 
00257                                     i__2; jinc += i__3) {
00258                                 srot_(&kdm1, &ab[(jinc - 1) * ab_dim1 + 2], &
00259                                         c__1, &ab[jinc * ab_dim1 + 1], &c__1, 
00260                                         &d__[jinc], &work[jinc]);
00261 /* L20: */
00262                             }
00263                         }
00264                     }
00265 
00266 
00267                     if (k > 2) {
00268                         if (k <= *n - i__ + 1) {
00269 
00270 /*                       generate plane rotation to annihilate a(i,i+k-1) */
00271 /*                       within the band */
00272 
00273                             slartg_(&ab[*kd - k + 3 + (i__ + k - 2) * ab_dim1]
00274 , &ab[*kd - k + 2 + (i__ + k - 1) * 
00275                                     ab_dim1], &d__[i__ + k - 1], &work[i__ + 
00276                                     k - 1], &temp);
00277                             ab[*kd - k + 3 + (i__ + k - 2) * ab_dim1] = temp;
00278 
00279 /*                       apply rotation from the right */
00280 
00281                             i__3 = k - 3;
00282                             srot_(&i__3, &ab[*kd - k + 4 + (i__ + k - 2) * 
00283                                     ab_dim1], &c__1, &ab[*kd - k + 3 + (i__ + 
00284                                     k - 1) * ab_dim1], &c__1, &d__[i__ + k - 
00285                                     1], &work[i__ + k - 1]);
00286                         }
00287                         ++nr;
00288                         j1 = j1 - kdn - 1;
00289                     }
00290 
00291 /*                 apply plane rotations from both sides to diagonal */
00292 /*                 blocks */
00293 
00294                     if (nr > 0) {
00295                         slar2v_(&nr, &ab[kd1 + (j1 - 1) * ab_dim1], &ab[kd1 + 
00296                                 j1 * ab_dim1], &ab[*kd + j1 * ab_dim1], &inca, 
00297                                  &d__[j1], &work[j1], &kd1);
00298                     }
00299 
00300 /*                 apply plane rotations from the left */
00301 
00302                     if (nr > 0) {
00303                         if ((*kd << 1) - 1 < nr) {
00304 
00305 /*                    Dependent on the the number of diagonals either */
00306 /*                    SLARTV or SROT is used */
00307 
00308                             i__3 = *kd - 1;
00309                             for (l = 1; l <= i__3; ++l) {
00310                                 if (j2 + l > *n) {
00311                                     nrt = nr - 1;
00312                                 } else {
00313                                     nrt = nr;
00314                                 }
00315                                 if (nrt > 0) {
00316                                     slartv_(&nrt, &ab[*kd - l + (j1 + l) * 
00317                                             ab_dim1], &inca, &ab[*kd - l + 1 
00318                                             + (j1 + l) * ab_dim1], &inca, &
00319                                             d__[j1], &work[j1], &kd1);
00320                                 }
00321 /* L30: */
00322                             }
00323                         } else {
00324                             j1end = j1 + kd1 * (nr - 2);
00325                             if (j1end >= j1) {
00326                                 i__3 = j1end;
00327                                 i__2 = kd1;
00328                                 for (jin = j1; i__2 < 0 ? jin >= i__3 : jin <=
00329                                          i__3; jin += i__2) {
00330                                     i__4 = *kd - 1;
00331                                     srot_(&i__4, &ab[*kd - 1 + (jin + 1) * 
00332                                             ab_dim1], &incx, &ab[*kd + (jin + 
00333                                             1) * ab_dim1], &incx, &d__[jin], &
00334                                             work[jin]);
00335 /* L40: */
00336                                 }
00337                             }
00338 /* Computing MIN */
00339                             i__2 = kdm1, i__3 = *n - j2;
00340                             lend = min(i__2,i__3);
00341                             last = j1end + kd1;
00342                             if (lend > 0) {
00343                                 srot_(&lend, &ab[*kd - 1 + (last + 1) * 
00344                                         ab_dim1], &incx, &ab[*kd + (last + 1) 
00345                                         * ab_dim1], &incx, &d__[last], &work[
00346                                         last]);
00347                             }
00348                         }
00349                     }
00350 
00351                     if (wantq) {
00352 
00353 /*                    accumulate product of plane rotations in Q */
00354 
00355                         if (initq) {
00356 
00357 /*                 take advantage of the fact that Q was */
00358 /*                 initially the Identity matrix */
00359 
00360                             iqend = max(iqend,j2);
00361 /* Computing MAX */
00362                             i__2 = 0, i__3 = k - 3;
00363                             i2 = max(i__2,i__3);
00364                             iqaend = i__ * *kd + 1;
00365                             if (k == 2) {
00366                                 iqaend += *kd;
00367                             }
00368                             iqaend = min(iqaend,iqend);
00369                             i__2 = j2;
00370                             i__3 = kd1;
00371                             for (j = j1; i__3 < 0 ? j >= i__2 : j <= i__2; j 
00372                                     += i__3) {
00373                                 ibl = i__ - i2 / kdm1;
00374                                 ++i2;
00375 /* Computing MAX */
00376                                 i__4 = 1, i__5 = j - ibl;
00377                                 iqb = max(i__4,i__5);
00378                                 nq = iqaend + 1 - iqb;
00379 /* Computing MIN */
00380                                 i__4 = iqaend + *kd;
00381                                 iqaend = min(i__4,iqend);
00382                                 srot_(&nq, &q[iqb + (j - 1) * q_dim1], &c__1, 
00383                                         &q[iqb + j * q_dim1], &c__1, &d__[j], 
00384                                         &work[j]);
00385 /* L50: */
00386                             }
00387                         } else {
00388 
00389                             i__3 = j2;
00390                             i__2 = kd1;
00391                             for (j = j1; i__2 < 0 ? j >= i__3 : j <= i__3; j 
00392                                     += i__2) {
00393                                 srot_(n, &q[(j - 1) * q_dim1 + 1], &c__1, &q[
00394                                         j * q_dim1 + 1], &c__1, &d__[j], &
00395                                         work[j]);
00396 /* L60: */
00397                             }
00398                         }
00399 
00400                     }
00401 
00402                     if (j2 + kdn > *n) {
00403 
00404 /*                    adjust J2 to keep within the bounds of the matrix */
00405 
00406                         --nr;
00407                         j2 = j2 - kdn - 1;
00408                     }
00409 
00410                     i__2 = j2;
00411                     i__3 = kd1;
00412                     for (j = j1; i__3 < 0 ? j >= i__2 : j <= i__2; j += i__3) 
00413                             {
00414 
00415 /*                    create nonzero element a(j-1,j+kd) outside the band */
00416 /*                    and store it in WORK */
00417 
00418                         work[j + *kd] = work[j] * ab[(j + *kd) * ab_dim1 + 1];
00419                         ab[(j + *kd) * ab_dim1 + 1] = d__[j] * ab[(j + *kd) * 
00420                                 ab_dim1 + 1];
00421 /* L70: */
00422                     }
00423 /* L80: */
00424                 }
00425 /* L90: */
00426             }
00427         }
00428 
00429         if (*kd > 0) {
00430 
00431 /*           copy off-diagonal elements to E */
00432 
00433             i__1 = *n - 1;
00434             for (i__ = 1; i__ <= i__1; ++i__) {
00435                 e[i__] = ab[*kd + (i__ + 1) * ab_dim1];
00436 /* L100: */
00437             }
00438         } else {
00439 
00440 /*           set E to zero if original matrix was diagonal */
00441 
00442             i__1 = *n - 1;
00443             for (i__ = 1; i__ <= i__1; ++i__) {
00444                 e[i__] = 0.f;
00445 /* L110: */
00446             }
00447         }
00448 
00449 /*        copy diagonal elements to D */
00450 
00451         i__1 = *n;
00452         for (i__ = 1; i__ <= i__1; ++i__) {
00453             d__[i__] = ab[kd1 + i__ * ab_dim1];
00454 /* L120: */
00455         }
00456 
00457     } else {
00458 
00459         if (*kd > 1) {
00460 
00461 /*           Reduce to tridiagonal form, working with lower triangle */
00462 
00463             nr = 0;
00464             j1 = kdn + 2;
00465             j2 = 1;
00466 
00467             i__1 = *n - 2;
00468             for (i__ = 1; i__ <= i__1; ++i__) {
00469 
00470 /*              Reduce i-th column of matrix to tridiagonal form */
00471 
00472                 for (k = kdn + 1; k >= 2; --k) {
00473                     j1 += kdn;
00474                     j2 += kdn;
00475 
00476                     if (nr > 0) {
00477 
00478 /*                    generate plane rotations to annihilate nonzero */
00479 /*                    elements which have been created outside the band */
00480 
00481                         slargv_(&nr, &ab[kd1 + (j1 - kd1) * ab_dim1], &inca, &
00482                                 work[j1], &kd1, &d__[j1], &kd1);
00483 
00484 /*                    apply plane rotations from one side */
00485 
00486 
00487 /*                    Dependent on the the number of diagonals either */
00488 /*                    SLARTV or SROT is used */
00489 
00490                         if (nr > (*kd << 1) - 1) {
00491                             i__3 = *kd - 1;
00492                             for (l = 1; l <= i__3; ++l) {
00493                                 slartv_(&nr, &ab[kd1 - l + (j1 - kd1 + l) * 
00494                                         ab_dim1], &inca, &ab[kd1 - l + 1 + (
00495                                         j1 - kd1 + l) * ab_dim1], &inca, &d__[
00496                                         j1], &work[j1], &kd1);
00497 /* L130: */
00498                             }
00499                         } else {
00500                             jend = j1 + kd1 * (nr - 1);
00501                             i__3 = jend;
00502                             i__2 = kd1;
00503                             for (jinc = j1; i__2 < 0 ? jinc >= i__3 : jinc <= 
00504                                     i__3; jinc += i__2) {
00505                                 srot_(&kdm1, &ab[*kd + (jinc - *kd) * ab_dim1]
00506 , &incx, &ab[kd1 + (jinc - *kd) * 
00507                                         ab_dim1], &incx, &d__[jinc], &work[
00508                                         jinc]);
00509 /* L140: */
00510                             }
00511                         }
00512 
00513                     }
00514 
00515                     if (k > 2) {
00516                         if (k <= *n - i__ + 1) {
00517 
00518 /*                       generate plane rotation to annihilate a(i+k-1,i) */
00519 /*                       within the band */
00520 
00521                             slartg_(&ab[k - 1 + i__ * ab_dim1], &ab[k + i__ * 
00522                                     ab_dim1], &d__[i__ + k - 1], &work[i__ + 
00523                                     k - 1], &temp);
00524                             ab[k - 1 + i__ * ab_dim1] = temp;
00525 
00526 /*                       apply rotation from the left */
00527 
00528                             i__2 = k - 3;
00529                             i__3 = *ldab - 1;
00530                             i__4 = *ldab - 1;
00531                             srot_(&i__2, &ab[k - 2 + (i__ + 1) * ab_dim1], &
00532                                     i__3, &ab[k - 1 + (i__ + 1) * ab_dim1], &
00533                                     i__4, &d__[i__ + k - 1], &work[i__ + k - 
00534                                     1]);
00535                         }
00536                         ++nr;
00537                         j1 = j1 - kdn - 1;
00538                     }
00539 
00540 /*                 apply plane rotations from both sides to diagonal */
00541 /*                 blocks */
00542 
00543                     if (nr > 0) {
00544                         slar2v_(&nr, &ab[(j1 - 1) * ab_dim1 + 1], &ab[j1 * 
00545                                 ab_dim1 + 1], &ab[(j1 - 1) * ab_dim1 + 2], &
00546                                 inca, &d__[j1], &work[j1], &kd1);
00547                     }
00548 
00549 /*                 apply plane rotations from the right */
00550 
00551 
00552 /*                    Dependent on the the number of diagonals either */
00553 /*                    SLARTV or SROT is used */
00554 
00555                     if (nr > 0) {
00556                         if (nr > (*kd << 1) - 1) {
00557                             i__2 = *kd - 1;
00558                             for (l = 1; l <= i__2; ++l) {
00559                                 if (j2 + l > *n) {
00560                                     nrt = nr - 1;
00561                                 } else {
00562                                     nrt = nr;
00563                                 }
00564                                 if (nrt > 0) {
00565                                     slartv_(&nrt, &ab[l + 2 + (j1 - 1) * 
00566                                             ab_dim1], &inca, &ab[l + 1 + j1 * 
00567                                             ab_dim1], &inca, &d__[j1], &work[
00568                                             j1], &kd1);
00569                                 }
00570 /* L150: */
00571                             }
00572                         } else {
00573                             j1end = j1 + kd1 * (nr - 2);
00574                             if (j1end >= j1) {
00575                                 i__2 = j1end;
00576                                 i__3 = kd1;
00577                                 for (j1inc = j1; i__3 < 0 ? j1inc >= i__2 : 
00578                                         j1inc <= i__2; j1inc += i__3) {
00579                                     srot_(&kdm1, &ab[(j1inc - 1) * ab_dim1 + 
00580                                             3], &c__1, &ab[j1inc * ab_dim1 + 
00581                                             2], &c__1, &d__[j1inc], &work[
00582                                             j1inc]);
00583 /* L160: */
00584                                 }
00585                             }
00586 /* Computing MIN */
00587                             i__3 = kdm1, i__2 = *n - j2;
00588                             lend = min(i__3,i__2);
00589                             last = j1end + kd1;
00590                             if (lend > 0) {
00591                                 srot_(&lend, &ab[(last - 1) * ab_dim1 + 3], &
00592                                         c__1, &ab[last * ab_dim1 + 2], &c__1, 
00593                                         &d__[last], &work[last]);
00594                             }
00595                         }
00596                     }
00597 
00598 
00599 
00600                     if (wantq) {
00601 
00602 /*                    accumulate product of plane rotations in Q */
00603 
00604                         if (initq) {
00605 
00606 /*                 take advantage of the fact that Q was */
00607 /*                 initially the Identity matrix */
00608 
00609                             iqend = max(iqend,j2);
00610 /* Computing MAX */
00611                             i__3 = 0, i__2 = k - 3;
00612                             i2 = max(i__3,i__2);
00613                             iqaend = i__ * *kd + 1;
00614                             if (k == 2) {
00615                                 iqaend += *kd;
00616                             }
00617                             iqaend = min(iqaend,iqend);
00618                             i__3 = j2;
00619                             i__2 = kd1;
00620                             for (j = j1; i__2 < 0 ? j >= i__3 : j <= i__3; j 
00621                                     += i__2) {
00622                                 ibl = i__ - i2 / kdm1;
00623                                 ++i2;
00624 /* Computing MAX */
00625                                 i__4 = 1, i__5 = j - ibl;
00626                                 iqb = max(i__4,i__5);
00627                                 nq = iqaend + 1 - iqb;
00628 /* Computing MIN */
00629                                 i__4 = iqaend + *kd;
00630                                 iqaend = min(i__4,iqend);
00631                                 srot_(&nq, &q[iqb + (j - 1) * q_dim1], &c__1, 
00632                                         &q[iqb + j * q_dim1], &c__1, &d__[j], 
00633                                         &work[j]);
00634 /* L170: */
00635                             }
00636                         } else {
00637 
00638                             i__2 = j2;
00639                             i__3 = kd1;
00640                             for (j = j1; i__3 < 0 ? j >= i__2 : j <= i__2; j 
00641                                     += i__3) {
00642                                 srot_(n, &q[(j - 1) * q_dim1 + 1], &c__1, &q[
00643                                         j * q_dim1 + 1], &c__1, &d__[j], &
00644                                         work[j]);
00645 /* L180: */
00646                             }
00647                         }
00648                     }
00649 
00650                     if (j2 + kdn > *n) {
00651 
00652 /*                    adjust J2 to keep within the bounds of the matrix */
00653 
00654                         --nr;
00655                         j2 = j2 - kdn - 1;
00656                     }
00657 
00658                     i__3 = j2;
00659                     i__2 = kd1;
00660                     for (j = j1; i__2 < 0 ? j >= i__3 : j <= i__3; j += i__2) 
00661                             {
00662 
00663 /*                    create nonzero element a(j+kd,j-1) outside the */
00664 /*                    band and store it in WORK */
00665 
00666                         work[j + *kd] = work[j] * ab[kd1 + j * ab_dim1];
00667                         ab[kd1 + j * ab_dim1] = d__[j] * ab[kd1 + j * ab_dim1]
00668                                 ;
00669 /* L190: */
00670                     }
00671 /* L200: */
00672                 }
00673 /* L210: */
00674             }
00675         }
00676 
00677         if (*kd > 0) {
00678 
00679 /*           copy off-diagonal elements to E */
00680 
00681             i__1 = *n - 1;
00682             for (i__ = 1; i__ <= i__1; ++i__) {
00683                 e[i__] = ab[i__ * ab_dim1 + 2];
00684 /* L220: */
00685             }
00686         } else {
00687 
00688 /*           set E to zero if original matrix was diagonal */
00689 
00690             i__1 = *n - 1;
00691             for (i__ = 1; i__ <= i__1; ++i__) {
00692                 e[i__] = 0.f;
00693 /* L230: */
00694             }
00695         }
00696 
00697 /*        copy diagonal elements to D */
00698 
00699         i__1 = *n;
00700         for (i__ = 1; i__ <= i__1; ++i__) {
00701             d__[i__] = ab[i__ * ab_dim1 + 1];
00702 /* L240: */
00703         }
00704     }
00705 
00706     return 0;
00707 
00708 /*     End of SSBTRD */
00709 
00710 } /* ssbtrd_ */


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