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


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