sgsvj0.c
Go to the documentation of this file.
00001 /* sgsvj0.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 integer c__1 = 1;
00019 static integer c__0 = 0;
00020 static real c_b42 = 1.f;
00021 
00022 /* Subroutine */ int sgsvj0_(char *jobv, integer *m, integer *n, real *a, 
00023         integer *lda, real *d__, real *sva, integer *mv, real *v, integer *
00024         ldv, real *eps, real *sfmin, real *tol, integer *nsweep, real *work, 
00025         integer *lwork, integer *info)
00026 {
00027     /* System generated locals */
00028     integer a_dim1, a_offset, v_dim1, v_offset, i__1, i__2, i__3, i__4, i__5, 
00029             i__6;
00030     real r__1, r__2;
00031 
00032     /* Builtin functions */
00033     double sqrt(doublereal), r_sign(real *, real *);
00034 
00035     /* Local variables */
00036     real bigtheta;
00037     integer pskipped, i__, p, q;
00038     real t, rootsfmin, cs, sn;
00039     integer ir1, jbc;
00040     real big;
00041     integer kbl, igl, ibr, jgl, nbl, mvl;
00042     real aapp, aapq, aaqq;
00043     integer ierr;
00044     extern doublereal sdot_(integer *, real *, integer *, real *, integer *);
00045     real aapp0, temp1;
00046     extern doublereal snrm2_(integer *, real *, integer *);
00047     real apoaq, aqoap;
00048     extern logical lsame_(char *, char *);
00049     real theta, small, fastr[5];
00050     logical applv, rsvec;
00051     extern /* Subroutine */ int scopy_(integer *, real *, integer *, real *, 
00052             integer *);
00053     logical rotok;
00054     extern /* Subroutine */ int sswap_(integer *, real *, integer *, real *, 
00055             integer *), saxpy_(integer *, real *, real *, integer *, real *, 
00056             integer *), srotm_(integer *, real *, integer *, real *, integer *
00057 , real *), xerbla_(char *, integer *);
00058     integer ijblsk, swband;
00059     extern /* Subroutine */ int slascl_(char *, integer *, integer *, real *, 
00060             real *, integer *, integer *, real *, integer *, integer *);
00061     extern integer isamax_(integer *, real *, integer *);
00062     integer blskip;
00063     real mxaapq, thsign;
00064     extern /* Subroutine */ int slassq_(integer *, real *, integer *, real *, 
00065             real *);
00066     real mxsinj;
00067     integer emptsw, notrot, iswrot, lkahead;
00068     real rootbig, rooteps;
00069     integer rowskip;
00070     real roottol;
00071 
00072 
00073 /*  -- LAPACK routine (version 3.2)                                    -- */
00074 
00075 /*  -- Contributed by Zlatko Drmac of the University of Zagreb and     -- */
00076 /*  -- Kresimir Veselic of the Fernuniversitaet Hagen                  -- */
00077 /*  -- November 2008                                                   -- */
00078 
00079 /*  -- LAPACK is a software package provided by Univ. of Tennessee,    -- */
00080 /*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
00081 
00082 /* This routine is also part of SIGMA (version 1.23, October 23. 2008.) */
00083 /* SIGMA is a library of algorithms for highly accurate algorithms for */
00084 /* computation of SVD, PSVD, QSVD, (H,K)-SVD, and for solution of the */
00085 /* eigenvalue problems Hx = lambda M x, H M x = lambda x with H, M > 0. */
00086 
00087 /*     Scalar Arguments */
00088 
00089 
00090 /*     Array Arguments */
00091 
00092 /*     .. */
00093 
00094 /*  Purpose */
00095 /*  ~~~~~~~ */
00096 /*  SGSVJ0 is called from SGESVJ as a pre-processor and that is its main */
00097 /*  purpose. It applies Jacobi rotations in the same way as SGESVJ does, but */
00098 /*  it does not check convergence (stopping criterion). Few tuning */
00099 /*  parameters (marked by [TP]) are available for the implementer. */
00100 
00101 /*  Further details */
00102 /*  ~~~~~~~~~~~~~~~ */
00103 /*  SGSVJ0 is used just to enable SGESVJ to call a simplified version of */
00104 /*  itself to work on a submatrix of the original matrix. */
00105 
00106 /*  Contributors */
00107 /*  ~~~~~~~~~~~~ */
00108 /*  Zlatko Drmac (Zagreb, Croatia) and Kresimir Veselic (Hagen, Germany) */
00109 
00110 /*  Bugs, Examples and Comments */
00111 /*  ~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
00112 /*  Please report all bugs and send interesting test examples and comments to */
00113 /*  drmac@math.hr. Thank you. */
00114 
00115 /*  Arguments */
00116 /*  ~~~~~~~~~ */
00117 
00118 /*  JOBV    (input) CHARACTER*1 */
00119 /*          Specifies whether the output from this procedure is used */
00120 /*          to compute the matrix V: */
00121 /*          = 'V': the product of the Jacobi rotations is accumulated */
00122 /*                 by postmulyiplying the N-by-N array V. */
00123 /*                (See the description of V.) */
00124 /*          = 'A': the product of the Jacobi rotations is accumulated */
00125 /*                 by postmulyiplying the MV-by-N array V. */
00126 /*                (See the descriptions of MV and V.) */
00127 /*          = 'N': the Jacobi rotations are not accumulated. */
00128 
00129 /*  M       (input) INTEGER */
00130 /*          The number of rows of the input matrix A.  M >= 0. */
00131 
00132 /*  N       (input) INTEGER */
00133 /*          The number of columns of the input matrix A. */
00134 /*          M >= N >= 0. */
00135 
00136 /*  A       (input/output) REAL array, dimension (LDA,N) */
00137 /*          On entry, M-by-N matrix A, such that A*diag(D) represents */
00138 /*          the input matrix. */
00139 /*          On exit, */
00140 /*          A_onexit * D_onexit represents the input matrix A*diag(D) */
00141 /*          post-multiplied by a sequence of Jacobi rotations, where the */
00142 /*          rotation threshold and the total number of sweeps are given in */
00143 /*          TOL and NSWEEP, respectively. */
00144 /*          (See the descriptions of D, TOL and NSWEEP.) */
00145 
00146 /*  LDA     (input) INTEGER */
00147 /*          The leading dimension of the array A.  LDA >= max(1,M). */
00148 
00149 /*  D       (input/workspace/output) REAL array, dimension (N) */
00150 /*          The array D accumulates the scaling factors from the fast scaled */
00151 /*          Jacobi rotations. */
00152 /*          On entry, A*diag(D) represents the input matrix. */
00153 /*          On exit, A_onexit*diag(D_onexit) represents the input matrix */
00154 /*          post-multiplied by a sequence of Jacobi rotations, where the */
00155 /*          rotation threshold and the total number of sweeps are given in */
00156 /*          TOL and NSWEEP, respectively. */
00157 /*          (See the descriptions of A, TOL and NSWEEP.) */
00158 
00159 /*  SVA     (input/workspace/output) REAL array, dimension (N) */
00160 /*          On entry, SVA contains the Euclidean norms of the columns of */
00161 /*          the matrix A*diag(D). */
00162 /*          On exit, SVA contains the Euclidean norms of the columns of */
00163 /*          the matrix onexit*diag(D_onexit). */
00164 
00165 /*  MV      (input) INTEGER */
00166 /*          If JOBV .EQ. 'A', then MV rows of V are post-multipled by a */
00167 /*                           sequence of Jacobi rotations. */
00168 /*          If JOBV = 'N',   then MV is not referenced. */
00169 
00170 /*  V       (input/output) REAL array, dimension (LDV,N) */
00171 /*          If JOBV .EQ. 'V' then N rows of V are post-multipled by a */
00172 /*                           sequence of Jacobi rotations. */
00173 /*          If JOBV .EQ. 'A' then MV rows of V are post-multipled by a */
00174 /*                           sequence of Jacobi rotations. */
00175 /*          If JOBV = 'N',   then V is not referenced. */
00176 
00177 /*  LDV     (input) INTEGER */
00178 /*          The leading dimension of the array V,  LDV >= 1. */
00179 /*          If JOBV = 'V', LDV .GE. N. */
00180 /*          If JOBV = 'A', LDV .GE. MV. */
00181 
00182 /*  EPS     (input) INTEGER */
00183 /*          EPS = SLAMCH('Epsilon') */
00184 
00185 /*  SFMIN   (input) INTEGER */
00186 /*          SFMIN = SLAMCH('Safe Minimum') */
00187 
00188 /*  TOL     (input) REAL */
00189 /*          TOL is the threshold for Jacobi rotations. For a pair */
00190 /*          A(:,p), A(:,q) of pivot columns, the Jacobi rotation is */
00191 /*          applied only if ABS(COS(angle(A(:,p),A(:,q)))) .GT. TOL. */
00192 
00193 /*  NSWEEP  (input) INTEGER */
00194 /*          NSWEEP is the number of sweeps of Jacobi rotations to be */
00195 /*          performed. */
00196 
00197 /*  WORK    (workspace) REAL array, dimension LWORK. */
00198 
00199 /*  LWORK   (input) INTEGER */
00200 /*          LWORK is the dimension of WORK. LWORK .GE. M. */
00201 
00202 /*  INFO    (output) INTEGER */
00203 /*          = 0 : successful exit. */
00204 /*          < 0 : if INFO = -i, then the i-th argument had an illegal value */
00205 
00206 /*     Local Parameters */
00207 /*     Local Scalars */
00208 /*     Local Arrays */
00209 
00210 /*     Intrinsic Functions */
00211 
00212 /*     External Functions */
00213 
00214 /*     External Subroutines */
00215 
00216 /*     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| */
00217 
00218     /* Parameter adjustments */
00219     --sva;
00220     --d__;
00221     a_dim1 = *lda;
00222     a_offset = 1 + a_dim1;
00223     a -= a_offset;
00224     v_dim1 = *ldv;
00225     v_offset = 1 + v_dim1;
00226     v -= v_offset;
00227     --work;
00228 
00229     /* Function Body */
00230     applv = lsame_(jobv, "A");
00231     rsvec = lsame_(jobv, "V");
00232     if (! (rsvec || applv || lsame_(jobv, "N"))) {
00233         *info = -1;
00234     } else if (*m < 0) {
00235         *info = -2;
00236     } else if (*n < 0 || *n > *m) {
00237         *info = -3;
00238     } else if (*lda < *m) {
00239         *info = -5;
00240     } else if (*mv < 0) {
00241         *info = -8;
00242     } else if (*ldv < *m) {
00243         *info = -10;
00244     } else if (*tol <= *eps) {
00245         *info = -13;
00246     } else if (*nsweep < 0) {
00247         *info = -14;
00248     } else if (*lwork < *m) {
00249         *info = -16;
00250     } else {
00251         *info = 0;
00252     }
00253 
00254 /*     #:( */
00255     if (*info != 0) {
00256         i__1 = -(*info);
00257         xerbla_("SGSVJ0", &i__1);
00258         return 0;
00259     }
00260 
00261     if (rsvec) {
00262         mvl = *n;
00263     } else if (applv) {
00264         mvl = *mv;
00265     }
00266     rsvec = rsvec || applv;
00267     rooteps = sqrt(*eps);
00268     rootsfmin = sqrt(*sfmin);
00269     small = *sfmin / *eps;
00270     big = 1.f / *sfmin;
00271     rootbig = 1.f / rootsfmin;
00272     bigtheta = 1.f / rooteps;
00273     roottol = sqrt(*tol);
00274 
00275 
00276 /*     -#- Row-cyclic Jacobi SVD algorithm with column pivoting -#- */
00277 
00278     emptsw = *n * (*n - 1) / 2;
00279     notrot = 0;
00280     fastr[0] = 0.f;
00281 
00282 /*     -#- Row-cyclic pivot strategy with de Rijk's pivoting -#- */
00283 
00284     swband = 0;
00285 /* [TP] SWBAND is a tuning parameter. It is meaningful and effective */
00286 /*     if SGESVJ is used as a computational routine in the preconditioned */
00287 /*     Jacobi SVD algorithm SGESVJ. For sweeps i=1:SWBAND the procedure */
00288 /*     ...... */
00289     kbl = min(8,*n);
00290 /* [TP] KBL is a tuning parameter that defines the tile size in the */
00291 /*     tiling of the p-q loops of pivot pairs. In general, an optimal */
00292 /*     value of KBL depends on the matrix dimensions and on the */
00293 /*     parameters of the computer's memory. */
00294 
00295     nbl = *n / kbl;
00296     if (nbl * kbl != *n) {
00297         ++nbl;
00298     }
00299 /* Computing 2nd power */
00300     i__1 = kbl;
00301     blskip = i__1 * i__1 + 1;
00302 /* [TP] BLKSKIP is a tuning parameter that depends on SWBAND and KBL. */
00303     rowskip = min(5,kbl);
00304 /* [TP] ROWSKIP is a tuning parameter. */
00305     lkahead = 1;
00306 /* [TP] LKAHEAD is a tuning parameter. */
00307     swband = 0;
00308     pskipped = 0;
00309 
00310     i__1 = *nsweep;
00311     for (i__ = 1; i__ <= i__1; ++i__) {
00312 /*     .. go go go ... */
00313 
00314         mxaapq = 0.f;
00315         mxsinj = 0.f;
00316         iswrot = 0;
00317 
00318         notrot = 0;
00319         pskipped = 0;
00320 
00321         i__2 = nbl;
00322         for (ibr = 1; ibr <= i__2; ++ibr) {
00323             igl = (ibr - 1) * kbl + 1;
00324 
00325 /* Computing MIN */
00326             i__4 = lkahead, i__5 = nbl - ibr;
00327             i__3 = min(i__4,i__5);
00328             for (ir1 = 0; ir1 <= i__3; ++ir1) {
00329 
00330                 igl += ir1 * kbl;
00331 
00332 /* Computing MIN */
00333                 i__5 = igl + kbl - 1, i__6 = *n - 1;
00334                 i__4 = min(i__5,i__6);
00335                 for (p = igl; p <= i__4; ++p) {
00336 /*     .. de Rijk's pivoting */
00337                     i__5 = *n - p + 1;
00338                     q = isamax_(&i__5, &sva[p], &c__1) + p - 1;
00339                     if (p != q) {
00340                         sswap_(m, &a[p * a_dim1 + 1], &c__1, &a[q * a_dim1 + 
00341                                 1], &c__1);
00342                         if (rsvec) {
00343                             sswap_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q * 
00344                                     v_dim1 + 1], &c__1);
00345                         }
00346                         temp1 = sva[p];
00347                         sva[p] = sva[q];
00348                         sva[q] = temp1;
00349                         temp1 = d__[p];
00350                         d__[p] = d__[q];
00351                         d__[q] = temp1;
00352                     }
00353 
00354                     if (ir1 == 0) {
00355 
00356 /*        Column norms are periodically updated by explicit */
00357 /*        norm computation. */
00358 /*        Caveat: */
00359 /*        Some BLAS implementations compute SNRM2(M,A(1,p),1) */
00360 /*        as SQRT(SDOT(M,A(1,p),1,A(1,p),1)), which may result in */
00361 /*        overflow for ||A(:,p)||_2 > SQRT(overflow_threshold), and */
00362 /*        undeflow for ||A(:,p)||_2 < SQRT(underflow_threshold). */
00363 /*        Hence, SNRM2 cannot be trusted, not even in the case when */
00364 /*        the true norm is far from the under(over)flow boundaries. */
00365 /*        If properly implemented SNRM2 is available, the IF-THEN-ELSE */
00366 /*        below should read "AAPP = SNRM2( M, A(1,p), 1 ) * D(p)". */
00367 
00368                         if (sva[p] < rootbig && sva[p] > rootsfmin) {
00369                             sva[p] = snrm2_(m, &a[p * a_dim1 + 1], &c__1) * 
00370                                     d__[p];
00371                         } else {
00372                             temp1 = 0.f;
00373                             aapp = 0.f;
00374                             slassq_(m, &a[p * a_dim1 + 1], &c__1, &temp1, &
00375                                     aapp);
00376                             sva[p] = temp1 * sqrt(aapp) * d__[p];
00377                         }
00378                         aapp = sva[p];
00379                     } else {
00380                         aapp = sva[p];
00381                     }
00382 
00383                     if (aapp > 0.f) {
00384 
00385                         pskipped = 0;
00386 
00387 /* Computing MIN */
00388                         i__6 = igl + kbl - 1;
00389                         i__5 = min(i__6,*n);
00390                         for (q = p + 1; q <= i__5; ++q) {
00391 
00392                             aaqq = sva[q];
00393                             if (aaqq > 0.f) {
00394 
00395                                 aapp0 = aapp;
00396                                 if (aaqq >= 1.f) {
00397                                     rotok = small * aapp <= aaqq;
00398                                     if (aapp < big / aaqq) {
00399                                         aapq = sdot_(m, &a[p * a_dim1 + 1], &
00400                                                 c__1, &a[q * a_dim1 + 1], &
00401                                                 c__1) * d__[p] * d__[q] / 
00402                                                 aaqq / aapp;
00403                                     } else {
00404                                         scopy_(m, &a[p * a_dim1 + 1], &c__1, &
00405                                                 work[1], &c__1);
00406                                         slascl_("G", &c__0, &c__0, &aapp, &
00407                                                 d__[p], m, &c__1, &work[1], 
00408                                                 lda, &ierr);
00409                                         aapq = sdot_(m, &work[1], &c__1, &a[q 
00410                                                 * a_dim1 + 1], &c__1) * d__[q]
00411                                                  / aaqq;
00412                                     }
00413                                 } else {
00414                                     rotok = aapp <= aaqq / small;
00415                                     if (aapp > small / aaqq) {
00416                                         aapq = sdot_(m, &a[p * a_dim1 + 1], &
00417                                                 c__1, &a[q * a_dim1 + 1], &
00418                                                 c__1) * d__[p] * d__[q] / 
00419                                                 aaqq / aapp;
00420                                     } else {
00421                                         scopy_(m, &a[q * a_dim1 + 1], &c__1, &
00422                                                 work[1], &c__1);
00423                                         slascl_("G", &c__0, &c__0, &aaqq, &
00424                                                 d__[q], m, &c__1, &work[1], 
00425                                                 lda, &ierr);
00426                                         aapq = sdot_(m, &work[1], &c__1, &a[p 
00427                                                 * a_dim1 + 1], &c__1) * d__[p]
00428                                                  / aapp;
00429                                     }
00430                                 }
00431 
00432 /* Computing MAX */
00433                                 r__1 = mxaapq, r__2 = dabs(aapq);
00434                                 mxaapq = dmax(r__1,r__2);
00435 
00436 /*        TO rotate or NOT to rotate, THAT is the question ... */
00437 
00438                                 if (dabs(aapq) > *tol) {
00439 
00440 /*           .. rotate */
00441 /*           ROTATED = ROTATED + ONE */
00442 
00443                                     if (ir1 == 0) {
00444                                         notrot = 0;
00445                                         pskipped = 0;
00446                                         ++iswrot;
00447                                     }
00448 
00449                                     if (rotok) {
00450 
00451                                         aqoap = aaqq / aapp;
00452                                         apoaq = aapp / aaqq;
00453                                         theta = (r__1 = aqoap - apoaq, dabs(
00454                                                 r__1)) * -.5f / aapq;
00455 
00456                                         if (dabs(theta) > bigtheta) {
00457 
00458                                             t = .5f / theta;
00459                                             fastr[2] = t * d__[p] / d__[q];
00460                                             fastr[3] = -t * d__[q] / d__[p];
00461                                             srotm_(m, &a[p * a_dim1 + 1], &
00462                                                     c__1, &a[q * a_dim1 + 1], 
00463                                                     &c__1, fastr);
00464                                             if (rsvec) {
00465                           srotm_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q * 
00466                                   v_dim1 + 1], &c__1, fastr);
00467                                             }
00468 /* Computing MAX */
00469                                             r__1 = 0.f, r__2 = t * apoaq * 
00470                                                     aapq + 1.f;
00471                                             sva[q] = aaqq * sqrt((dmax(r__1,
00472                                                     r__2)));
00473                                             aapp *= sqrt(1.f - t * aqoap * 
00474                                                     aapq);
00475 /* Computing MAX */
00476                                             r__1 = mxsinj, r__2 = dabs(t);
00477                                             mxsinj = dmax(r__1,r__2);
00478 
00479                                         } else {
00480 
00481 /*                 .. choose correct signum for THETA and rotate */
00482 
00483                                             thsign = -r_sign(&c_b42, &aapq);
00484                                             t = 1.f / (theta + thsign * sqrt(
00485                                                     theta * theta + 1.f));
00486                                             cs = sqrt(1.f / (t * t + 1.f));
00487                                             sn = t * cs;
00488 
00489 /* Computing MAX */
00490                                             r__1 = mxsinj, r__2 = dabs(sn);
00491                                             mxsinj = dmax(r__1,r__2);
00492 /* Computing MAX */
00493                                             r__1 = 0.f, r__2 = t * apoaq * 
00494                                                     aapq + 1.f;
00495                                             sva[q] = aaqq * sqrt((dmax(r__1,
00496                                                     r__2)));
00497 /* Computing MAX */
00498                                             r__1 = 0.f, r__2 = 1.f - t * 
00499                                                     aqoap * aapq;
00500                                             aapp *= sqrt((dmax(r__1,r__2)));
00501 
00502                                             apoaq = d__[p] / d__[q];
00503                                             aqoap = d__[q] / d__[p];
00504                                             if (d__[p] >= 1.f) {
00505                           if (d__[q] >= 1.f) {
00506                               fastr[2] = t * apoaq;
00507                               fastr[3] = -t * aqoap;
00508                               d__[p] *= cs;
00509                               d__[q] *= cs;
00510                               srotm_(m, &a[p * a_dim1 + 1], &c__1, &a[q * 
00511                                       a_dim1 + 1], &c__1, fastr);
00512                               if (rsvec) {
00513                                   srotm_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[
00514                                           q * v_dim1 + 1], &c__1, fastr);
00515                               }
00516                           } else {
00517                               r__1 = -t * aqoap;
00518                               saxpy_(m, &r__1, &a[q * a_dim1 + 1], &c__1, &a[
00519                                       p * a_dim1 + 1], &c__1);
00520                               r__1 = cs * sn * apoaq;
00521                               saxpy_(m, &r__1, &a[p * a_dim1 + 1], &c__1, &a[
00522                                       q * a_dim1 + 1], &c__1);
00523                               d__[p] *= cs;
00524                               d__[q] /= cs;
00525                               if (rsvec) {
00526                                   r__1 = -t * aqoap;
00527                                   saxpy_(&mvl, &r__1, &v[q * v_dim1 + 1], &
00528                                           c__1, &v[p * v_dim1 + 1], &c__1);
00529                                   r__1 = cs * sn * apoaq;
00530                                   saxpy_(&mvl, &r__1, &v[p * v_dim1 + 1], &
00531                                           c__1, &v[q * v_dim1 + 1], &c__1);
00532                               }
00533                           }
00534                                             } else {
00535                           if (d__[q] >= 1.f) {
00536                               r__1 = t * apoaq;
00537                               saxpy_(m, &r__1, &a[p * a_dim1 + 1], &c__1, &a[
00538                                       q * a_dim1 + 1], &c__1);
00539                               r__1 = -cs * sn * aqoap;
00540                               saxpy_(m, &r__1, &a[q * a_dim1 + 1], &c__1, &a[
00541                                       p * a_dim1 + 1], &c__1);
00542                               d__[p] /= cs;
00543                               d__[q] *= cs;
00544                               if (rsvec) {
00545                                   r__1 = t * apoaq;
00546                                   saxpy_(&mvl, &r__1, &v[p * v_dim1 + 1], &
00547                                           c__1, &v[q * v_dim1 + 1], &c__1);
00548                                   r__1 = -cs * sn * aqoap;
00549                                   saxpy_(&mvl, &r__1, &v[q * v_dim1 + 1], &
00550                                           c__1, &v[p * v_dim1 + 1], &c__1);
00551                               }
00552                           } else {
00553                               if (d__[p] >= d__[q]) {
00554                                   r__1 = -t * aqoap;
00555                                   saxpy_(m, &r__1, &a[q * a_dim1 + 1], &c__1, 
00556                                           &a[p * a_dim1 + 1], &c__1);
00557                                   r__1 = cs * sn * apoaq;
00558                                   saxpy_(m, &r__1, &a[p * a_dim1 + 1], &c__1, 
00559                                           &a[q * a_dim1 + 1], &c__1);
00560                                   d__[p] *= cs;
00561                                   d__[q] /= cs;
00562                                   if (rsvec) {
00563                                       r__1 = -t * aqoap;
00564                                       saxpy_(&mvl, &r__1, &v[q * v_dim1 + 1], 
00565                                               &c__1, &v[p * v_dim1 + 1], &
00566                                               c__1);
00567                                       r__1 = cs * sn * apoaq;
00568                                       saxpy_(&mvl, &r__1, &v[p * v_dim1 + 1], 
00569                                               &c__1, &v[q * v_dim1 + 1], &
00570                                               c__1);
00571                                   }
00572                               } else {
00573                                   r__1 = t * apoaq;
00574                                   saxpy_(m, &r__1, &a[p * a_dim1 + 1], &c__1, 
00575                                           &a[q * a_dim1 + 1], &c__1);
00576                                   r__1 = -cs * sn * aqoap;
00577                                   saxpy_(m, &r__1, &a[q * a_dim1 + 1], &c__1, 
00578                                           &a[p * a_dim1 + 1], &c__1);
00579                                   d__[p] /= cs;
00580                                   d__[q] *= cs;
00581                                   if (rsvec) {
00582                                       r__1 = t * apoaq;
00583                                       saxpy_(&mvl, &r__1, &v[p * v_dim1 + 1], 
00584                                               &c__1, &v[q * v_dim1 + 1], &
00585                                               c__1);
00586                                       r__1 = -cs * sn * aqoap;
00587                                       saxpy_(&mvl, &r__1, &v[q * v_dim1 + 1], 
00588                                               &c__1, &v[p * v_dim1 + 1], &
00589                                               c__1);
00590                                   }
00591                               }
00592                           }
00593                                             }
00594                                         }
00595 
00596                                     } else {
00597 /*              .. have to use modified Gram-Schmidt like transformation */
00598                                         scopy_(m, &a[p * a_dim1 + 1], &c__1, &
00599                                                 work[1], &c__1);
00600                                         slascl_("G", &c__0, &c__0, &aapp, &
00601                                                 c_b42, m, &c__1, &work[1], 
00602                                                 lda, &ierr);
00603                                         slascl_("G", &c__0, &c__0, &aaqq, &
00604                                                 c_b42, m, &c__1, &a[q * 
00605                                                 a_dim1 + 1], lda, &ierr);
00606                                         temp1 = -aapq * d__[p] / d__[q];
00607                                         saxpy_(m, &temp1, &work[1], &c__1, &a[
00608                                                 q * a_dim1 + 1], &c__1);
00609                                         slascl_("G", &c__0, &c__0, &c_b42, &
00610                                                 aaqq, m, &c__1, &a[q * a_dim1 
00611                                                 + 1], lda, &ierr);
00612 /* Computing MAX */
00613                                         r__1 = 0.f, r__2 = 1.f - aapq * aapq;
00614                                         sva[q] = aaqq * sqrt((dmax(r__1,r__2))
00615                                                 );
00616                                         mxsinj = dmax(mxsinj,*sfmin);
00617                                     }
00618 /*           END IF ROTOK THEN ... ELSE */
00619 
00620 /*           In the case of cancellation in updating SVA(q), SVA(p) */
00621 /*           recompute SVA(q), SVA(p). */
00622 /* Computing 2nd power */
00623                                     r__1 = sva[q] / aaqq;
00624                                     if (r__1 * r__1 <= rooteps) {
00625                                         if (aaqq < rootbig && aaqq > 
00626                                                 rootsfmin) {
00627                                             sva[q] = snrm2_(m, &a[q * a_dim1 
00628                                                     + 1], &c__1) * d__[q];
00629                                         } else {
00630                                             t = 0.f;
00631                                             aaqq = 0.f;
00632                                             slassq_(m, &a[q * a_dim1 + 1], &
00633                                                     c__1, &t, &aaqq);
00634                                             sva[q] = t * sqrt(aaqq) * d__[q];
00635                                         }
00636                                     }
00637                                     if (aapp / aapp0 <= rooteps) {
00638                                         if (aapp < rootbig && aapp > 
00639                                                 rootsfmin) {
00640                                             aapp = snrm2_(m, &a[p * a_dim1 + 
00641                                                     1], &c__1) * d__[p];
00642                                         } else {
00643                                             t = 0.f;
00644                                             aapp = 0.f;
00645                                             slassq_(m, &a[p * a_dim1 + 1], &
00646                                                     c__1, &t, &aapp);
00647                                             aapp = t * sqrt(aapp) * d__[p];
00648                                         }
00649                                         sva[p] = aapp;
00650                                     }
00651 
00652                                 } else {
00653 /*        A(:,p) and A(:,q) already numerically orthogonal */
00654                                     if (ir1 == 0) {
00655                                         ++notrot;
00656                                     }
00657                                     ++pskipped;
00658                                 }
00659                             } else {
00660 /*        A(:,q) is zero column */
00661                                 if (ir1 == 0) {
00662                                     ++notrot;
00663                                 }
00664                                 ++pskipped;
00665                             }
00666 
00667                             if (i__ <= swband && pskipped > rowskip) {
00668                                 if (ir1 == 0) {
00669                                     aapp = -aapp;
00670                                 }
00671                                 notrot = 0;
00672                                 goto L2103;
00673                             }
00674 
00675 /* L2002: */
00676                         }
00677 /*     END q-LOOP */
00678 
00679 L2103:
00680 /*     bailed out of q-loop */
00681                         sva[p] = aapp;
00682                     } else {
00683                         sva[p] = aapp;
00684                         if (ir1 == 0 && aapp == 0.f) {
00685 /* Computing MIN */
00686                             i__5 = igl + kbl - 1;
00687                             notrot = notrot + min(i__5,*n) - p;
00688                         }
00689                     }
00690 
00691 /* L2001: */
00692                 }
00693 /*     end of the p-loop */
00694 /*     end of doing the block ( ibr, ibr ) */
00695 /* L1002: */
00696             }
00697 /*     end of ir1-loop */
00698 
00699 /* ........................................................ */
00700 /* ... go to the off diagonal blocks */
00701 
00702             igl = (ibr - 1) * kbl + 1;
00703 
00704             i__3 = nbl;
00705             for (jbc = ibr + 1; jbc <= i__3; ++jbc) {
00706 
00707                 jgl = (jbc - 1) * kbl + 1;
00708 
00709 /*        doing the block at ( ibr, jbc ) */
00710 
00711                 ijblsk = 0;
00712 /* Computing MIN */
00713                 i__5 = igl + kbl - 1;
00714                 i__4 = min(i__5,*n);
00715                 for (p = igl; p <= i__4; ++p) {
00716 
00717                     aapp = sva[p];
00718 
00719                     if (aapp > 0.f) {
00720 
00721                         pskipped = 0;
00722 
00723 /* Computing MIN */
00724                         i__6 = jgl + kbl - 1;
00725                         i__5 = min(i__6,*n);
00726                         for (q = jgl; q <= i__5; ++q) {
00727 
00728                             aaqq = sva[q];
00729 
00730                             if (aaqq > 0.f) {
00731                                 aapp0 = aapp;
00732 
00733 /*     -#- M x 2 Jacobi SVD -#- */
00734 
00735 /*        -#- Safe Gram matrix computation -#- */
00736 
00737                                 if (aaqq >= 1.f) {
00738                                     if (aapp >= aaqq) {
00739                                         rotok = small * aapp <= aaqq;
00740                                     } else {
00741                                         rotok = small * aaqq <= aapp;
00742                                     }
00743                                     if (aapp < big / aaqq) {
00744                                         aapq = sdot_(m, &a[p * a_dim1 + 1], &
00745                                                 c__1, &a[q * a_dim1 + 1], &
00746                                                 c__1) * d__[p] * d__[q] / 
00747                                                 aaqq / aapp;
00748                                     } else {
00749                                         scopy_(m, &a[p * a_dim1 + 1], &c__1, &
00750                                                 work[1], &c__1);
00751                                         slascl_("G", &c__0, &c__0, &aapp, &
00752                                                 d__[p], m, &c__1, &work[1], 
00753                                                 lda, &ierr);
00754                                         aapq = sdot_(m, &work[1], &c__1, &a[q 
00755                                                 * a_dim1 + 1], &c__1) * d__[q]
00756                                                  / aaqq;
00757                                     }
00758                                 } else {
00759                                     if (aapp >= aaqq) {
00760                                         rotok = aapp <= aaqq / small;
00761                                     } else {
00762                                         rotok = aaqq <= aapp / small;
00763                                     }
00764                                     if (aapp > small / aaqq) {
00765                                         aapq = sdot_(m, &a[p * a_dim1 + 1], &
00766                                                 c__1, &a[q * a_dim1 + 1], &
00767                                                 c__1) * d__[p] * d__[q] / 
00768                                                 aaqq / aapp;
00769                                     } else {
00770                                         scopy_(m, &a[q * a_dim1 + 1], &c__1, &
00771                                                 work[1], &c__1);
00772                                         slascl_("G", &c__0, &c__0, &aaqq, &
00773                                                 d__[q], m, &c__1, &work[1], 
00774                                                 lda, &ierr);
00775                                         aapq = sdot_(m, &work[1], &c__1, &a[p 
00776                                                 * a_dim1 + 1], &c__1) * d__[p]
00777                                                  / aapp;
00778                                     }
00779                                 }
00780 
00781 /* Computing MAX */
00782                                 r__1 = mxaapq, r__2 = dabs(aapq);
00783                                 mxaapq = dmax(r__1,r__2);
00784 
00785 /*        TO rotate or NOT to rotate, THAT is the question ... */
00786 
00787                                 if (dabs(aapq) > *tol) {
00788                                     notrot = 0;
00789 /*           ROTATED  = ROTATED + 1 */
00790                                     pskipped = 0;
00791                                     ++iswrot;
00792 
00793                                     if (rotok) {
00794 
00795                                         aqoap = aaqq / aapp;
00796                                         apoaq = aapp / aaqq;
00797                                         theta = (r__1 = aqoap - apoaq, dabs(
00798                                                 r__1)) * -.5f / aapq;
00799                                         if (aaqq > aapp0) {
00800                                             theta = -theta;
00801                                         }
00802 
00803                                         if (dabs(theta) > bigtheta) {
00804                                             t = .5f / theta;
00805                                             fastr[2] = t * d__[p] / d__[q];
00806                                             fastr[3] = -t * d__[q] / d__[p];
00807                                             srotm_(m, &a[p * a_dim1 + 1], &
00808                                                     c__1, &a[q * a_dim1 + 1], 
00809                                                     &c__1, fastr);
00810                                             if (rsvec) {
00811                           srotm_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q * 
00812                                   v_dim1 + 1], &c__1, fastr);
00813                                             }
00814 /* Computing MAX */
00815                                             r__1 = 0.f, r__2 = t * apoaq * 
00816                                                     aapq + 1.f;
00817                                             sva[q] = aaqq * sqrt((dmax(r__1,
00818                                                     r__2)));
00819 /* Computing MAX */
00820                                             r__1 = 0.f, r__2 = 1.f - t * 
00821                                                     aqoap * aapq;
00822                                             aapp *= sqrt((dmax(r__1,r__2)));
00823 /* Computing MAX */
00824                                             r__1 = mxsinj, r__2 = dabs(t);
00825                                             mxsinj = dmax(r__1,r__2);
00826                                         } else {
00827 
00828 /*                 .. choose correct signum for THETA and rotate */
00829 
00830                                             thsign = -r_sign(&c_b42, &aapq);
00831                                             if (aaqq > aapp0) {
00832                           thsign = -thsign;
00833                                             }
00834                                             t = 1.f / (theta + thsign * sqrt(
00835                                                     theta * theta + 1.f));
00836                                             cs = sqrt(1.f / (t * t + 1.f));
00837                                             sn = t * cs;
00838 /* Computing MAX */
00839                                             r__1 = mxsinj, r__2 = dabs(sn);
00840                                             mxsinj = dmax(r__1,r__2);
00841 /* Computing MAX */
00842                                             r__1 = 0.f, r__2 = t * apoaq * 
00843                                                     aapq + 1.f;
00844                                             sva[q] = aaqq * sqrt((dmax(r__1,
00845                                                     r__2)));
00846                                             aapp *= sqrt(1.f - t * aqoap * 
00847                                                     aapq);
00848 
00849                                             apoaq = d__[p] / d__[q];
00850                                             aqoap = d__[q] / d__[p];
00851                                             if (d__[p] >= 1.f) {
00852 
00853                           if (d__[q] >= 1.f) {
00854                               fastr[2] = t * apoaq;
00855                               fastr[3] = -t * aqoap;
00856                               d__[p] *= cs;
00857                               d__[q] *= cs;
00858                               srotm_(m, &a[p * a_dim1 + 1], &c__1, &a[q * 
00859                                       a_dim1 + 1], &c__1, fastr);
00860                               if (rsvec) {
00861                                   srotm_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[
00862                                           q * v_dim1 + 1], &c__1, fastr);
00863                               }
00864                           } else {
00865                               r__1 = -t * aqoap;
00866                               saxpy_(m, &r__1, &a[q * a_dim1 + 1], &c__1, &a[
00867                                       p * a_dim1 + 1], &c__1);
00868                               r__1 = cs * sn * apoaq;
00869                               saxpy_(m, &r__1, &a[p * a_dim1 + 1], &c__1, &a[
00870                                       q * a_dim1 + 1], &c__1);
00871                               if (rsvec) {
00872                                   r__1 = -t * aqoap;
00873                                   saxpy_(&mvl, &r__1, &v[q * v_dim1 + 1], &
00874                                           c__1, &v[p * v_dim1 + 1], &c__1);
00875                                   r__1 = cs * sn * apoaq;
00876                                   saxpy_(&mvl, &r__1, &v[p * v_dim1 + 1], &
00877                                           c__1, &v[q * v_dim1 + 1], &c__1);
00878                               }
00879                               d__[p] *= cs;
00880                               d__[q] /= cs;
00881                           }
00882                                             } else {
00883                           if (d__[q] >= 1.f) {
00884                               r__1 = t * apoaq;
00885                               saxpy_(m, &r__1, &a[p * a_dim1 + 1], &c__1, &a[
00886                                       q * a_dim1 + 1], &c__1);
00887                               r__1 = -cs * sn * aqoap;
00888                               saxpy_(m, &r__1, &a[q * a_dim1 + 1], &c__1, &a[
00889                                       p * a_dim1 + 1], &c__1);
00890                               if (rsvec) {
00891                                   r__1 = t * apoaq;
00892                                   saxpy_(&mvl, &r__1, &v[p * v_dim1 + 1], &
00893                                           c__1, &v[q * v_dim1 + 1], &c__1);
00894                                   r__1 = -cs * sn * aqoap;
00895                                   saxpy_(&mvl, &r__1, &v[q * v_dim1 + 1], &
00896                                           c__1, &v[p * v_dim1 + 1], &c__1);
00897                               }
00898                               d__[p] /= cs;
00899                               d__[q] *= cs;
00900                           } else {
00901                               if (d__[p] >= d__[q]) {
00902                                   r__1 = -t * aqoap;
00903                                   saxpy_(m, &r__1, &a[q * a_dim1 + 1], &c__1, 
00904                                           &a[p * a_dim1 + 1], &c__1);
00905                                   r__1 = cs * sn * apoaq;
00906                                   saxpy_(m, &r__1, &a[p * a_dim1 + 1], &c__1, 
00907                                           &a[q * a_dim1 + 1], &c__1);
00908                                   d__[p] *= cs;
00909                                   d__[q] /= cs;
00910                                   if (rsvec) {
00911                                       r__1 = -t * aqoap;
00912                                       saxpy_(&mvl, &r__1, &v[q * v_dim1 + 1], 
00913                                               &c__1, &v[p * v_dim1 + 1], &
00914                                               c__1);
00915                                       r__1 = cs * sn * apoaq;
00916                                       saxpy_(&mvl, &r__1, &v[p * v_dim1 + 1], 
00917                                               &c__1, &v[q * v_dim1 + 1], &
00918                                               c__1);
00919                                   }
00920                               } else {
00921                                   r__1 = t * apoaq;
00922                                   saxpy_(m, &r__1, &a[p * a_dim1 + 1], &c__1, 
00923                                           &a[q * a_dim1 + 1], &c__1);
00924                                   r__1 = -cs * sn * aqoap;
00925                                   saxpy_(m, &r__1, &a[q * a_dim1 + 1], &c__1, 
00926                                           &a[p * a_dim1 + 1], &c__1);
00927                                   d__[p] /= cs;
00928                                   d__[q] *= cs;
00929                                   if (rsvec) {
00930                                       r__1 = t * apoaq;
00931                                       saxpy_(&mvl, &r__1, &v[p * v_dim1 + 1], 
00932                                               &c__1, &v[q * v_dim1 + 1], &
00933                                               c__1);
00934                                       r__1 = -cs * sn * aqoap;
00935                                       saxpy_(&mvl, &r__1, &v[q * v_dim1 + 1], 
00936                                               &c__1, &v[p * v_dim1 + 1], &
00937                                               c__1);
00938                                   }
00939                               }
00940                           }
00941                                             }
00942                                         }
00943 
00944                                     } else {
00945                                         if (aapp > aaqq) {
00946                                             scopy_(m, &a[p * a_dim1 + 1], &
00947                                                     c__1, &work[1], &c__1);
00948                                             slascl_("G", &c__0, &c__0, &aapp, 
00949                                                     &c_b42, m, &c__1, &work[1]
00950 , lda, &ierr);
00951                                             slascl_("G", &c__0, &c__0, &aaqq, 
00952                                                     &c_b42, m, &c__1, &a[q * 
00953                                                     a_dim1 + 1], lda, &ierr);
00954                                             temp1 = -aapq * d__[p] / d__[q];
00955                                             saxpy_(m, &temp1, &work[1], &c__1, 
00956                                                      &a[q * a_dim1 + 1], &
00957                                                     c__1);
00958                                             slascl_("G", &c__0, &c__0, &c_b42, 
00959                                                      &aaqq, m, &c__1, &a[q * 
00960                                                     a_dim1 + 1], lda, &ierr);
00961 /* Computing MAX */
00962                                             r__1 = 0.f, r__2 = 1.f - aapq * 
00963                                                     aapq;
00964                                             sva[q] = aaqq * sqrt((dmax(r__1,
00965                                                     r__2)));
00966                                             mxsinj = dmax(mxsinj,*sfmin);
00967                                         } else {
00968                                             scopy_(m, &a[q * a_dim1 + 1], &
00969                                                     c__1, &work[1], &c__1);
00970                                             slascl_("G", &c__0, &c__0, &aaqq, 
00971                                                     &c_b42, m, &c__1, &work[1]
00972 , lda, &ierr);
00973                                             slascl_("G", &c__0, &c__0, &aapp, 
00974                                                     &c_b42, m, &c__1, &a[p * 
00975                                                     a_dim1 + 1], lda, &ierr);
00976                                             temp1 = -aapq * d__[q] / d__[p];
00977                                             saxpy_(m, &temp1, &work[1], &c__1, 
00978                                                      &a[p * a_dim1 + 1], &
00979                                                     c__1);
00980                                             slascl_("G", &c__0, &c__0, &c_b42, 
00981                                                      &aapp, m, &c__1, &a[p * 
00982                                                     a_dim1 + 1], lda, &ierr);
00983 /* Computing MAX */
00984                                             r__1 = 0.f, r__2 = 1.f - aapq * 
00985                                                     aapq;
00986                                             sva[p] = aapp * sqrt((dmax(r__1,
00987                                                     r__2)));
00988                                             mxsinj = dmax(mxsinj,*sfmin);
00989                                         }
00990                                     }
00991 /*           END IF ROTOK THEN ... ELSE */
00992 
00993 /*           In the case of cancellation in updating SVA(q) */
00994 /*           .. recompute SVA(q) */
00995 /* Computing 2nd power */
00996                                     r__1 = sva[q] / aaqq;
00997                                     if (r__1 * r__1 <= rooteps) {
00998                                         if (aaqq < rootbig && aaqq > 
00999                                                 rootsfmin) {
01000                                             sva[q] = snrm2_(m, &a[q * a_dim1 
01001                                                     + 1], &c__1) * d__[q];
01002                                         } else {
01003                                             t = 0.f;
01004                                             aaqq = 0.f;
01005                                             slassq_(m, &a[q * a_dim1 + 1], &
01006                                                     c__1, &t, &aaqq);
01007                                             sva[q] = t * sqrt(aaqq) * d__[q];
01008                                         }
01009                                     }
01010 /* Computing 2nd power */
01011                                     r__1 = aapp / aapp0;
01012                                     if (r__1 * r__1 <= rooteps) {
01013                                         if (aapp < rootbig && aapp > 
01014                                                 rootsfmin) {
01015                                             aapp = snrm2_(m, &a[p * a_dim1 + 
01016                                                     1], &c__1) * d__[p];
01017                                         } else {
01018                                             t = 0.f;
01019                                             aapp = 0.f;
01020                                             slassq_(m, &a[p * a_dim1 + 1], &
01021                                                     c__1, &t, &aapp);
01022                                             aapp = t * sqrt(aapp) * d__[p];
01023                                         }
01024                                         sva[p] = aapp;
01025                                     }
01026 /*              end of OK rotation */
01027                                 } else {
01028                                     ++notrot;
01029                                     ++pskipped;
01030                                     ++ijblsk;
01031                                 }
01032                             } else {
01033                                 ++notrot;
01034                                 ++pskipped;
01035                                 ++ijblsk;
01036                             }
01037 
01038                             if (i__ <= swband && ijblsk >= blskip) {
01039                                 sva[p] = aapp;
01040                                 notrot = 0;
01041                                 goto L2011;
01042                             }
01043                             if (i__ <= swband && pskipped > rowskip) {
01044                                 aapp = -aapp;
01045                                 notrot = 0;
01046                                 goto L2203;
01047                             }
01048 
01049 /* L2200: */
01050                         }
01051 /*        end of the q-loop */
01052 L2203:
01053 
01054                         sva[p] = aapp;
01055 
01056                     } else {
01057                         if (aapp == 0.f) {
01058 /* Computing MIN */
01059                             i__5 = jgl + kbl - 1;
01060                             notrot = notrot + min(i__5,*n) - jgl + 1;
01061                         }
01062                         if (aapp < 0.f) {
01063                             notrot = 0;
01064                         }
01065                     }
01066 /* L2100: */
01067                 }
01068 /*     end of the p-loop */
01069 /* L2010: */
01070             }
01071 /*     end of the jbc-loop */
01072 L2011:
01073 /* 2011 bailed out of the jbc-loop */
01074 /* Computing MIN */
01075             i__4 = igl + kbl - 1;
01076             i__3 = min(i__4,*n);
01077             for (p = igl; p <= i__3; ++p) {
01078                 sva[p] = (r__1 = sva[p], dabs(r__1));
01079 /* L2012: */
01080             }
01081 
01082 /* L2000: */
01083         }
01084 /* 2000 :: end of the ibr-loop */
01085 
01086 /*     .. update SVA(N) */
01087         if (sva[*n] < rootbig && sva[*n] > rootsfmin) {
01088             sva[*n] = snrm2_(m, &a[*n * a_dim1 + 1], &c__1) * d__[*n];
01089         } else {
01090             t = 0.f;
01091             aapp = 0.f;
01092             slassq_(m, &a[*n * a_dim1 + 1], &c__1, &t, &aapp);
01093             sva[*n] = t * sqrt(aapp) * d__[*n];
01094         }
01095 
01096 /*     Additional steering devices */
01097 
01098         if (i__ < swband && (mxaapq <= roottol || iswrot <= *n)) {
01099             swband = i__;
01100         }
01101 
01102         if (i__ > swband + 1 && mxaapq < (real) (*n) * *tol && (real) (*n) * 
01103                 mxaapq * mxsinj < *tol) {
01104             goto L1994;
01105         }
01106 
01107         if (notrot >= emptsw) {
01108             goto L1994;
01109         }
01110 /* L1993: */
01111     }
01112 /*     end i=1:NSWEEP loop */
01113 /* #:) Reaching this point means that the procedure has comleted the given */
01114 /*     number of iterations. */
01115     *info = *nsweep - 1;
01116     goto L1995;
01117 L1994:
01118 /* #:) Reaching this point means that during the i-th sweep all pivots were */
01119 /*     below the given tolerance, causing early exit. */
01120 
01121     *info = 0;
01122 /* #:) INFO = 0 confirms successful iterations. */
01123 L1995:
01124 
01125 /*     Sort the vector D. */
01126     i__1 = *n - 1;
01127     for (p = 1; p <= i__1; ++p) {
01128         i__2 = *n - p + 1;
01129         q = isamax_(&i__2, &sva[p], &c__1) + p - 1;
01130         if (p != q) {
01131             temp1 = sva[p];
01132             sva[p] = sva[q];
01133             sva[q] = temp1;
01134             temp1 = d__[p];
01135             d__[p] = d__[q];
01136             d__[q] = temp1;
01137             sswap_(m, &a[p * a_dim1 + 1], &c__1, &a[q * a_dim1 + 1], &c__1);
01138             if (rsvec) {
01139                 sswap_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q * v_dim1 + 1], &
01140                         c__1);
01141             }
01142         }
01143 /* L5991: */
01144     }
01145 
01146     return 0;
01147 /*     .. */
01148 /*     .. END OF SGSVJ0 */
01149 /*     .. */
01150 } /* sgsvj0_ */


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