zgesvd.c
Go to the documentation of this file.
00001 /* zgesvd.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 doublecomplex c_b1 = {0.,0.};
00019 static doublecomplex c_b2 = {1.,0.};
00020 static integer c__6 = 6;
00021 static integer c__0 = 0;
00022 static integer c__2 = 2;
00023 static integer c__1 = 1;
00024 static integer c_n1 = -1;
00025 
00026 /* Subroutine */ int zgesvd_(char *jobu, char *jobvt, integer *m, integer *n, 
00027         doublecomplex *a, integer *lda, doublereal *s, doublecomplex *u, 
00028         integer *ldu, doublecomplex *vt, integer *ldvt, doublecomplex *work, 
00029         integer *lwork, doublereal *rwork, integer *info)
00030 {
00031     /* System generated locals */
00032     address a__1[2];
00033     integer a_dim1, a_offset, u_dim1, u_offset, vt_dim1, vt_offset, i__1[2], 
00034             i__2, i__3, i__4;
00035     char ch__1[2];
00036 
00037     /* Builtin functions */
00038     /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen);
00039     double sqrt(doublereal);
00040 
00041     /* Local variables */
00042     integer i__, ie, ir, iu, blk, ncu;
00043     doublereal dum[1], eps;
00044     integer nru;
00045     doublecomplex cdum[1];
00046     integer iscl;
00047     doublereal anrm;
00048     integer ierr, itau, ncvt, nrvt;
00049     extern logical lsame_(char *, char *);
00050     integer chunk, minmn;
00051     extern /* Subroutine */ int zgemm_(char *, char *, integer *, integer *, 
00052             integer *, doublecomplex *, doublecomplex *, integer *, 
00053             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00054             integer *);
00055     integer wrkbl, itaup, itauq, mnthr, iwork;
00056     logical wntua, wntva, wntun, wntuo, wntvn, wntvo, wntus, wntvs;
00057     extern doublereal dlamch_(char *);
00058     extern /* Subroutine */ int dlascl_(char *, integer *, integer *, 
00059             doublereal *, doublereal *, integer *, integer *, doublereal *, 
00060             integer *, integer *), xerbla_(char *, integer *),
00061              zgebrd_(integer *, integer *, doublecomplex *, integer *, 
00062             doublereal *, doublereal *, doublecomplex *, doublecomplex *, 
00063             doublecomplex *, integer *, integer *);
00064     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00065             integer *, integer *);
00066     extern doublereal zlange_(char *, integer *, integer *, doublecomplex *, 
00067             integer *, doublereal *);
00068     doublereal bignum;
00069     extern /* Subroutine */ int zgelqf_(integer *, integer *, doublecomplex *, 
00070              integer *, doublecomplex *, doublecomplex *, integer *, integer *
00071 ), zlascl_(char *, integer *, integer *, doublereal *, doublereal 
00072             *, integer *, integer *, doublecomplex *, integer *, integer *), zgeqrf_(integer *, integer *, doublecomplex *, integer *, 
00073              doublecomplex *, doublecomplex *, integer *, integer *), zlacpy_(
00074             char *, integer *, integer *, doublecomplex *, integer *, 
00075             doublecomplex *, integer *), zlaset_(char *, integer *, 
00076             integer *, doublecomplex *, doublecomplex *, doublecomplex *, 
00077             integer *);
00078     integer ldwrkr;
00079     extern /* Subroutine */ int zbdsqr_(char *, integer *, integer *, integer 
00080             *, integer *, doublereal *, doublereal *, doublecomplex *, 
00081             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00082              doublereal *, integer *);
00083     integer minwrk, ldwrku, maxwrk;
00084     extern /* Subroutine */ int zungbr_(char *, integer *, integer *, integer 
00085             *, doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00086             integer *, integer *);
00087     doublereal smlnum;
00088     integer irwork;
00089     extern /* Subroutine */ int zunmbr_(char *, char *, char *, integer *, 
00090             integer *, integer *, doublecomplex *, integer *, doublecomplex *, 
00091              doublecomplex *, integer *, doublecomplex *, integer *, integer *
00092 ), zunglq_(integer *, integer *, integer *
00093 , doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00094             integer *, integer *);
00095     logical lquery, wntuas, wntvas;
00096     extern /* Subroutine */ int zungqr_(integer *, integer *, integer *, 
00097             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00098             integer *, integer *);
00099 
00100 
00101 /*  -- LAPACK driver routine (version 3.2) -- */
00102 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00103 /*     November 2006 */
00104 
00105 /*     .. Scalar Arguments .. */
00106 /*     .. */
00107 /*     .. Array Arguments .. */
00108 /*     .. */
00109 
00110 /*  Purpose */
00111 /*  ======= */
00112 
00113 /*  ZGESVD computes the singular value decomposition (SVD) of a complex */
00114 /*  M-by-N matrix A, optionally computing the left and/or right singular */
00115 /*  vectors. The SVD is written */
00116 
00117 /*       A = U * SIGMA * conjugate-transpose(V) */
00118 
00119 /*  where SIGMA is an M-by-N matrix which is zero except for its */
00120 /*  min(m,n) diagonal elements, U is an M-by-M unitary matrix, and */
00121 /*  V is an N-by-N unitary matrix.  The diagonal elements of SIGMA */
00122 /*  are the singular values of A; they are real and non-negative, and */
00123 /*  are returned in descending order.  The first min(m,n) columns of */
00124 /*  U and V are the left and right singular vectors of A. */
00125 
00126 /*  Note that the routine returns V**H, not V. */
00127 
00128 /*  Arguments */
00129 /*  ========= */
00130 
00131 /*  JOBU    (input) CHARACTER*1 */
00132 /*          Specifies options for computing all or part of the matrix U: */
00133 /*          = 'A':  all M columns of U are returned in array U: */
00134 /*          = 'S':  the first min(m,n) columns of U (the left singular */
00135 /*                  vectors) are returned in the array U; */
00136 /*          = 'O':  the first min(m,n) columns of U (the left singular */
00137 /*                  vectors) are overwritten on the array A; */
00138 /*          = 'N':  no columns of U (no left singular vectors) are */
00139 /*                  computed. */
00140 
00141 /*  JOBVT   (input) CHARACTER*1 */
00142 /*          Specifies options for computing all or part of the matrix */
00143 /*          V**H: */
00144 /*          = 'A':  all N rows of V**H are returned in the array VT; */
00145 /*          = 'S':  the first min(m,n) rows of V**H (the right singular */
00146 /*                  vectors) are returned in the array VT; */
00147 /*          = 'O':  the first min(m,n) rows of V**H (the right singular */
00148 /*                  vectors) are overwritten on the array A; */
00149 /*          = 'N':  no rows of V**H (no right singular vectors) are */
00150 /*                  computed. */
00151 
00152 /*          JOBVT and JOBU cannot both be 'O'. */
00153 
00154 /*  M       (input) INTEGER */
00155 /*          The number of rows of the input matrix A.  M >= 0. */
00156 
00157 /*  N       (input) INTEGER */
00158 /*          The number of columns of the input matrix A.  N >= 0. */
00159 
00160 /*  A       (input/output) COMPLEX*16 array, dimension (LDA,N) */
00161 /*          On entry, the M-by-N matrix A. */
00162 /*          On exit, */
00163 /*          if JOBU = 'O',  A is overwritten with the first min(m,n) */
00164 /*                          columns of U (the left singular vectors, */
00165 /*                          stored columnwise); */
00166 /*          if JOBVT = 'O', A is overwritten with the first min(m,n) */
00167 /*                          rows of V**H (the right singular vectors, */
00168 /*                          stored rowwise); */
00169 /*          if JOBU .ne. 'O' and JOBVT .ne. 'O', the contents of A */
00170 /*                          are destroyed. */
00171 
00172 /*  LDA     (input) INTEGER */
00173 /*          The leading dimension of the array A.  LDA >= max(1,M). */
00174 
00175 /*  S       (output) DOUBLE PRECISION array, dimension (min(M,N)) */
00176 /*          The singular values of A, sorted so that S(i) >= S(i+1). */
00177 
00178 /*  U       (output) COMPLEX*16 array, dimension (LDU,UCOL) */
00179 /*          (LDU,M) if JOBU = 'A' or (LDU,min(M,N)) if JOBU = 'S'. */
00180 /*          If JOBU = 'A', U contains the M-by-M unitary matrix U; */
00181 /*          if JOBU = 'S', U contains the first min(m,n) columns of U */
00182 /*          (the left singular vectors, stored columnwise); */
00183 /*          if JOBU = 'N' or 'O', U is not referenced. */
00184 
00185 /*  LDU     (input) INTEGER */
00186 /*          The leading dimension of the array U.  LDU >= 1; if */
00187 /*          JOBU = 'S' or 'A', LDU >= M. */
00188 
00189 /*  VT      (output) COMPLEX*16 array, dimension (LDVT,N) */
00190 /*          If JOBVT = 'A', VT contains the N-by-N unitary matrix */
00191 /*          V**H; */
00192 /*          if JOBVT = 'S', VT contains the first min(m,n) rows of */
00193 /*          V**H (the right singular vectors, stored rowwise); */
00194 /*          if JOBVT = 'N' or 'O', VT is not referenced. */
00195 
00196 /*  LDVT    (input) INTEGER */
00197 /*          The leading dimension of the array VT.  LDVT >= 1; if */
00198 /*          JOBVT = 'A', LDVT >= N; if JOBVT = 'S', LDVT >= min(M,N). */
00199 
00200 /*  WORK    (workspace/output) COMPLEX*16 array, dimension (MAX(1,LWORK)) */
00201 /*          On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
00202 
00203 /*  LWORK   (input) INTEGER */
00204 /*          The dimension of the array WORK. */
00205 /*          LWORK >=  MAX(1,2*MIN(M,N)+MAX(M,N)). */
00206 /*          For good performance, LWORK should generally be larger. */
00207 
00208 /*          If LWORK = -1, then a workspace query is assumed; the routine */
00209 /*          only calculates the optimal size of the WORK array, returns */
00210 /*          this value as the first entry of the WORK array, and no error */
00211 /*          message related to LWORK is issued by XERBLA. */
00212 
00213 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (5*min(M,N)) */
00214 /*          On exit, if INFO > 0, RWORK(1:MIN(M,N)-1) contains the */
00215 /*          unconverged superdiagonal elements of an upper bidiagonal */
00216 /*          matrix B whose diagonal is in S (not necessarily sorted). */
00217 /*          B satisfies A = U * B * VT, so it has the same singular */
00218 /*          values as A, and singular vectors related by U and VT. */
00219 
00220 /*  INFO    (output) INTEGER */
00221 /*          = 0:  successful exit. */
00222 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00223 /*          > 0:  if ZBDSQR did not converge, INFO specifies how many */
00224 /*                superdiagonals of an intermediate bidiagonal form B */
00225 /*                did not converge to zero. See the description of RWORK */
00226 /*                above for details. */
00227 
00228 /*  ===================================================================== */
00229 
00230 /*     .. Parameters .. */
00231 /*     .. */
00232 /*     .. Local Scalars .. */
00233 /*     .. */
00234 /*     .. Local Arrays .. */
00235 /*     .. */
00236 /*     .. External Subroutines .. */
00237 /*     .. */
00238 /*     .. External Functions .. */
00239 /*     .. */
00240 /*     .. Intrinsic Functions .. */
00241 /*     .. */
00242 /*     .. Executable Statements .. */
00243 
00244 /*     Test the input arguments */
00245 
00246     /* Parameter adjustments */
00247     a_dim1 = *lda;
00248     a_offset = 1 + a_dim1;
00249     a -= a_offset;
00250     --s;
00251     u_dim1 = *ldu;
00252     u_offset = 1 + u_dim1;
00253     u -= u_offset;
00254     vt_dim1 = *ldvt;
00255     vt_offset = 1 + vt_dim1;
00256     vt -= vt_offset;
00257     --work;
00258     --rwork;
00259 
00260     /* Function Body */
00261     *info = 0;
00262     minmn = min(*m,*n);
00263     wntua = lsame_(jobu, "A");
00264     wntus = lsame_(jobu, "S");
00265     wntuas = wntua || wntus;
00266     wntuo = lsame_(jobu, "O");
00267     wntun = lsame_(jobu, "N");
00268     wntva = lsame_(jobvt, "A");
00269     wntvs = lsame_(jobvt, "S");
00270     wntvas = wntva || wntvs;
00271     wntvo = lsame_(jobvt, "O");
00272     wntvn = lsame_(jobvt, "N");
00273     lquery = *lwork == -1;
00274 
00275     if (! (wntua || wntus || wntuo || wntun)) {
00276         *info = -1;
00277     } else if (! (wntva || wntvs || wntvo || wntvn) || wntvo && wntuo) {
00278         *info = -2;
00279     } else if (*m < 0) {
00280         *info = -3;
00281     } else if (*n < 0) {
00282         *info = -4;
00283     } else if (*lda < max(1,*m)) {
00284         *info = -6;
00285     } else if (*ldu < 1 || wntuas && *ldu < *m) {
00286         *info = -9;
00287     } else if (*ldvt < 1 || wntva && *ldvt < *n || wntvs && *ldvt < minmn) {
00288         *info = -11;
00289     }
00290 
00291 /*     Compute workspace */
00292 /*      (Note: Comments in the code beginning "Workspace:" describe the */
00293 /*       minimal amount of workspace needed at that point in the code, */
00294 /*       as well as the preferred amount for good performance. */
00295 /*       CWorkspace refers to complex workspace, and RWorkspace to */
00296 /*       real workspace. NB refers to the optimal block size for the */
00297 /*       immediately following subroutine, as returned by ILAENV.) */
00298 
00299     if (*info == 0) {
00300         minwrk = 1;
00301         maxwrk = 1;
00302         if (*m >= *n && minmn > 0) {
00303 
00304 /*           Space needed for ZBDSQR is BDSPAC = 5*N */
00305 
00306 /* Writing concatenation */
00307             i__1[0] = 1, a__1[0] = jobu;
00308             i__1[1] = 1, a__1[1] = jobvt;
00309             s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2);
00310             mnthr = ilaenv_(&c__6, "ZGESVD", ch__1, m, n, &c__0, &c__0);
00311             if (*m >= mnthr) {
00312                 if (wntun) {
00313 
00314 /*                 Path 1 (M much larger than N, JOBU='N') */
00315 
00316                     maxwrk = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00317                             c_n1, &c_n1);
00318 /* Computing MAX */
00319                     i__2 = maxwrk, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00320                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00321                     maxwrk = max(i__2,i__3);
00322                     if (wntvo || wntvas) {
00323 /* Computing MAX */
00324                         i__2 = maxwrk, i__3 = (*n << 1) + (*n - 1) * ilaenv_(&
00325                                 c__1, "ZUNGBR", "P", n, n, n, &c_n1);
00326                         maxwrk = max(i__2,i__3);
00327                     }
00328                     minwrk = *n * 3;
00329                 } else if (wntuo && wntvn) {
00330 
00331 /*                 Path 2 (M much larger than N, JOBU='O', JOBVT='N') */
00332 
00333                     wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00334                             c_n1, &c_n1);
00335 /* Computing MAX */
00336                     i__2 = wrkbl, i__3 = *n + *n * ilaenv_(&c__1, "ZUNGQR", 
00337                             " ", m, n, n, &c_n1);
00338                     wrkbl = max(i__2,i__3);
00339 /* Computing MAX */
00340                     i__2 = wrkbl, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00341                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00342                     wrkbl = max(i__2,i__3);
00343 /* Computing MAX */
00344                     i__2 = wrkbl, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00345                             "ZUNGBR", "Q", n, n, n, &c_n1);
00346                     wrkbl = max(i__2,i__3);
00347 /* Computing MAX */
00348                     i__2 = *n * *n + wrkbl, i__3 = *n * *n + *m * *n;
00349                     maxwrk = max(i__2,i__3);
00350                     minwrk = (*n << 1) + *m;
00351                 } else if (wntuo && wntvas) {
00352 
00353 /*                 Path 3 (M much larger than N, JOBU='O', JOBVT='S' or */
00354 /*                 'A') */
00355 
00356                     wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00357                             c_n1, &c_n1);
00358 /* Computing MAX */
00359                     i__2 = wrkbl, i__3 = *n + *n * ilaenv_(&c__1, "ZUNGQR", 
00360                             " ", m, n, n, &c_n1);
00361                     wrkbl = max(i__2,i__3);
00362 /* Computing MAX */
00363                     i__2 = wrkbl, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00364                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00365                     wrkbl = max(i__2,i__3);
00366 /* Computing MAX */
00367                     i__2 = wrkbl, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00368                             "ZUNGBR", "Q", n, n, n, &c_n1);
00369                     wrkbl = max(i__2,i__3);
00370 /* Computing MAX */
00371                     i__2 = wrkbl, i__3 = (*n << 1) + (*n - 1) * ilaenv_(&c__1, 
00372                              "ZUNGBR", "P", n, n, n, &c_n1);
00373                     wrkbl = max(i__2,i__3);
00374 /* Computing MAX */
00375                     i__2 = *n * *n + wrkbl, i__3 = *n * *n + *m * *n;
00376                     maxwrk = max(i__2,i__3);
00377                     minwrk = (*n << 1) + *m;
00378                 } else if (wntus && wntvn) {
00379 
00380 /*                 Path 4 (M much larger than N, JOBU='S', JOBVT='N') */
00381 
00382                     wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00383                             c_n1, &c_n1);
00384 /* Computing MAX */
00385                     i__2 = wrkbl, i__3 = *n + *n * ilaenv_(&c__1, "ZUNGQR", 
00386                             " ", m, n, n, &c_n1);
00387                     wrkbl = max(i__2,i__3);
00388 /* Computing MAX */
00389                     i__2 = wrkbl, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00390                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00391                     wrkbl = max(i__2,i__3);
00392 /* Computing MAX */
00393                     i__2 = wrkbl, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00394                             "ZUNGBR", "Q", n, n, n, &c_n1);
00395                     wrkbl = max(i__2,i__3);
00396                     maxwrk = *n * *n + wrkbl;
00397                     minwrk = (*n << 1) + *m;
00398                 } else if (wntus && wntvo) {
00399 
00400 /*                 Path 5 (M much larger than N, JOBU='S', JOBVT='O') */
00401 
00402                     wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00403                             c_n1, &c_n1);
00404 /* Computing MAX */
00405                     i__2 = wrkbl, i__3 = *n + *n * ilaenv_(&c__1, "ZUNGQR", 
00406                             " ", m, n, n, &c_n1);
00407                     wrkbl = max(i__2,i__3);
00408 /* Computing MAX */
00409                     i__2 = wrkbl, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00410                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00411                     wrkbl = max(i__2,i__3);
00412 /* Computing MAX */
00413                     i__2 = wrkbl, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00414                             "ZUNGBR", "Q", n, n, n, &c_n1);
00415                     wrkbl = max(i__2,i__3);
00416 /* Computing MAX */
00417                     i__2 = wrkbl, i__3 = (*n << 1) + (*n - 1) * ilaenv_(&c__1, 
00418                              "ZUNGBR", "P", n, n, n, &c_n1);
00419                     wrkbl = max(i__2,i__3);
00420                     maxwrk = (*n << 1) * *n + wrkbl;
00421                     minwrk = (*n << 1) + *m;
00422                 } else if (wntus && wntvas) {
00423 
00424 /*                 Path 6 (M much larger than N, JOBU='S', JOBVT='S' or */
00425 /*                 'A') */
00426 
00427                     wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00428                             c_n1, &c_n1);
00429 /* Computing MAX */
00430                     i__2 = wrkbl, i__3 = *n + *n * ilaenv_(&c__1, "ZUNGQR", 
00431                             " ", m, n, n, &c_n1);
00432                     wrkbl = max(i__2,i__3);
00433 /* Computing MAX */
00434                     i__2 = wrkbl, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00435                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00436                     wrkbl = max(i__2,i__3);
00437 /* Computing MAX */
00438                     i__2 = wrkbl, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00439                             "ZUNGBR", "Q", n, n, n, &c_n1);
00440                     wrkbl = max(i__2,i__3);
00441 /* Computing MAX */
00442                     i__2 = wrkbl, i__3 = (*n << 1) + (*n - 1) * ilaenv_(&c__1, 
00443                              "ZUNGBR", "P", n, n, n, &c_n1);
00444                     wrkbl = max(i__2,i__3);
00445                     maxwrk = *n * *n + wrkbl;
00446                     minwrk = (*n << 1) + *m;
00447                 } else if (wntua && wntvn) {
00448 
00449 /*                 Path 7 (M much larger than N, JOBU='A', JOBVT='N') */
00450 
00451                     wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00452                             c_n1, &c_n1);
00453 /* Computing MAX */
00454                     i__2 = wrkbl, i__3 = *n + *m * ilaenv_(&c__1, "ZUNGQR", 
00455                             " ", m, m, n, &c_n1);
00456                     wrkbl = max(i__2,i__3);
00457 /* Computing MAX */
00458                     i__2 = wrkbl, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00459                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00460                     wrkbl = max(i__2,i__3);
00461 /* Computing MAX */
00462                     i__2 = wrkbl, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00463                             "ZUNGBR", "Q", n, n, n, &c_n1);
00464                     wrkbl = max(i__2,i__3);
00465                     maxwrk = *n * *n + wrkbl;
00466                     minwrk = (*n << 1) + *m;
00467                 } else if (wntua && wntvo) {
00468 
00469 /*                 Path 8 (M much larger than N, JOBU='A', JOBVT='O') */
00470 
00471                     wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00472                             c_n1, &c_n1);
00473 /* Computing MAX */
00474                     i__2 = wrkbl, i__3 = *n + *m * ilaenv_(&c__1, "ZUNGQR", 
00475                             " ", m, m, n, &c_n1);
00476                     wrkbl = max(i__2,i__3);
00477 /* Computing MAX */
00478                     i__2 = wrkbl, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00479                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00480                     wrkbl = max(i__2,i__3);
00481 /* Computing MAX */
00482                     i__2 = wrkbl, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00483                             "ZUNGBR", "Q", n, n, n, &c_n1);
00484                     wrkbl = max(i__2,i__3);
00485 /* Computing MAX */
00486                     i__2 = wrkbl, i__3 = (*n << 1) + (*n - 1) * ilaenv_(&c__1, 
00487                              "ZUNGBR", "P", n, n, n, &c_n1);
00488                     wrkbl = max(i__2,i__3);
00489                     maxwrk = (*n << 1) * *n + wrkbl;
00490                     minwrk = (*n << 1) + *m;
00491                 } else if (wntua && wntvas) {
00492 
00493 /*                 Path 9 (M much larger than N, JOBU='A', JOBVT='S' or */
00494 /*                 'A') */
00495 
00496                     wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00497                             c_n1, &c_n1);
00498 /* Computing MAX */
00499                     i__2 = wrkbl, i__3 = *n + *m * ilaenv_(&c__1, "ZUNGQR", 
00500                             " ", m, m, n, &c_n1);
00501                     wrkbl = max(i__2,i__3);
00502 /* Computing MAX */
00503                     i__2 = wrkbl, i__3 = (*n << 1) + (*n << 1) * ilaenv_(&
00504                             c__1, "ZGEBRD", " ", n, n, &c_n1, &c_n1);
00505                     wrkbl = max(i__2,i__3);
00506 /* Computing MAX */
00507                     i__2 = wrkbl, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00508                             "ZUNGBR", "Q", n, n, n, &c_n1);
00509                     wrkbl = max(i__2,i__3);
00510 /* Computing MAX */
00511                     i__2 = wrkbl, i__3 = (*n << 1) + (*n - 1) * ilaenv_(&c__1, 
00512                              "ZUNGBR", "P", n, n, n, &c_n1);
00513                     wrkbl = max(i__2,i__3);
00514                     maxwrk = *n * *n + wrkbl;
00515                     minwrk = (*n << 1) + *m;
00516                 }
00517             } else {
00518 
00519 /*              Path 10 (M at least N, but not much larger) */
00520 
00521                 maxwrk = (*n << 1) + (*m + *n) * ilaenv_(&c__1, "ZGEBRD", 
00522                         " ", m, n, &c_n1, &c_n1);
00523                 if (wntus || wntuo) {
00524 /* Computing MAX */
00525                     i__2 = maxwrk, i__3 = (*n << 1) + *n * ilaenv_(&c__1, 
00526                             "ZUNGBR", "Q", m, n, n, &c_n1);
00527                     maxwrk = max(i__2,i__3);
00528                 }
00529                 if (wntua) {
00530 /* Computing MAX */
00531                     i__2 = maxwrk, i__3 = (*n << 1) + *m * ilaenv_(&c__1, 
00532                             "ZUNGBR", "Q", m, m, n, &c_n1);
00533                     maxwrk = max(i__2,i__3);
00534                 }
00535                 if (! wntvn) {
00536 /* Computing MAX */
00537                     i__2 = maxwrk, i__3 = (*n << 1) + (*n - 1) * ilaenv_(&
00538                             c__1, "ZUNGBR", "P", n, n, n, &c_n1);
00539                     maxwrk = max(i__2,i__3);
00540                 }
00541                 minwrk = (*n << 1) + *m;
00542             }
00543         } else if (minmn > 0) {
00544 
00545 /*           Space needed for ZBDSQR is BDSPAC = 5*M */
00546 
00547 /* Writing concatenation */
00548             i__1[0] = 1, a__1[0] = jobu;
00549             i__1[1] = 1, a__1[1] = jobvt;
00550             s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2);
00551             mnthr = ilaenv_(&c__6, "ZGESVD", ch__1, m, n, &c__0, &c__0);
00552             if (*n >= mnthr) {
00553                 if (wntvn) {
00554 
00555 /*                 Path 1t(N much larger than M, JOBVT='N') */
00556 
00557                     maxwrk = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00558                             c_n1, &c_n1);
00559 /* Computing MAX */
00560                     i__2 = maxwrk, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00561                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00562                     maxwrk = max(i__2,i__3);
00563                     if (wntuo || wntuas) {
00564 /* Computing MAX */
00565                         i__2 = maxwrk, i__3 = (*m << 1) + *m * ilaenv_(&c__1, 
00566                                 "ZUNGBR", "Q", m, m, m, &c_n1);
00567                         maxwrk = max(i__2,i__3);
00568                     }
00569                     minwrk = *m * 3;
00570                 } else if (wntvo && wntun) {
00571 
00572 /*                 Path 2t(N much larger than M, JOBU='N', JOBVT='O') */
00573 
00574                     wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00575                             c_n1, &c_n1);
00576 /* Computing MAX */
00577                     i__2 = wrkbl, i__3 = *m + *m * ilaenv_(&c__1, "ZUNGLQ", 
00578                             " ", m, n, m, &c_n1);
00579                     wrkbl = max(i__2,i__3);
00580 /* Computing MAX */
00581                     i__2 = wrkbl, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00582                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00583                     wrkbl = max(i__2,i__3);
00584 /* Computing MAX */
00585                     i__2 = wrkbl, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&c__1, 
00586                              "ZUNGBR", "P", m, m, m, &c_n1);
00587                     wrkbl = max(i__2,i__3);
00588 /* Computing MAX */
00589                     i__2 = *m * *m + wrkbl, i__3 = *m * *m + *m * *n;
00590                     maxwrk = max(i__2,i__3);
00591                     minwrk = (*m << 1) + *n;
00592                 } else if (wntvo && wntuas) {
00593 
00594 /*                 Path 3t(N much larger than M, JOBU='S' or 'A', */
00595 /*                 JOBVT='O') */
00596 
00597                     wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00598                             c_n1, &c_n1);
00599 /* Computing MAX */
00600                     i__2 = wrkbl, i__3 = *m + *m * ilaenv_(&c__1, "ZUNGLQ", 
00601                             " ", m, n, m, &c_n1);
00602                     wrkbl = max(i__2,i__3);
00603 /* Computing MAX */
00604                     i__2 = wrkbl, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00605                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00606                     wrkbl = max(i__2,i__3);
00607 /* Computing MAX */
00608                     i__2 = wrkbl, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&c__1, 
00609                              "ZUNGBR", "P", m, m, m, &c_n1);
00610                     wrkbl = max(i__2,i__3);
00611 /* Computing MAX */
00612                     i__2 = wrkbl, i__3 = (*m << 1) + *m * ilaenv_(&c__1, 
00613                             "ZUNGBR", "Q", m, m, m, &c_n1);
00614                     wrkbl = max(i__2,i__3);
00615 /* Computing MAX */
00616                     i__2 = *m * *m + wrkbl, i__3 = *m * *m + *m * *n;
00617                     maxwrk = max(i__2,i__3);
00618                     minwrk = (*m << 1) + *n;
00619                 } else if (wntvs && wntun) {
00620 
00621 /*                 Path 4t(N much larger than M, JOBU='N', JOBVT='S') */
00622 
00623                     wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00624                             c_n1, &c_n1);
00625 /* Computing MAX */
00626                     i__2 = wrkbl, i__3 = *m + *m * ilaenv_(&c__1, "ZUNGLQ", 
00627                             " ", m, n, m, &c_n1);
00628                     wrkbl = max(i__2,i__3);
00629 /* Computing MAX */
00630                     i__2 = wrkbl, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00631                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00632                     wrkbl = max(i__2,i__3);
00633 /* Computing MAX */
00634                     i__2 = wrkbl, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&c__1, 
00635                              "ZUNGBR", "P", m, m, m, &c_n1);
00636                     wrkbl = max(i__2,i__3);
00637                     maxwrk = *m * *m + wrkbl;
00638                     minwrk = (*m << 1) + *n;
00639                 } else if (wntvs && wntuo) {
00640 
00641 /*                 Path 5t(N much larger than M, JOBU='O', JOBVT='S') */
00642 
00643                     wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00644                             c_n1, &c_n1);
00645 /* Computing MAX */
00646                     i__2 = wrkbl, i__3 = *m + *m * ilaenv_(&c__1, "ZUNGLQ", 
00647                             " ", m, n, m, &c_n1);
00648                     wrkbl = max(i__2,i__3);
00649 /* Computing MAX */
00650                     i__2 = wrkbl, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00651                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00652                     wrkbl = max(i__2,i__3);
00653 /* Computing MAX */
00654                     i__2 = wrkbl, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&c__1, 
00655                              "ZUNGBR", "P", m, m, m, &c_n1);
00656                     wrkbl = max(i__2,i__3);
00657 /* Computing MAX */
00658                     i__2 = wrkbl, i__3 = (*m << 1) + *m * ilaenv_(&c__1, 
00659                             "ZUNGBR", "Q", m, m, m, &c_n1);
00660                     wrkbl = max(i__2,i__3);
00661                     maxwrk = (*m << 1) * *m + wrkbl;
00662                     minwrk = (*m << 1) + *n;
00663                 } else if (wntvs && wntuas) {
00664 
00665 /*                 Path 6t(N much larger than M, JOBU='S' or 'A', */
00666 /*                 JOBVT='S') */
00667 
00668                     wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00669                             c_n1, &c_n1);
00670 /* Computing MAX */
00671                     i__2 = wrkbl, i__3 = *m + *m * ilaenv_(&c__1, "ZUNGLQ", 
00672                             " ", m, n, m, &c_n1);
00673                     wrkbl = max(i__2,i__3);
00674 /* Computing MAX */
00675                     i__2 = wrkbl, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00676                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00677                     wrkbl = max(i__2,i__3);
00678 /* Computing MAX */
00679                     i__2 = wrkbl, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&c__1, 
00680                              "ZUNGBR", "P", m, m, m, &c_n1);
00681                     wrkbl = max(i__2,i__3);
00682 /* Computing MAX */
00683                     i__2 = wrkbl, i__3 = (*m << 1) + *m * ilaenv_(&c__1, 
00684                             "ZUNGBR", "Q", m, m, m, &c_n1);
00685                     wrkbl = max(i__2,i__3);
00686                     maxwrk = *m * *m + wrkbl;
00687                     minwrk = (*m << 1) + *n;
00688                 } else if (wntva && wntun) {
00689 
00690 /*                 Path 7t(N much larger than M, JOBU='N', JOBVT='A') */
00691 
00692                     wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00693                             c_n1, &c_n1);
00694 /* Computing MAX */
00695                     i__2 = wrkbl, i__3 = *m + *n * ilaenv_(&c__1, "ZUNGLQ", 
00696                             " ", n, n, m, &c_n1);
00697                     wrkbl = max(i__2,i__3);
00698 /* Computing MAX */
00699                     i__2 = wrkbl, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00700                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00701                     wrkbl = max(i__2,i__3);
00702 /* Computing MAX */
00703                     i__2 = wrkbl, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&c__1, 
00704                              "ZUNGBR", "P", m, m, m, &c_n1);
00705                     wrkbl = max(i__2,i__3);
00706                     maxwrk = *m * *m + wrkbl;
00707                     minwrk = (*m << 1) + *n;
00708                 } else if (wntva && wntuo) {
00709 
00710 /*                 Path 8t(N much larger than M, JOBU='O', JOBVT='A') */
00711 
00712                     wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00713                             c_n1, &c_n1);
00714 /* Computing MAX */
00715                     i__2 = wrkbl, i__3 = *m + *n * ilaenv_(&c__1, "ZUNGLQ", 
00716                             " ", n, n, m, &c_n1);
00717                     wrkbl = max(i__2,i__3);
00718 /* Computing MAX */
00719                     i__2 = wrkbl, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00720                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00721                     wrkbl = max(i__2,i__3);
00722 /* Computing MAX */
00723                     i__2 = wrkbl, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&c__1, 
00724                              "ZUNGBR", "P", m, m, m, &c_n1);
00725                     wrkbl = max(i__2,i__3);
00726 /* Computing MAX */
00727                     i__2 = wrkbl, i__3 = (*m << 1) + *m * ilaenv_(&c__1, 
00728                             "ZUNGBR", "Q", m, m, m, &c_n1);
00729                     wrkbl = max(i__2,i__3);
00730                     maxwrk = (*m << 1) * *m + wrkbl;
00731                     minwrk = (*m << 1) + *n;
00732                 } else if (wntva && wntuas) {
00733 
00734 /*                 Path 9t(N much larger than M, JOBU='S' or 'A', */
00735 /*                 JOBVT='A') */
00736 
00737                     wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00738                             c_n1, &c_n1);
00739 /* Computing MAX */
00740                     i__2 = wrkbl, i__3 = *m + *n * ilaenv_(&c__1, "ZUNGLQ", 
00741                             " ", n, n, m, &c_n1);
00742                     wrkbl = max(i__2,i__3);
00743 /* Computing MAX */
00744                     i__2 = wrkbl, i__3 = (*m << 1) + (*m << 1) * ilaenv_(&
00745                             c__1, "ZGEBRD", " ", m, m, &c_n1, &c_n1);
00746                     wrkbl = max(i__2,i__3);
00747 /* Computing MAX */
00748                     i__2 = wrkbl, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&c__1, 
00749                              "ZUNGBR", "P", m, m, m, &c_n1);
00750                     wrkbl = max(i__2,i__3);
00751 /* Computing MAX */
00752                     i__2 = wrkbl, i__3 = (*m << 1) + *m * ilaenv_(&c__1, 
00753                             "ZUNGBR", "Q", m, m, m, &c_n1);
00754                     wrkbl = max(i__2,i__3);
00755                     maxwrk = *m * *m + wrkbl;
00756                     minwrk = (*m << 1) + *n;
00757                 }
00758             } else {
00759 
00760 /*              Path 10t(N greater than M, but not much larger) */
00761 
00762                 maxwrk = (*m << 1) + (*m + *n) * ilaenv_(&c__1, "ZGEBRD", 
00763                         " ", m, n, &c_n1, &c_n1);
00764                 if (wntvs || wntvo) {
00765 /* Computing MAX */
00766                     i__2 = maxwrk, i__3 = (*m << 1) + *m * ilaenv_(&c__1, 
00767                             "ZUNGBR", "P", m, n, m, &c_n1);
00768                     maxwrk = max(i__2,i__3);
00769                 }
00770                 if (wntva) {
00771 /* Computing MAX */
00772                     i__2 = maxwrk, i__3 = (*m << 1) + *n * ilaenv_(&c__1, 
00773                             "ZUNGBR", "P", n, n, m, &c_n1);
00774                     maxwrk = max(i__2,i__3);
00775                 }
00776                 if (! wntun) {
00777 /* Computing MAX */
00778                     i__2 = maxwrk, i__3 = (*m << 1) + (*m - 1) * ilaenv_(&
00779                             c__1, "ZUNGBR", "Q", m, m, m, &c_n1);
00780                     maxwrk = max(i__2,i__3);
00781                 }
00782                 minwrk = (*m << 1) + *n;
00783             }
00784         }
00785         maxwrk = max(maxwrk,minwrk);
00786         work[1].r = (doublereal) maxwrk, work[1].i = 0.;
00787 
00788         if (*lwork < minwrk && ! lquery) {
00789             *info = -13;
00790         }
00791     }
00792 
00793     if (*info != 0) {
00794         i__2 = -(*info);
00795         xerbla_("ZGESVD", &i__2);
00796         return 0;
00797     } else if (lquery) {
00798         return 0;
00799     }
00800 
00801 /*     Quick return if possible */
00802 
00803     if (*m == 0 || *n == 0) {
00804         return 0;
00805     }
00806 
00807 /*     Get machine constants */
00808 
00809     eps = dlamch_("P");
00810     smlnum = sqrt(dlamch_("S")) / eps;
00811     bignum = 1. / smlnum;
00812 
00813 /*     Scale A if max element outside range [SMLNUM,BIGNUM] */
00814 
00815     anrm = zlange_("M", m, n, &a[a_offset], lda, dum);
00816     iscl = 0;
00817     if (anrm > 0. && anrm < smlnum) {
00818         iscl = 1;
00819         zlascl_("G", &c__0, &c__0, &anrm, &smlnum, m, n, &a[a_offset], lda, &
00820                 ierr);
00821     } else if (anrm > bignum) {
00822         iscl = 1;
00823         zlascl_("G", &c__0, &c__0, &anrm, &bignum, m, n, &a[a_offset], lda, &
00824                 ierr);
00825     }
00826 
00827     if (*m >= *n) {
00828 
00829 /*        A has at least as many rows as columns. If A has sufficiently */
00830 /*        more rows than columns, first reduce using the QR */
00831 /*        decomposition (if sufficient workspace available) */
00832 
00833         if (*m >= mnthr) {
00834 
00835             if (wntun) {
00836 
00837 /*              Path 1 (M much larger than N, JOBU='N') */
00838 /*              No left singular vectors to be computed */
00839 
00840                 itau = 1;
00841                 iwork = itau + *n;
00842 
00843 /*              Compute A=Q*R */
00844 /*              (CWorkspace: need 2*N, prefer N+N*NB) */
00845 /*              (RWorkspace: need 0) */
00846 
00847                 i__2 = *lwork - iwork + 1;
00848                 zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[iwork], &
00849                         i__2, &ierr);
00850 
00851 /*              Zero out below R */
00852 
00853                 i__2 = *n - 1;
00854                 i__3 = *n - 1;
00855                 zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &a[a_dim1 + 2], lda);
00856                 ie = 1;
00857                 itauq = 1;
00858                 itaup = itauq + *n;
00859                 iwork = itaup + *n;
00860 
00861 /*              Bidiagonalize R in A */
00862 /*              (CWorkspace: need 3*N, prefer 2*N+2*N*NB) */
00863 /*              (RWorkspace: need N) */
00864 
00865                 i__2 = *lwork - iwork + 1;
00866                 zgebrd_(n, n, &a[a_offset], lda, &s[1], &rwork[ie], &work[
00867                         itauq], &work[itaup], &work[iwork], &i__2, &ierr);
00868                 ncvt = 0;
00869                 if (wntvo || wntvas) {
00870 
00871 /*                 If right singular vectors desired, generate P'. */
00872 /*                 (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
00873 /*                 (RWorkspace: 0) */
00874 
00875                     i__2 = *lwork - iwork + 1;
00876                     zungbr_("P", n, n, n, &a[a_offset], lda, &work[itaup], &
00877                             work[iwork], &i__2, &ierr);
00878                     ncvt = *n;
00879                 }
00880                 irwork = ie + *n;
00881 
00882 /*              Perform bidiagonal QR iteration, computing right */
00883 /*              singular vectors of A in A if desired */
00884 /*              (CWorkspace: 0) */
00885 /*              (RWorkspace: need BDSPAC) */
00886 
00887                 zbdsqr_("U", n, &ncvt, &c__0, &c__0, &s[1], &rwork[ie], &a[
00888                         a_offset], lda, cdum, &c__1, cdum, &c__1, &rwork[
00889                         irwork], info);
00890 
00891 /*              If right singular vectors desired in VT, copy them there */
00892 
00893                 if (wntvas) {
00894                     zlacpy_("F", n, n, &a[a_offset], lda, &vt[vt_offset], 
00895                             ldvt);
00896                 }
00897 
00898             } else if (wntuo && wntvn) {
00899 
00900 /*              Path 2 (M much larger than N, JOBU='O', JOBVT='N') */
00901 /*              N left singular vectors to be overwritten on A and */
00902 /*              no right singular vectors to be computed */
00903 
00904                 if (*lwork >= *n * *n + *n * 3) {
00905 
00906 /*                 Sufficient workspace for a fast algorithm */
00907 
00908                     ir = 1;
00909 /* Computing MAX */
00910                     i__2 = wrkbl, i__3 = *lda * *n;
00911                     if (*lwork >= max(i__2,i__3) + *lda * *n) {
00912 
00913 /*                    WORK(IU) is LDA by N, WORK(IR) is LDA by N */
00914 
00915                         ldwrku = *lda;
00916                         ldwrkr = *lda;
00917                     } else /* if(complicated condition) */ {
00918 /* Computing MAX */
00919                         i__2 = wrkbl, i__3 = *lda * *n;
00920                         if (*lwork >= max(i__2,i__3) + *n * *n) {
00921 
00922 /*                    WORK(IU) is LDA by N, WORK(IR) is N by N */
00923 
00924                             ldwrku = *lda;
00925                             ldwrkr = *n;
00926                         } else {
00927 
00928 /*                    WORK(IU) is LDWRKU by N, WORK(IR) is N by N */
00929 
00930                             ldwrku = (*lwork - *n * *n) / *n;
00931                             ldwrkr = *n;
00932                         }
00933                     }
00934                     itau = ir + ldwrkr * *n;
00935                     iwork = itau + *n;
00936 
00937 /*                 Compute A=Q*R */
00938 /*                 (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
00939 /*                 (RWorkspace: 0) */
00940 
00941                     i__2 = *lwork - iwork + 1;
00942                     zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[iwork]
00943 , &i__2, &ierr);
00944 
00945 /*                 Copy R to WORK(IR) and zero out below it */
00946 
00947                     zlacpy_("U", n, n, &a[a_offset], lda, &work[ir], &ldwrkr);
00948                     i__2 = *n - 1;
00949                     i__3 = *n - 1;
00950                     zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &work[ir + 1], &
00951                             ldwrkr);
00952 
00953 /*                 Generate Q in A */
00954 /*                 (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
00955 /*                 (RWorkspace: 0) */
00956 
00957                     i__2 = *lwork - iwork + 1;
00958                     zungqr_(m, n, n, &a[a_offset], lda, &work[itau], &work[
00959                             iwork], &i__2, &ierr);
00960                     ie = 1;
00961                     itauq = itau;
00962                     itaup = itauq + *n;
00963                     iwork = itaup + *n;
00964 
00965 /*                 Bidiagonalize R in WORK(IR) */
00966 /*                 (CWorkspace: need N*N+3*N, prefer N*N+2*N+2*N*NB) */
00967 /*                 (RWorkspace: need N) */
00968 
00969                     i__2 = *lwork - iwork + 1;
00970                     zgebrd_(n, n, &work[ir], &ldwrkr, &s[1], &rwork[ie], &
00971                             work[itauq], &work[itaup], &work[iwork], &i__2, &
00972                             ierr);
00973 
00974 /*                 Generate left vectors bidiagonalizing R */
00975 /*                 (CWorkspace: need N*N+3*N, prefer N*N+2*N+N*NB) */
00976 /*                 (RWorkspace: need 0) */
00977 
00978                     i__2 = *lwork - iwork + 1;
00979                     zungbr_("Q", n, n, n, &work[ir], &ldwrkr, &work[itauq], &
00980                             work[iwork], &i__2, &ierr);
00981                     irwork = ie + *n;
00982 
00983 /*                 Perform bidiagonal QR iteration, computing left */
00984 /*                 singular vectors of R in WORK(IR) */
00985 /*                 (CWorkspace: need N*N) */
00986 /*                 (RWorkspace: need BDSPAC) */
00987 
00988                     zbdsqr_("U", n, &c__0, n, &c__0, &s[1], &rwork[ie], cdum, 
00989                             &c__1, &work[ir], &ldwrkr, cdum, &c__1, &rwork[
00990                             irwork], info);
00991                     iu = itauq;
00992 
00993 /*                 Multiply Q in A by left singular vectors of R in */
00994 /*                 WORK(IR), storing result in WORK(IU) and copying to A */
00995 /*                 (CWorkspace: need N*N+N, prefer N*N+M*N) */
00996 /*                 (RWorkspace: 0) */
00997 
00998                     i__2 = *m;
00999                     i__3 = ldwrku;
01000                     for (i__ = 1; i__3 < 0 ? i__ >= i__2 : i__ <= i__2; i__ +=
01001                              i__3) {
01002 /* Computing MIN */
01003                         i__4 = *m - i__ + 1;
01004                         chunk = min(i__4,ldwrku);
01005                         zgemm_("N", "N", &chunk, n, n, &c_b2, &a[i__ + a_dim1]
01006 , lda, &work[ir], &ldwrkr, &c_b1, &work[iu], &
01007                                 ldwrku);
01008                         zlacpy_("F", &chunk, n, &work[iu], &ldwrku, &a[i__ + 
01009                                 a_dim1], lda);
01010 /* L10: */
01011                     }
01012 
01013                 } else {
01014 
01015 /*                 Insufficient workspace for a fast algorithm */
01016 
01017                     ie = 1;
01018                     itauq = 1;
01019                     itaup = itauq + *n;
01020                     iwork = itaup + *n;
01021 
01022 /*                 Bidiagonalize A */
01023 /*                 (CWorkspace: need 2*N+M, prefer 2*N+(M+N)*NB) */
01024 /*                 (RWorkspace: N) */
01025 
01026                     i__3 = *lwork - iwork + 1;
01027                     zgebrd_(m, n, &a[a_offset], lda, &s[1], &rwork[ie], &work[
01028                             itauq], &work[itaup], &work[iwork], &i__3, &ierr);
01029 
01030 /*                 Generate left vectors bidiagonalizing A */
01031 /*                 (CWorkspace: need 3*N, prefer 2*N+N*NB) */
01032 /*                 (RWorkspace: 0) */
01033 
01034                     i__3 = *lwork - iwork + 1;
01035                     zungbr_("Q", m, n, n, &a[a_offset], lda, &work[itauq], &
01036                             work[iwork], &i__3, &ierr);
01037                     irwork = ie + *n;
01038 
01039 /*                 Perform bidiagonal QR iteration, computing left */
01040 /*                 singular vectors of A in A */
01041 /*                 (CWorkspace: need 0) */
01042 /*                 (RWorkspace: need BDSPAC) */
01043 
01044                     zbdsqr_("U", n, &c__0, m, &c__0, &s[1], &rwork[ie], cdum, 
01045                             &c__1, &a[a_offset], lda, cdum, &c__1, &rwork[
01046                             irwork], info);
01047 
01048                 }
01049 
01050             } else if (wntuo && wntvas) {
01051 
01052 /*              Path 3 (M much larger than N, JOBU='O', JOBVT='S' or 'A') */
01053 /*              N left singular vectors to be overwritten on A and */
01054 /*              N right singular vectors to be computed in VT */
01055 
01056                 if (*lwork >= *n * *n + *n * 3) {
01057 
01058 /*                 Sufficient workspace for a fast algorithm */
01059 
01060                     ir = 1;
01061 /* Computing MAX */
01062                     i__3 = wrkbl, i__2 = *lda * *n;
01063                     if (*lwork >= max(i__3,i__2) + *lda * *n) {
01064 
01065 /*                    WORK(IU) is LDA by N and WORK(IR) is LDA by N */
01066 
01067                         ldwrku = *lda;
01068                         ldwrkr = *lda;
01069                     } else /* if(complicated condition) */ {
01070 /* Computing MAX */
01071                         i__3 = wrkbl, i__2 = *lda * *n;
01072                         if (*lwork >= max(i__3,i__2) + *n * *n) {
01073 
01074 /*                    WORK(IU) is LDA by N and WORK(IR) is N by N */
01075 
01076                             ldwrku = *lda;
01077                             ldwrkr = *n;
01078                         } else {
01079 
01080 /*                    WORK(IU) is LDWRKU by N and WORK(IR) is N by N */
01081 
01082                             ldwrku = (*lwork - *n * *n) / *n;
01083                             ldwrkr = *n;
01084                         }
01085                     }
01086                     itau = ir + ldwrkr * *n;
01087                     iwork = itau + *n;
01088 
01089 /*                 Compute A=Q*R */
01090 /*                 (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
01091 /*                 (RWorkspace: 0) */
01092 
01093                     i__3 = *lwork - iwork + 1;
01094                     zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[iwork]
01095 , &i__3, &ierr);
01096 
01097 /*                 Copy R to VT, zeroing out below it */
01098 
01099                     zlacpy_("U", n, n, &a[a_offset], lda, &vt[vt_offset], 
01100                             ldvt);
01101                     if (*n > 1) {
01102                         i__3 = *n - 1;
01103                         i__2 = *n - 1;
01104                         zlaset_("L", &i__3, &i__2, &c_b1, &c_b1, &vt[vt_dim1 
01105                                 + 2], ldvt);
01106                     }
01107 
01108 /*                 Generate Q in A */
01109 /*                 (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
01110 /*                 (RWorkspace: 0) */
01111 
01112                     i__3 = *lwork - iwork + 1;
01113                     zungqr_(m, n, n, &a[a_offset], lda, &work[itau], &work[
01114                             iwork], &i__3, &ierr);
01115                     ie = 1;
01116                     itauq = itau;
01117                     itaup = itauq + *n;
01118                     iwork = itaup + *n;
01119 
01120 /*                 Bidiagonalize R in VT, copying result to WORK(IR) */
01121 /*                 (CWorkspace: need N*N+3*N, prefer N*N+2*N+2*N*NB) */
01122 /*                 (RWorkspace: need N) */
01123 
01124                     i__3 = *lwork - iwork + 1;
01125                     zgebrd_(n, n, &vt[vt_offset], ldvt, &s[1], &rwork[ie], &
01126                             work[itauq], &work[itaup], &work[iwork], &i__3, &
01127                             ierr);
01128                     zlacpy_("L", n, n, &vt[vt_offset], ldvt, &work[ir], &
01129                             ldwrkr);
01130 
01131 /*                 Generate left vectors bidiagonalizing R in WORK(IR) */
01132 /*                 (CWorkspace: need N*N+3*N, prefer N*N+2*N+N*NB) */
01133 /*                 (RWorkspace: 0) */
01134 
01135                     i__3 = *lwork - iwork + 1;
01136                     zungbr_("Q", n, n, n, &work[ir], &ldwrkr, &work[itauq], &
01137                             work[iwork], &i__3, &ierr);
01138 
01139 /*                 Generate right vectors bidiagonalizing R in VT */
01140 /*                 (CWorkspace: need N*N+3*N-1, prefer N*N+2*N+(N-1)*NB) */
01141 /*                 (RWorkspace: 0) */
01142 
01143                     i__3 = *lwork - iwork + 1;
01144                     zungbr_("P", n, n, n, &vt[vt_offset], ldvt, &work[itaup], 
01145                             &work[iwork], &i__3, &ierr);
01146                     irwork = ie + *n;
01147 
01148 /*                 Perform bidiagonal QR iteration, computing left */
01149 /*                 singular vectors of R in WORK(IR) and computing right */
01150 /*                 singular vectors of R in VT */
01151 /*                 (CWorkspace: need N*N) */
01152 /*                 (RWorkspace: need BDSPAC) */
01153 
01154                     zbdsqr_("U", n, n, n, &c__0, &s[1], &rwork[ie], &vt[
01155                             vt_offset], ldvt, &work[ir], &ldwrkr, cdum, &c__1, 
01156                              &rwork[irwork], info);
01157                     iu = itauq;
01158 
01159 /*                 Multiply Q in A by left singular vectors of R in */
01160 /*                 WORK(IR), storing result in WORK(IU) and copying to A */
01161 /*                 (CWorkspace: need N*N+N, prefer N*N+M*N) */
01162 /*                 (RWorkspace: 0) */
01163 
01164                     i__3 = *m;
01165                     i__2 = ldwrku;
01166                     for (i__ = 1; i__2 < 0 ? i__ >= i__3 : i__ <= i__3; i__ +=
01167                              i__2) {
01168 /* Computing MIN */
01169                         i__4 = *m - i__ + 1;
01170                         chunk = min(i__4,ldwrku);
01171                         zgemm_("N", "N", &chunk, n, n, &c_b2, &a[i__ + a_dim1]
01172 , lda, &work[ir], &ldwrkr, &c_b1, &work[iu], &
01173                                 ldwrku);
01174                         zlacpy_("F", &chunk, n, &work[iu], &ldwrku, &a[i__ + 
01175                                 a_dim1], lda);
01176 /* L20: */
01177                     }
01178 
01179                 } else {
01180 
01181 /*                 Insufficient workspace for a fast algorithm */
01182 
01183                     itau = 1;
01184                     iwork = itau + *n;
01185 
01186 /*                 Compute A=Q*R */
01187 /*                 (CWorkspace: need 2*N, prefer N+N*NB) */
01188 /*                 (RWorkspace: 0) */
01189 
01190                     i__2 = *lwork - iwork + 1;
01191                     zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[iwork]
01192 , &i__2, &ierr);
01193 
01194 /*                 Copy R to VT, zeroing out below it */
01195 
01196                     zlacpy_("U", n, n, &a[a_offset], lda, &vt[vt_offset], 
01197                             ldvt);
01198                     if (*n > 1) {
01199                         i__2 = *n - 1;
01200                         i__3 = *n - 1;
01201                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &vt[vt_dim1 
01202                                 + 2], ldvt);
01203                     }
01204 
01205 /*                 Generate Q in A */
01206 /*                 (CWorkspace: need 2*N, prefer N+N*NB) */
01207 /*                 (RWorkspace: 0) */
01208 
01209                     i__2 = *lwork - iwork + 1;
01210                     zungqr_(m, n, n, &a[a_offset], lda, &work[itau], &work[
01211                             iwork], &i__2, &ierr);
01212                     ie = 1;
01213                     itauq = itau;
01214                     itaup = itauq + *n;
01215                     iwork = itaup + *n;
01216 
01217 /*                 Bidiagonalize R in VT */
01218 /*                 (CWorkspace: need 3*N, prefer 2*N+2*N*NB) */
01219 /*                 (RWorkspace: N) */
01220 
01221                     i__2 = *lwork - iwork + 1;
01222                     zgebrd_(n, n, &vt[vt_offset], ldvt, &s[1], &rwork[ie], &
01223                             work[itauq], &work[itaup], &work[iwork], &i__2, &
01224                             ierr);
01225 
01226 /*                 Multiply Q in A by left vectors bidiagonalizing R */
01227 /*                 (CWorkspace: need 2*N+M, prefer 2*N+M*NB) */
01228 /*                 (RWorkspace: 0) */
01229 
01230                     i__2 = *lwork - iwork + 1;
01231                     zunmbr_("Q", "R", "N", m, n, n, &vt[vt_offset], ldvt, &
01232                             work[itauq], &a[a_offset], lda, &work[iwork], &
01233                             i__2, &ierr);
01234 
01235 /*                 Generate right vectors bidiagonalizing R in VT */
01236 /*                 (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
01237 /*                 (RWorkspace: 0) */
01238 
01239                     i__2 = *lwork - iwork + 1;
01240                     zungbr_("P", n, n, n, &vt[vt_offset], ldvt, &work[itaup], 
01241                             &work[iwork], &i__2, &ierr);
01242                     irwork = ie + *n;
01243 
01244 /*                 Perform bidiagonal QR iteration, computing left */
01245 /*                 singular vectors of A in A and computing right */
01246 /*                 singular vectors of A in VT */
01247 /*                 (CWorkspace: 0) */
01248 /*                 (RWorkspace: need BDSPAC) */
01249 
01250                     zbdsqr_("U", n, n, m, &c__0, &s[1], &rwork[ie], &vt[
01251                             vt_offset], ldvt, &a[a_offset], lda, cdum, &c__1, 
01252                             &rwork[irwork], info);
01253 
01254                 }
01255 
01256             } else if (wntus) {
01257 
01258                 if (wntvn) {
01259 
01260 /*                 Path 4 (M much larger than N, JOBU='S', JOBVT='N') */
01261 /*                 N left singular vectors to be computed in U and */
01262 /*                 no right singular vectors to be computed */
01263 
01264                     if (*lwork >= *n * *n + *n * 3) {
01265 
01266 /*                    Sufficient workspace for a fast algorithm */
01267 
01268                         ir = 1;
01269                         if (*lwork >= wrkbl + *lda * *n) {
01270 
01271 /*                       WORK(IR) is LDA by N */
01272 
01273                             ldwrkr = *lda;
01274                         } else {
01275 
01276 /*                       WORK(IR) is N by N */
01277 
01278                             ldwrkr = *n;
01279                         }
01280                         itau = ir + ldwrkr * *n;
01281                         iwork = itau + *n;
01282 
01283 /*                    Compute A=Q*R */
01284 /*                    (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
01285 /*                    (RWorkspace: 0) */
01286 
01287                         i__2 = *lwork - iwork + 1;
01288                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
01289                                 iwork], &i__2, &ierr);
01290 
01291 /*                    Copy R to WORK(IR), zeroing out below it */
01292 
01293                         zlacpy_("U", n, n, &a[a_offset], lda, &work[ir], &
01294                                 ldwrkr);
01295                         i__2 = *n - 1;
01296                         i__3 = *n - 1;
01297                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &work[ir + 1]
01298 , &ldwrkr);
01299 
01300 /*                    Generate Q in A */
01301 /*                    (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
01302 /*                    (RWorkspace: 0) */
01303 
01304                         i__2 = *lwork - iwork + 1;
01305                         zungqr_(m, n, n, &a[a_offset], lda, &work[itau], &
01306                                 work[iwork], &i__2, &ierr);
01307                         ie = 1;
01308                         itauq = itau;
01309                         itaup = itauq + *n;
01310                         iwork = itaup + *n;
01311 
01312 /*                    Bidiagonalize R in WORK(IR) */
01313 /*                    (CWorkspace: need N*N+3*N, prefer N*N+2*N+2*N*NB) */
01314 /*                    (RWorkspace: need N) */
01315 
01316                         i__2 = *lwork - iwork + 1;
01317                         zgebrd_(n, n, &work[ir], &ldwrkr, &s[1], &rwork[ie], &
01318                                 work[itauq], &work[itaup], &work[iwork], &
01319                                 i__2, &ierr);
01320 
01321 /*                    Generate left vectors bidiagonalizing R in WORK(IR) */
01322 /*                    (CWorkspace: need N*N+3*N, prefer N*N+2*N+N*NB) */
01323 /*                    (RWorkspace: 0) */
01324 
01325                         i__2 = *lwork - iwork + 1;
01326                         zungbr_("Q", n, n, n, &work[ir], &ldwrkr, &work[itauq]
01327 , &work[iwork], &i__2, &ierr);
01328                         irwork = ie + *n;
01329 
01330 /*                    Perform bidiagonal QR iteration, computing left */
01331 /*                    singular vectors of R in WORK(IR) */
01332 /*                    (CWorkspace: need N*N) */
01333 /*                    (RWorkspace: need BDSPAC) */
01334 
01335                         zbdsqr_("U", n, &c__0, n, &c__0, &s[1], &rwork[ie], 
01336                                 cdum, &c__1, &work[ir], &ldwrkr, cdum, &c__1, 
01337                                 &rwork[irwork], info);
01338 
01339 /*                    Multiply Q in A by left singular vectors of R in */
01340 /*                    WORK(IR), storing result in U */
01341 /*                    (CWorkspace: need N*N) */
01342 /*                    (RWorkspace: 0) */
01343 
01344                         zgemm_("N", "N", m, n, n, &c_b2, &a[a_offset], lda, &
01345                                 work[ir], &ldwrkr, &c_b1, &u[u_offset], ldu);
01346 
01347                     } else {
01348 
01349 /*                    Insufficient workspace for a fast algorithm */
01350 
01351                         itau = 1;
01352                         iwork = itau + *n;
01353 
01354 /*                    Compute A=Q*R, copying result to U */
01355 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
01356 /*                    (RWorkspace: 0) */
01357 
01358                         i__2 = *lwork - iwork + 1;
01359                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
01360                                 iwork], &i__2, &ierr);
01361                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
01362                                 ldu);
01363 
01364 /*                    Generate Q in U */
01365 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
01366 /*                    (RWorkspace: 0) */
01367 
01368                         i__2 = *lwork - iwork + 1;
01369                         zungqr_(m, n, n, &u[u_offset], ldu, &work[itau], &
01370                                 work[iwork], &i__2, &ierr);
01371                         ie = 1;
01372                         itauq = itau;
01373                         itaup = itauq + *n;
01374                         iwork = itaup + *n;
01375 
01376 /*                    Zero out below R in A */
01377 
01378                         i__2 = *n - 1;
01379                         i__3 = *n - 1;
01380                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &a[a_dim1 + 
01381                                 2], lda);
01382 
01383 /*                    Bidiagonalize R in A */
01384 /*                    (CWorkspace: need 3*N, prefer 2*N+2*N*NB) */
01385 /*                    (RWorkspace: need N) */
01386 
01387                         i__2 = *lwork - iwork + 1;
01388                         zgebrd_(n, n, &a[a_offset], lda, &s[1], &rwork[ie], &
01389                                 work[itauq], &work[itaup], &work[iwork], &
01390                                 i__2, &ierr);
01391 
01392 /*                    Multiply Q in U by left vectors bidiagonalizing R */
01393 /*                    (CWorkspace: need 2*N+M, prefer 2*N+M*NB) */
01394 /*                    (RWorkspace: 0) */
01395 
01396                         i__2 = *lwork - iwork + 1;
01397                         zunmbr_("Q", "R", "N", m, n, n, &a[a_offset], lda, &
01398                                 work[itauq], &u[u_offset], ldu, &work[iwork], 
01399                                 &i__2, &ierr)
01400                                 ;
01401                         irwork = ie + *n;
01402 
01403 /*                    Perform bidiagonal QR iteration, computing left */
01404 /*                    singular vectors of A in U */
01405 /*                    (CWorkspace: 0) */
01406 /*                    (RWorkspace: need BDSPAC) */
01407 
01408                         zbdsqr_("U", n, &c__0, m, &c__0, &s[1], &rwork[ie], 
01409                                 cdum, &c__1, &u[u_offset], ldu, cdum, &c__1, &
01410                                 rwork[irwork], info);
01411 
01412                     }
01413 
01414                 } else if (wntvo) {
01415 
01416 /*                 Path 5 (M much larger than N, JOBU='S', JOBVT='O') */
01417 /*                 N left singular vectors to be computed in U and */
01418 /*                 N right singular vectors to be overwritten on A */
01419 
01420                     if (*lwork >= (*n << 1) * *n + *n * 3) {
01421 
01422 /*                    Sufficient workspace for a fast algorithm */
01423 
01424                         iu = 1;
01425                         if (*lwork >= wrkbl + (*lda << 1) * *n) {
01426 
01427 /*                       WORK(IU) is LDA by N and WORK(IR) is LDA by N */
01428 
01429                             ldwrku = *lda;
01430                             ir = iu + ldwrku * *n;
01431                             ldwrkr = *lda;
01432                         } else if (*lwork >= wrkbl + (*lda + *n) * *n) {
01433 
01434 /*                       WORK(IU) is LDA by N and WORK(IR) is N by N */
01435 
01436                             ldwrku = *lda;
01437                             ir = iu + ldwrku * *n;
01438                             ldwrkr = *n;
01439                         } else {
01440 
01441 /*                       WORK(IU) is N by N and WORK(IR) is N by N */
01442 
01443                             ldwrku = *n;
01444                             ir = iu + ldwrku * *n;
01445                             ldwrkr = *n;
01446                         }
01447                         itau = ir + ldwrkr * *n;
01448                         iwork = itau + *n;
01449 
01450 /*                    Compute A=Q*R */
01451 /*                    (CWorkspace: need 2*N*N+2*N, prefer 2*N*N+N+N*NB) */
01452 /*                    (RWorkspace: 0) */
01453 
01454                         i__2 = *lwork - iwork + 1;
01455                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
01456                                 iwork], &i__2, &ierr);
01457 
01458 /*                    Copy R to WORK(IU), zeroing out below it */
01459 
01460                         zlacpy_("U", n, n, &a[a_offset], lda, &work[iu], &
01461                                 ldwrku);
01462                         i__2 = *n - 1;
01463                         i__3 = *n - 1;
01464                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &work[iu + 1]
01465 , &ldwrku);
01466 
01467 /*                    Generate Q in A */
01468 /*                    (CWorkspace: need 2*N*N+2*N, prefer 2*N*N+N+N*NB) */
01469 /*                    (RWorkspace: 0) */
01470 
01471                         i__2 = *lwork - iwork + 1;
01472                         zungqr_(m, n, n, &a[a_offset], lda, &work[itau], &
01473                                 work[iwork], &i__2, &ierr);
01474                         ie = 1;
01475                         itauq = itau;
01476                         itaup = itauq + *n;
01477                         iwork = itaup + *n;
01478 
01479 /*                    Bidiagonalize R in WORK(IU), copying result to */
01480 /*                    WORK(IR) */
01481 /*                    (CWorkspace: need   2*N*N+3*N, */
01482 /*                                 prefer 2*N*N+2*N+2*N*NB) */
01483 /*                    (RWorkspace: need   N) */
01484 
01485                         i__2 = *lwork - iwork + 1;
01486                         zgebrd_(n, n, &work[iu], &ldwrku, &s[1], &rwork[ie], &
01487                                 work[itauq], &work[itaup], &work[iwork], &
01488                                 i__2, &ierr);
01489                         zlacpy_("U", n, n, &work[iu], &ldwrku, &work[ir], &
01490                                 ldwrkr);
01491 
01492 /*                    Generate left bidiagonalizing vectors in WORK(IU) */
01493 /*                    (CWorkspace: need 2*N*N+3*N, prefer 2*N*N+2*N+N*NB) */
01494 /*                    (RWorkspace: 0) */
01495 
01496                         i__2 = *lwork - iwork + 1;
01497                         zungbr_("Q", n, n, n, &work[iu], &ldwrku, &work[itauq]
01498 , &work[iwork], &i__2, &ierr);
01499 
01500 /*                    Generate right bidiagonalizing vectors in WORK(IR) */
01501 /*                    (CWorkspace: need   2*N*N+3*N-1, */
01502 /*                                 prefer 2*N*N+2*N+(N-1)*NB) */
01503 /*                    (RWorkspace: 0) */
01504 
01505                         i__2 = *lwork - iwork + 1;
01506                         zungbr_("P", n, n, n, &work[ir], &ldwrkr, &work[itaup]
01507 , &work[iwork], &i__2, &ierr);
01508                         irwork = ie + *n;
01509 
01510 /*                    Perform bidiagonal QR iteration, computing left */
01511 /*                    singular vectors of R in WORK(IU) and computing */
01512 /*                    right singular vectors of R in WORK(IR) */
01513 /*                    (CWorkspace: need 2*N*N) */
01514 /*                    (RWorkspace: need BDSPAC) */
01515 
01516                         zbdsqr_("U", n, n, n, &c__0, &s[1], &rwork[ie], &work[
01517                                 ir], &ldwrkr, &work[iu], &ldwrku, cdum, &c__1, 
01518                                  &rwork[irwork], info);
01519 
01520 /*                    Multiply Q in A by left singular vectors of R in */
01521 /*                    WORK(IU), storing result in U */
01522 /*                    (CWorkspace: need N*N) */
01523 /*                    (RWorkspace: 0) */
01524 
01525                         zgemm_("N", "N", m, n, n, &c_b2, &a[a_offset], lda, &
01526                                 work[iu], &ldwrku, &c_b1, &u[u_offset], ldu);
01527 
01528 /*                    Copy right singular vectors of R to A */
01529 /*                    (CWorkspace: need N*N) */
01530 /*                    (RWorkspace: 0) */
01531 
01532                         zlacpy_("F", n, n, &work[ir], &ldwrkr, &a[a_offset], 
01533                                 lda);
01534 
01535                     } else {
01536 
01537 /*                    Insufficient workspace for a fast algorithm */
01538 
01539                         itau = 1;
01540                         iwork = itau + *n;
01541 
01542 /*                    Compute A=Q*R, copying result to U */
01543 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
01544 /*                    (RWorkspace: 0) */
01545 
01546                         i__2 = *lwork - iwork + 1;
01547                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
01548                                 iwork], &i__2, &ierr);
01549                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
01550                                 ldu);
01551 
01552 /*                    Generate Q in U */
01553 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
01554 /*                    (RWorkspace: 0) */
01555 
01556                         i__2 = *lwork - iwork + 1;
01557                         zungqr_(m, n, n, &u[u_offset], ldu, &work[itau], &
01558                                 work[iwork], &i__2, &ierr);
01559                         ie = 1;
01560                         itauq = itau;
01561                         itaup = itauq + *n;
01562                         iwork = itaup + *n;
01563 
01564 /*                    Zero out below R in A */
01565 
01566                         i__2 = *n - 1;
01567                         i__3 = *n - 1;
01568                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &a[a_dim1 + 
01569                                 2], lda);
01570 
01571 /*                    Bidiagonalize R in A */
01572 /*                    (CWorkspace: need 3*N, prefer 2*N+2*N*NB) */
01573 /*                    (RWorkspace: need N) */
01574 
01575                         i__2 = *lwork - iwork + 1;
01576                         zgebrd_(n, n, &a[a_offset], lda, &s[1], &rwork[ie], &
01577                                 work[itauq], &work[itaup], &work[iwork], &
01578                                 i__2, &ierr);
01579 
01580 /*                    Multiply Q in U by left vectors bidiagonalizing R */
01581 /*                    (CWorkspace: need 2*N+M, prefer 2*N+M*NB) */
01582 /*                    (RWorkspace: 0) */
01583 
01584                         i__2 = *lwork - iwork + 1;
01585                         zunmbr_("Q", "R", "N", m, n, n, &a[a_offset], lda, &
01586                                 work[itauq], &u[u_offset], ldu, &work[iwork], 
01587                                 &i__2, &ierr)
01588                                 ;
01589 
01590 /*                    Generate right vectors bidiagonalizing R in A */
01591 /*                    (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
01592 /*                    (RWorkspace: 0) */
01593 
01594                         i__2 = *lwork - iwork + 1;
01595                         zungbr_("P", n, n, n, &a[a_offset], lda, &work[itaup], 
01596                                  &work[iwork], &i__2, &ierr);
01597                         irwork = ie + *n;
01598 
01599 /*                    Perform bidiagonal QR iteration, computing left */
01600 /*                    singular vectors of A in U and computing right */
01601 /*                    singular vectors of A in A */
01602 /*                    (CWorkspace: 0) */
01603 /*                    (RWorkspace: need BDSPAC) */
01604 
01605                         zbdsqr_("U", n, n, m, &c__0, &s[1], &rwork[ie], &a[
01606                                 a_offset], lda, &u[u_offset], ldu, cdum, &
01607                                 c__1, &rwork[irwork], info);
01608 
01609                     }
01610 
01611                 } else if (wntvas) {
01612 
01613 /*                 Path 6 (M much larger than N, JOBU='S', JOBVT='S' */
01614 /*                         or 'A') */
01615 /*                 N left singular vectors to be computed in U and */
01616 /*                 N right singular vectors to be computed in VT */
01617 
01618                     if (*lwork >= *n * *n + *n * 3) {
01619 
01620 /*                    Sufficient workspace for a fast algorithm */
01621 
01622                         iu = 1;
01623                         if (*lwork >= wrkbl + *lda * *n) {
01624 
01625 /*                       WORK(IU) is LDA by N */
01626 
01627                             ldwrku = *lda;
01628                         } else {
01629 
01630 /*                       WORK(IU) is N by N */
01631 
01632                             ldwrku = *n;
01633                         }
01634                         itau = iu + ldwrku * *n;
01635                         iwork = itau + *n;
01636 
01637 /*                    Compute A=Q*R */
01638 /*                    (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
01639 /*                    (RWorkspace: 0) */
01640 
01641                         i__2 = *lwork - iwork + 1;
01642                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
01643                                 iwork], &i__2, &ierr);
01644 
01645 /*                    Copy R to WORK(IU), zeroing out below it */
01646 
01647                         zlacpy_("U", n, n, &a[a_offset], lda, &work[iu], &
01648                                 ldwrku);
01649                         i__2 = *n - 1;
01650                         i__3 = *n - 1;
01651                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &work[iu + 1]
01652 , &ldwrku);
01653 
01654 /*                    Generate Q in A */
01655 /*                    (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
01656 /*                    (RWorkspace: 0) */
01657 
01658                         i__2 = *lwork - iwork + 1;
01659                         zungqr_(m, n, n, &a[a_offset], lda, &work[itau], &
01660                                 work[iwork], &i__2, &ierr);
01661                         ie = 1;
01662                         itauq = itau;
01663                         itaup = itauq + *n;
01664                         iwork = itaup + *n;
01665 
01666 /*                    Bidiagonalize R in WORK(IU), copying result to VT */
01667 /*                    (CWorkspace: need N*N+3*N, prefer N*N+2*N+2*N*NB) */
01668 /*                    (RWorkspace: need N) */
01669 
01670                         i__2 = *lwork - iwork + 1;
01671                         zgebrd_(n, n, &work[iu], &ldwrku, &s[1], &rwork[ie], &
01672                                 work[itauq], &work[itaup], &work[iwork], &
01673                                 i__2, &ierr);
01674                         zlacpy_("U", n, n, &work[iu], &ldwrku, &vt[vt_offset], 
01675                                  ldvt);
01676 
01677 /*                    Generate left bidiagonalizing vectors in WORK(IU) */
01678 /*                    (CWorkspace: need N*N+3*N, prefer N*N+2*N+N*NB) */
01679 /*                    (RWorkspace: 0) */
01680 
01681                         i__2 = *lwork - iwork + 1;
01682                         zungbr_("Q", n, n, n, &work[iu], &ldwrku, &work[itauq]
01683 , &work[iwork], &i__2, &ierr);
01684 
01685 /*                    Generate right bidiagonalizing vectors in VT */
01686 /*                    (CWorkspace: need   N*N+3*N-1, */
01687 /*                                 prefer N*N+2*N+(N-1)*NB) */
01688 /*                    (RWorkspace: 0) */
01689 
01690                         i__2 = *lwork - iwork + 1;
01691                         zungbr_("P", n, n, n, &vt[vt_offset], ldvt, &work[
01692                                 itaup], &work[iwork], &i__2, &ierr)
01693                                 ;
01694                         irwork = ie + *n;
01695 
01696 /*                    Perform bidiagonal QR iteration, computing left */
01697 /*                    singular vectors of R in WORK(IU) and computing */
01698 /*                    right singular vectors of R in VT */
01699 /*                    (CWorkspace: need N*N) */
01700 /*                    (RWorkspace: need BDSPAC) */
01701 
01702                         zbdsqr_("U", n, n, n, &c__0, &s[1], &rwork[ie], &vt[
01703                                 vt_offset], ldvt, &work[iu], &ldwrku, cdum, &
01704                                 c__1, &rwork[irwork], info);
01705 
01706 /*                    Multiply Q in A by left singular vectors of R in */
01707 /*                    WORK(IU), storing result in U */
01708 /*                    (CWorkspace: need N*N) */
01709 /*                    (RWorkspace: 0) */
01710 
01711                         zgemm_("N", "N", m, n, n, &c_b2, &a[a_offset], lda, &
01712                                 work[iu], &ldwrku, &c_b1, &u[u_offset], ldu);
01713 
01714                     } else {
01715 
01716 /*                    Insufficient workspace for a fast algorithm */
01717 
01718                         itau = 1;
01719                         iwork = itau + *n;
01720 
01721 /*                    Compute A=Q*R, copying result to U */
01722 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
01723 /*                    (RWorkspace: 0) */
01724 
01725                         i__2 = *lwork - iwork + 1;
01726                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
01727                                 iwork], &i__2, &ierr);
01728                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
01729                                 ldu);
01730 
01731 /*                    Generate Q in U */
01732 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
01733 /*                    (RWorkspace: 0) */
01734 
01735                         i__2 = *lwork - iwork + 1;
01736                         zungqr_(m, n, n, &u[u_offset], ldu, &work[itau], &
01737                                 work[iwork], &i__2, &ierr);
01738 
01739 /*                    Copy R to VT, zeroing out below it */
01740 
01741                         zlacpy_("U", n, n, &a[a_offset], lda, &vt[vt_offset], 
01742                                 ldvt);
01743                         if (*n > 1) {
01744                             i__2 = *n - 1;
01745                             i__3 = *n - 1;
01746                             zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &vt[
01747                                     vt_dim1 + 2], ldvt);
01748                         }
01749                         ie = 1;
01750                         itauq = itau;
01751                         itaup = itauq + *n;
01752                         iwork = itaup + *n;
01753 
01754 /*                    Bidiagonalize R in VT */
01755 /*                    (CWorkspace: need 3*N, prefer 2*N+2*N*NB) */
01756 /*                    (RWorkspace: need N) */
01757 
01758                         i__2 = *lwork - iwork + 1;
01759                         zgebrd_(n, n, &vt[vt_offset], ldvt, &s[1], &rwork[ie], 
01760                                  &work[itauq], &work[itaup], &work[iwork], &
01761                                 i__2, &ierr);
01762 
01763 /*                    Multiply Q in U by left bidiagonalizing vectors */
01764 /*                    in VT */
01765 /*                    (CWorkspace: need 2*N+M, prefer 2*N+M*NB) */
01766 /*                    (RWorkspace: 0) */
01767 
01768                         i__2 = *lwork - iwork + 1;
01769                         zunmbr_("Q", "R", "N", m, n, n, &vt[vt_offset], ldvt, 
01770                                 &work[itauq], &u[u_offset], ldu, &work[iwork], 
01771                                  &i__2, &ierr);
01772 
01773 /*                    Generate right bidiagonalizing vectors in VT */
01774 /*                    (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
01775 /*                    (RWorkspace: 0) */
01776 
01777                         i__2 = *lwork - iwork + 1;
01778                         zungbr_("P", n, n, n, &vt[vt_offset], ldvt, &work[
01779                                 itaup], &work[iwork], &i__2, &ierr)
01780                                 ;
01781                         irwork = ie + *n;
01782 
01783 /*                    Perform bidiagonal QR iteration, computing left */
01784 /*                    singular vectors of A in U and computing right */
01785 /*                    singular vectors of A in VT */
01786 /*                    (CWorkspace: 0) */
01787 /*                    (RWorkspace: need BDSPAC) */
01788 
01789                         zbdsqr_("U", n, n, m, &c__0, &s[1], &rwork[ie], &vt[
01790                                 vt_offset], ldvt, &u[u_offset], ldu, cdum, &
01791                                 c__1, &rwork[irwork], info);
01792 
01793                     }
01794 
01795                 }
01796 
01797             } else if (wntua) {
01798 
01799                 if (wntvn) {
01800 
01801 /*                 Path 7 (M much larger than N, JOBU='A', JOBVT='N') */
01802 /*                 M left singular vectors to be computed in U and */
01803 /*                 no right singular vectors to be computed */
01804 
01805 /* Computing MAX */
01806                     i__2 = *n + *m, i__3 = *n * 3;
01807                     if (*lwork >= *n * *n + max(i__2,i__3)) {
01808 
01809 /*                    Sufficient workspace for a fast algorithm */
01810 
01811                         ir = 1;
01812                         if (*lwork >= wrkbl + *lda * *n) {
01813 
01814 /*                       WORK(IR) is LDA by N */
01815 
01816                             ldwrkr = *lda;
01817                         } else {
01818 
01819 /*                       WORK(IR) is N by N */
01820 
01821                             ldwrkr = *n;
01822                         }
01823                         itau = ir + ldwrkr * *n;
01824                         iwork = itau + *n;
01825 
01826 /*                    Compute A=Q*R, copying result to U */
01827 /*                    (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
01828 /*                    (RWorkspace: 0) */
01829 
01830                         i__2 = *lwork - iwork + 1;
01831                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
01832                                 iwork], &i__2, &ierr);
01833                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
01834                                 ldu);
01835 
01836 /*                    Copy R to WORK(IR), zeroing out below it */
01837 
01838                         zlacpy_("U", n, n, &a[a_offset], lda, &work[ir], &
01839                                 ldwrkr);
01840                         i__2 = *n - 1;
01841                         i__3 = *n - 1;
01842                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &work[ir + 1]
01843 , &ldwrkr);
01844 
01845 /*                    Generate Q in U */
01846 /*                    (CWorkspace: need N*N+N+M, prefer N*N+N+M*NB) */
01847 /*                    (RWorkspace: 0) */
01848 
01849                         i__2 = *lwork - iwork + 1;
01850                         zungqr_(m, m, n, &u[u_offset], ldu, &work[itau], &
01851                                 work[iwork], &i__2, &ierr);
01852                         ie = 1;
01853                         itauq = itau;
01854                         itaup = itauq + *n;
01855                         iwork = itaup + *n;
01856 
01857 /*                    Bidiagonalize R in WORK(IR) */
01858 /*                    (CWorkspace: need N*N+3*N, prefer N*N+2*N+2*N*NB) */
01859 /*                    (RWorkspace: need N) */
01860 
01861                         i__2 = *lwork - iwork + 1;
01862                         zgebrd_(n, n, &work[ir], &ldwrkr, &s[1], &rwork[ie], &
01863                                 work[itauq], &work[itaup], &work[iwork], &
01864                                 i__2, &ierr);
01865 
01866 /*                    Generate left bidiagonalizing vectors in WORK(IR) */
01867 /*                    (CWorkspace: need N*N+3*N, prefer N*N+2*N+N*NB) */
01868 /*                    (RWorkspace: 0) */
01869 
01870                         i__2 = *lwork - iwork + 1;
01871                         zungbr_("Q", n, n, n, &work[ir], &ldwrkr, &work[itauq]
01872 , &work[iwork], &i__2, &ierr);
01873                         irwork = ie + *n;
01874 
01875 /*                    Perform bidiagonal QR iteration, computing left */
01876 /*                    singular vectors of R in WORK(IR) */
01877 /*                    (CWorkspace: need N*N) */
01878 /*                    (RWorkspace: need BDSPAC) */
01879 
01880                         zbdsqr_("U", n, &c__0, n, &c__0, &s[1], &rwork[ie], 
01881                                 cdum, &c__1, &work[ir], &ldwrkr, cdum, &c__1, 
01882                                 &rwork[irwork], info);
01883 
01884 /*                    Multiply Q in U by left singular vectors of R in */
01885 /*                    WORK(IR), storing result in A */
01886 /*                    (CWorkspace: need N*N) */
01887 /*                    (RWorkspace: 0) */
01888 
01889                         zgemm_("N", "N", m, n, n, &c_b2, &u[u_offset], ldu, &
01890                                 work[ir], &ldwrkr, &c_b1, &a[a_offset], lda);
01891 
01892 /*                    Copy left singular vectors of A from A to U */
01893 
01894                         zlacpy_("F", m, n, &a[a_offset], lda, &u[u_offset], 
01895                                 ldu);
01896 
01897                     } else {
01898 
01899 /*                    Insufficient workspace for a fast algorithm */
01900 
01901                         itau = 1;
01902                         iwork = itau + *n;
01903 
01904 /*                    Compute A=Q*R, copying result to U */
01905 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
01906 /*                    (RWorkspace: 0) */
01907 
01908                         i__2 = *lwork - iwork + 1;
01909                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
01910                                 iwork], &i__2, &ierr);
01911                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
01912                                 ldu);
01913 
01914 /*                    Generate Q in U */
01915 /*                    (CWorkspace: need N+M, prefer N+M*NB) */
01916 /*                    (RWorkspace: 0) */
01917 
01918                         i__2 = *lwork - iwork + 1;
01919                         zungqr_(m, m, n, &u[u_offset], ldu, &work[itau], &
01920                                 work[iwork], &i__2, &ierr);
01921                         ie = 1;
01922                         itauq = itau;
01923                         itaup = itauq + *n;
01924                         iwork = itaup + *n;
01925 
01926 /*                    Zero out below R in A */
01927 
01928                         i__2 = *n - 1;
01929                         i__3 = *n - 1;
01930                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &a[a_dim1 + 
01931                                 2], lda);
01932 
01933 /*                    Bidiagonalize R in A */
01934 /*                    (CWorkspace: need 3*N, prefer 2*N+2*N*NB) */
01935 /*                    (RWorkspace: need N) */
01936 
01937                         i__2 = *lwork - iwork + 1;
01938                         zgebrd_(n, n, &a[a_offset], lda, &s[1], &rwork[ie], &
01939                                 work[itauq], &work[itaup], &work[iwork], &
01940                                 i__2, &ierr);
01941 
01942 /*                    Multiply Q in U by left bidiagonalizing vectors */
01943 /*                    in A */
01944 /*                    (CWorkspace: need 2*N+M, prefer 2*N+M*NB) */
01945 /*                    (RWorkspace: 0) */
01946 
01947                         i__2 = *lwork - iwork + 1;
01948                         zunmbr_("Q", "R", "N", m, n, n, &a[a_offset], lda, &
01949                                 work[itauq], &u[u_offset], ldu, &work[iwork], 
01950                                 &i__2, &ierr)
01951                                 ;
01952                         irwork = ie + *n;
01953 
01954 /*                    Perform bidiagonal QR iteration, computing left */
01955 /*                    singular vectors of A in U */
01956 /*                    (CWorkspace: 0) */
01957 /*                    (RWorkspace: need BDSPAC) */
01958 
01959                         zbdsqr_("U", n, &c__0, m, &c__0, &s[1], &rwork[ie], 
01960                                 cdum, &c__1, &u[u_offset], ldu, cdum, &c__1, &
01961                                 rwork[irwork], info);
01962 
01963                     }
01964 
01965                 } else if (wntvo) {
01966 
01967 /*                 Path 8 (M much larger than N, JOBU='A', JOBVT='O') */
01968 /*                 M left singular vectors to be computed in U and */
01969 /*                 N right singular vectors to be overwritten on A */
01970 
01971 /* Computing MAX */
01972                     i__2 = *n + *m, i__3 = *n * 3;
01973                     if (*lwork >= (*n << 1) * *n + max(i__2,i__3)) {
01974 
01975 /*                    Sufficient workspace for a fast algorithm */
01976 
01977                         iu = 1;
01978                         if (*lwork >= wrkbl + (*lda << 1) * *n) {
01979 
01980 /*                       WORK(IU) is LDA by N and WORK(IR) is LDA by N */
01981 
01982                             ldwrku = *lda;
01983                             ir = iu + ldwrku * *n;
01984                             ldwrkr = *lda;
01985                         } else if (*lwork >= wrkbl + (*lda + *n) * *n) {
01986 
01987 /*                       WORK(IU) is LDA by N and WORK(IR) is N by N */
01988 
01989                             ldwrku = *lda;
01990                             ir = iu + ldwrku * *n;
01991                             ldwrkr = *n;
01992                         } else {
01993 
01994 /*                       WORK(IU) is N by N and WORK(IR) is N by N */
01995 
01996                             ldwrku = *n;
01997                             ir = iu + ldwrku * *n;
01998                             ldwrkr = *n;
01999                         }
02000                         itau = ir + ldwrkr * *n;
02001                         iwork = itau + *n;
02002 
02003 /*                    Compute A=Q*R, copying result to U */
02004 /*                    (CWorkspace: need 2*N*N+2*N, prefer 2*N*N+N+N*NB) */
02005 /*                    (RWorkspace: 0) */
02006 
02007                         i__2 = *lwork - iwork + 1;
02008                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
02009                                 iwork], &i__2, &ierr);
02010                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
02011                                 ldu);
02012 
02013 /*                    Generate Q in U */
02014 /*                    (CWorkspace: need 2*N*N+N+M, prefer 2*N*N+N+M*NB) */
02015 /*                    (RWorkspace: 0) */
02016 
02017                         i__2 = *lwork - iwork + 1;
02018                         zungqr_(m, m, n, &u[u_offset], ldu, &work[itau], &
02019                                 work[iwork], &i__2, &ierr);
02020 
02021 /*                    Copy R to WORK(IU), zeroing out below it */
02022 
02023                         zlacpy_("U", n, n, &a[a_offset], lda, &work[iu], &
02024                                 ldwrku);
02025                         i__2 = *n - 1;
02026                         i__3 = *n - 1;
02027                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &work[iu + 1]
02028 , &ldwrku);
02029                         ie = 1;
02030                         itauq = itau;
02031                         itaup = itauq + *n;
02032                         iwork = itaup + *n;
02033 
02034 /*                    Bidiagonalize R in WORK(IU), copying result to */
02035 /*                    WORK(IR) */
02036 /*                    (CWorkspace: need   2*N*N+3*N, */
02037 /*                                 prefer 2*N*N+2*N+2*N*NB) */
02038 /*                    (RWorkspace: need   N) */
02039 
02040                         i__2 = *lwork - iwork + 1;
02041                         zgebrd_(n, n, &work[iu], &ldwrku, &s[1], &rwork[ie], &
02042                                 work[itauq], &work[itaup], &work[iwork], &
02043                                 i__2, &ierr);
02044                         zlacpy_("U", n, n, &work[iu], &ldwrku, &work[ir], &
02045                                 ldwrkr);
02046 
02047 /*                    Generate left bidiagonalizing vectors in WORK(IU) */
02048 /*                    (CWorkspace: need 2*N*N+3*N, prefer 2*N*N+2*N+N*NB) */
02049 /*                    (RWorkspace: 0) */
02050 
02051                         i__2 = *lwork - iwork + 1;
02052                         zungbr_("Q", n, n, n, &work[iu], &ldwrku, &work[itauq]
02053 , &work[iwork], &i__2, &ierr);
02054 
02055 /*                    Generate right bidiagonalizing vectors in WORK(IR) */
02056 /*                    (CWorkspace: need   2*N*N+3*N-1, */
02057 /*                                 prefer 2*N*N+2*N+(N-1)*NB) */
02058 /*                    (RWorkspace: 0) */
02059 
02060                         i__2 = *lwork - iwork + 1;
02061                         zungbr_("P", n, n, n, &work[ir], &ldwrkr, &work[itaup]
02062 , &work[iwork], &i__2, &ierr);
02063                         irwork = ie + *n;
02064 
02065 /*                    Perform bidiagonal QR iteration, computing left */
02066 /*                    singular vectors of R in WORK(IU) and computing */
02067 /*                    right singular vectors of R in WORK(IR) */
02068 /*                    (CWorkspace: need 2*N*N) */
02069 /*                    (RWorkspace: need BDSPAC) */
02070 
02071                         zbdsqr_("U", n, n, n, &c__0, &s[1], &rwork[ie], &work[
02072                                 ir], &ldwrkr, &work[iu], &ldwrku, cdum, &c__1, 
02073                                  &rwork[irwork], info);
02074 
02075 /*                    Multiply Q in U by left singular vectors of R in */
02076 /*                    WORK(IU), storing result in A */
02077 /*                    (CWorkspace: need N*N) */
02078 /*                    (RWorkspace: 0) */
02079 
02080                         zgemm_("N", "N", m, n, n, &c_b2, &u[u_offset], ldu, &
02081                                 work[iu], &ldwrku, &c_b1, &a[a_offset], lda);
02082 
02083 /*                    Copy left singular vectors of A from A to U */
02084 
02085                         zlacpy_("F", m, n, &a[a_offset], lda, &u[u_offset], 
02086                                 ldu);
02087 
02088 /*                    Copy right singular vectors of R from WORK(IR) to A */
02089 
02090                         zlacpy_("F", n, n, &work[ir], &ldwrkr, &a[a_offset], 
02091                                 lda);
02092 
02093                     } else {
02094 
02095 /*                    Insufficient workspace for a fast algorithm */
02096 
02097                         itau = 1;
02098                         iwork = itau + *n;
02099 
02100 /*                    Compute A=Q*R, copying result to U */
02101 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
02102 /*                    (RWorkspace: 0) */
02103 
02104                         i__2 = *lwork - iwork + 1;
02105                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
02106                                 iwork], &i__2, &ierr);
02107                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
02108                                 ldu);
02109 
02110 /*                    Generate Q in U */
02111 /*                    (CWorkspace: need N+M, prefer N+M*NB) */
02112 /*                    (RWorkspace: 0) */
02113 
02114                         i__2 = *lwork - iwork + 1;
02115                         zungqr_(m, m, n, &u[u_offset], ldu, &work[itau], &
02116                                 work[iwork], &i__2, &ierr);
02117                         ie = 1;
02118                         itauq = itau;
02119                         itaup = itauq + *n;
02120                         iwork = itaup + *n;
02121 
02122 /*                    Zero out below R in A */
02123 
02124                         i__2 = *n - 1;
02125                         i__3 = *n - 1;
02126                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &a[a_dim1 + 
02127                                 2], lda);
02128 
02129 /*                    Bidiagonalize R in A */
02130 /*                    (CWorkspace: need 3*N, prefer 2*N+2*N*NB) */
02131 /*                    (RWorkspace: need N) */
02132 
02133                         i__2 = *lwork - iwork + 1;
02134                         zgebrd_(n, n, &a[a_offset], lda, &s[1], &rwork[ie], &
02135                                 work[itauq], &work[itaup], &work[iwork], &
02136                                 i__2, &ierr);
02137 
02138 /*                    Multiply Q in U by left bidiagonalizing vectors */
02139 /*                    in A */
02140 /*                    (CWorkspace: need 2*N+M, prefer 2*N+M*NB) */
02141 /*                    (RWorkspace: 0) */
02142 
02143                         i__2 = *lwork - iwork + 1;
02144                         zunmbr_("Q", "R", "N", m, n, n, &a[a_offset], lda, &
02145                                 work[itauq], &u[u_offset], ldu, &work[iwork], 
02146                                 &i__2, &ierr)
02147                                 ;
02148 
02149 /*                    Generate right bidiagonalizing vectors in A */
02150 /*                    (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
02151 /*                    (RWorkspace: 0) */
02152 
02153                         i__2 = *lwork - iwork + 1;
02154                         zungbr_("P", n, n, n, &a[a_offset], lda, &work[itaup], 
02155                                  &work[iwork], &i__2, &ierr);
02156                         irwork = ie + *n;
02157 
02158 /*                    Perform bidiagonal QR iteration, computing left */
02159 /*                    singular vectors of A in U and computing right */
02160 /*                    singular vectors of A in A */
02161 /*                    (CWorkspace: 0) */
02162 /*                    (RWorkspace: need BDSPAC) */
02163 
02164                         zbdsqr_("U", n, n, m, &c__0, &s[1], &rwork[ie], &a[
02165                                 a_offset], lda, &u[u_offset], ldu, cdum, &
02166                                 c__1, &rwork[irwork], info);
02167 
02168                     }
02169 
02170                 } else if (wntvas) {
02171 
02172 /*                 Path 9 (M much larger than N, JOBU='A', JOBVT='S' */
02173 /*                         or 'A') */
02174 /*                 M left singular vectors to be computed in U and */
02175 /*                 N right singular vectors to be computed in VT */
02176 
02177 /* Computing MAX */
02178                     i__2 = *n + *m, i__3 = *n * 3;
02179                     if (*lwork >= *n * *n + max(i__2,i__3)) {
02180 
02181 /*                    Sufficient workspace for a fast algorithm */
02182 
02183                         iu = 1;
02184                         if (*lwork >= wrkbl + *lda * *n) {
02185 
02186 /*                       WORK(IU) is LDA by N */
02187 
02188                             ldwrku = *lda;
02189                         } else {
02190 
02191 /*                       WORK(IU) is N by N */
02192 
02193                             ldwrku = *n;
02194                         }
02195                         itau = iu + ldwrku * *n;
02196                         iwork = itau + *n;
02197 
02198 /*                    Compute A=Q*R, copying result to U */
02199 /*                    (CWorkspace: need N*N+2*N, prefer N*N+N+N*NB) */
02200 /*                    (RWorkspace: 0) */
02201 
02202                         i__2 = *lwork - iwork + 1;
02203                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
02204                                 iwork], &i__2, &ierr);
02205                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
02206                                 ldu);
02207 
02208 /*                    Generate Q in U */
02209 /*                    (CWorkspace: need N*N+N+M, prefer N*N+N+M*NB) */
02210 /*                    (RWorkspace: 0) */
02211 
02212                         i__2 = *lwork - iwork + 1;
02213                         zungqr_(m, m, n, &u[u_offset], ldu, &work[itau], &
02214                                 work[iwork], &i__2, &ierr);
02215 
02216 /*                    Copy R to WORK(IU), zeroing out below it */
02217 
02218                         zlacpy_("U", n, n, &a[a_offset], lda, &work[iu], &
02219                                 ldwrku);
02220                         i__2 = *n - 1;
02221                         i__3 = *n - 1;
02222                         zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &work[iu + 1]
02223 , &ldwrku);
02224                         ie = 1;
02225                         itauq = itau;
02226                         itaup = itauq + *n;
02227                         iwork = itaup + *n;
02228 
02229 /*                    Bidiagonalize R in WORK(IU), copying result to VT */
02230 /*                    (CWorkspace: need N*N+3*N, prefer N*N+2*N+2*N*NB) */
02231 /*                    (RWorkspace: need N) */
02232 
02233                         i__2 = *lwork - iwork + 1;
02234                         zgebrd_(n, n, &work[iu], &ldwrku, &s[1], &rwork[ie], &
02235                                 work[itauq], &work[itaup], &work[iwork], &
02236                                 i__2, &ierr);
02237                         zlacpy_("U", n, n, &work[iu], &ldwrku, &vt[vt_offset], 
02238                                  ldvt);
02239 
02240 /*                    Generate left bidiagonalizing vectors in WORK(IU) */
02241 /*                    (CWorkspace: need N*N+3*N, prefer N*N+2*N+N*NB) */
02242 /*                    (RWorkspace: 0) */
02243 
02244                         i__2 = *lwork - iwork + 1;
02245                         zungbr_("Q", n, n, n, &work[iu], &ldwrku, &work[itauq]
02246 , &work[iwork], &i__2, &ierr);
02247 
02248 /*                    Generate right bidiagonalizing vectors in VT */
02249 /*                    (CWorkspace: need   N*N+3*N-1, */
02250 /*                                 prefer N*N+2*N+(N-1)*NB) */
02251 /*                    (RWorkspace: need   0) */
02252 
02253                         i__2 = *lwork - iwork + 1;
02254                         zungbr_("P", n, n, n, &vt[vt_offset], ldvt, &work[
02255                                 itaup], &work[iwork], &i__2, &ierr)
02256                                 ;
02257                         irwork = ie + *n;
02258 
02259 /*                    Perform bidiagonal QR iteration, computing left */
02260 /*                    singular vectors of R in WORK(IU) and computing */
02261 /*                    right singular vectors of R in VT */
02262 /*                    (CWorkspace: need N*N) */
02263 /*                    (RWorkspace: need BDSPAC) */
02264 
02265                         zbdsqr_("U", n, n, n, &c__0, &s[1], &rwork[ie], &vt[
02266                                 vt_offset], ldvt, &work[iu], &ldwrku, cdum, &
02267                                 c__1, &rwork[irwork], info);
02268 
02269 /*                    Multiply Q in U by left singular vectors of R in */
02270 /*                    WORK(IU), storing result in A */
02271 /*                    (CWorkspace: need N*N) */
02272 /*                    (RWorkspace: 0) */
02273 
02274                         zgemm_("N", "N", m, n, n, &c_b2, &u[u_offset], ldu, &
02275                                 work[iu], &ldwrku, &c_b1, &a[a_offset], lda);
02276 
02277 /*                    Copy left singular vectors of A from A to U */
02278 
02279                         zlacpy_("F", m, n, &a[a_offset], lda, &u[u_offset], 
02280                                 ldu);
02281 
02282                     } else {
02283 
02284 /*                    Insufficient workspace for a fast algorithm */
02285 
02286                         itau = 1;
02287                         iwork = itau + *n;
02288 
02289 /*                    Compute A=Q*R, copying result to U */
02290 /*                    (CWorkspace: need 2*N, prefer N+N*NB) */
02291 /*                    (RWorkspace: 0) */
02292 
02293                         i__2 = *lwork - iwork + 1;
02294                         zgeqrf_(m, n, &a[a_offset], lda, &work[itau], &work[
02295                                 iwork], &i__2, &ierr);
02296                         zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], 
02297                                 ldu);
02298 
02299 /*                    Generate Q in U */
02300 /*                    (CWorkspace: need N+M, prefer N+M*NB) */
02301 /*                    (RWorkspace: 0) */
02302 
02303                         i__2 = *lwork - iwork + 1;
02304                         zungqr_(m, m, n, &u[u_offset], ldu, &work[itau], &
02305                                 work[iwork], &i__2, &ierr);
02306 
02307 /*                    Copy R from A to VT, zeroing out below it */
02308 
02309                         zlacpy_("U", n, n, &a[a_offset], lda, &vt[vt_offset], 
02310                                 ldvt);
02311                         if (*n > 1) {
02312                             i__2 = *n - 1;
02313                             i__3 = *n - 1;
02314                             zlaset_("L", &i__2, &i__3, &c_b1, &c_b1, &vt[
02315                                     vt_dim1 + 2], ldvt);
02316                         }
02317                         ie = 1;
02318                         itauq = itau;
02319                         itaup = itauq + *n;
02320                         iwork = itaup + *n;
02321 
02322 /*                    Bidiagonalize R in VT */
02323 /*                    (CWorkspace: need 3*N, prefer 2*N+2*N*NB) */
02324 /*                    (RWorkspace: need N) */
02325 
02326                         i__2 = *lwork - iwork + 1;
02327                         zgebrd_(n, n, &vt[vt_offset], ldvt, &s[1], &rwork[ie], 
02328                                  &work[itauq], &work[itaup], &work[iwork], &
02329                                 i__2, &ierr);
02330 
02331 /*                    Multiply Q in U by left bidiagonalizing vectors */
02332 /*                    in VT */
02333 /*                    (CWorkspace: need 2*N+M, prefer 2*N+M*NB) */
02334 /*                    (RWorkspace: 0) */
02335 
02336                         i__2 = *lwork - iwork + 1;
02337                         zunmbr_("Q", "R", "N", m, n, n, &vt[vt_offset], ldvt, 
02338                                 &work[itauq], &u[u_offset], ldu, &work[iwork], 
02339                                  &i__2, &ierr);
02340 
02341 /*                    Generate right bidiagonalizing vectors in VT */
02342 /*                    (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
02343 /*                    (RWorkspace: 0) */
02344 
02345                         i__2 = *lwork - iwork + 1;
02346                         zungbr_("P", n, n, n, &vt[vt_offset], ldvt, &work[
02347                                 itaup], &work[iwork], &i__2, &ierr)
02348                                 ;
02349                         irwork = ie + *n;
02350 
02351 /*                    Perform bidiagonal QR iteration, computing left */
02352 /*                    singular vectors of A in U and computing right */
02353 /*                    singular vectors of A in VT */
02354 /*                    (CWorkspace: 0) */
02355 /*                    (RWorkspace: need BDSPAC) */
02356 
02357                         zbdsqr_("U", n, n, m, &c__0, &s[1], &rwork[ie], &vt[
02358                                 vt_offset], ldvt, &u[u_offset], ldu, cdum, &
02359                                 c__1, &rwork[irwork], info);
02360 
02361                     }
02362 
02363                 }
02364 
02365             }
02366 
02367         } else {
02368 
02369 /*           M .LT. MNTHR */
02370 
02371 /*           Path 10 (M at least N, but not much larger) */
02372 /*           Reduce to bidiagonal form without QR decomposition */
02373 
02374             ie = 1;
02375             itauq = 1;
02376             itaup = itauq + *n;
02377             iwork = itaup + *n;
02378 
02379 /*           Bidiagonalize A */
02380 /*           (CWorkspace: need 2*N+M, prefer 2*N+(M+N)*NB) */
02381 /*           (RWorkspace: need N) */
02382 
02383             i__2 = *lwork - iwork + 1;
02384             zgebrd_(m, n, &a[a_offset], lda, &s[1], &rwork[ie], &work[itauq], 
02385                     &work[itaup], &work[iwork], &i__2, &ierr);
02386             if (wntuas) {
02387 
02388 /*              If left singular vectors desired in U, copy result to U */
02389 /*              and generate left bidiagonalizing vectors in U */
02390 /*              (CWorkspace: need 2*N+NCU, prefer 2*N+NCU*NB) */
02391 /*              (RWorkspace: 0) */
02392 
02393                 zlacpy_("L", m, n, &a[a_offset], lda, &u[u_offset], ldu);
02394                 if (wntus) {
02395                     ncu = *n;
02396                 }
02397                 if (wntua) {
02398                     ncu = *m;
02399                 }
02400                 i__2 = *lwork - iwork + 1;
02401                 zungbr_("Q", m, &ncu, n, &u[u_offset], ldu, &work[itauq], &
02402                         work[iwork], &i__2, &ierr);
02403             }
02404             if (wntvas) {
02405 
02406 /*              If right singular vectors desired in VT, copy result to */
02407 /*              VT and generate right bidiagonalizing vectors in VT */
02408 /*              (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
02409 /*              (RWorkspace: 0) */
02410 
02411                 zlacpy_("U", n, n, &a[a_offset], lda, &vt[vt_offset], ldvt);
02412                 i__2 = *lwork - iwork + 1;
02413                 zungbr_("P", n, n, n, &vt[vt_offset], ldvt, &work[itaup], &
02414                         work[iwork], &i__2, &ierr);
02415             }
02416             if (wntuo) {
02417 
02418 /*              If left singular vectors desired in A, generate left */
02419 /*              bidiagonalizing vectors in A */
02420 /*              (CWorkspace: need 3*N, prefer 2*N+N*NB) */
02421 /*              (RWorkspace: 0) */
02422 
02423                 i__2 = *lwork - iwork + 1;
02424                 zungbr_("Q", m, n, n, &a[a_offset], lda, &work[itauq], &work[
02425                         iwork], &i__2, &ierr);
02426             }
02427             if (wntvo) {
02428 
02429 /*              If right singular vectors desired in A, generate right */
02430 /*              bidiagonalizing vectors in A */
02431 /*              (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB) */
02432 /*              (RWorkspace: 0) */
02433 
02434                 i__2 = *lwork - iwork + 1;
02435                 zungbr_("P", n, n, n, &a[a_offset], lda, &work[itaup], &work[
02436                         iwork], &i__2, &ierr);
02437             }
02438             irwork = ie + *n;
02439             if (wntuas || wntuo) {
02440                 nru = *m;
02441             }
02442             if (wntun) {
02443                 nru = 0;
02444             }
02445             if (wntvas || wntvo) {
02446                 ncvt = *n;
02447             }
02448             if (wntvn) {
02449                 ncvt = 0;
02450             }
02451             if (! wntuo && ! wntvo) {
02452 
02453 /*              Perform bidiagonal QR iteration, if desired, computing */
02454 /*              left singular vectors in U and computing right singular */
02455 /*              vectors in VT */
02456 /*              (CWorkspace: 0) */
02457 /*              (RWorkspace: need BDSPAC) */
02458 
02459                 zbdsqr_("U", n, &ncvt, &nru, &c__0, &s[1], &rwork[ie], &vt[
02460                         vt_offset], ldvt, &u[u_offset], ldu, cdum, &c__1, &
02461                         rwork[irwork], info);
02462             } else if (! wntuo && wntvo) {
02463 
02464 /*              Perform bidiagonal QR iteration, if desired, computing */
02465 /*              left singular vectors in U and computing right singular */
02466 /*              vectors in A */
02467 /*              (CWorkspace: 0) */
02468 /*              (RWorkspace: need BDSPAC) */
02469 
02470                 zbdsqr_("U", n, &ncvt, &nru, &c__0, &s[1], &rwork[ie], &a[
02471                         a_offset], lda, &u[u_offset], ldu, cdum, &c__1, &
02472                         rwork[irwork], info);
02473             } else {
02474 
02475 /*              Perform bidiagonal QR iteration, if desired, computing */
02476 /*              left singular vectors in A and computing right singular */
02477 /*              vectors in VT */
02478 /*              (CWorkspace: 0) */
02479 /*              (RWorkspace: need BDSPAC) */
02480 
02481                 zbdsqr_("U", n, &ncvt, &nru, &c__0, &s[1], &rwork[ie], &vt[
02482                         vt_offset], ldvt, &a[a_offset], lda, cdum, &c__1, &
02483                         rwork[irwork], info);
02484             }
02485 
02486         }
02487 
02488     } else {
02489 
02490 /*        A has more columns than rows. If A has sufficiently more */
02491 /*        columns than rows, first reduce using the LQ decomposition (if */
02492 /*        sufficient workspace available) */
02493 
02494         if (*n >= mnthr) {
02495 
02496             if (wntvn) {
02497 
02498 /*              Path 1t(N much larger than M, JOBVT='N') */
02499 /*              No right singular vectors to be computed */
02500 
02501                 itau = 1;
02502                 iwork = itau + *m;
02503 
02504 /*              Compute A=L*Q */
02505 /*              (CWorkspace: need 2*M, prefer M+M*NB) */
02506 /*              (RWorkspace: 0) */
02507 
02508                 i__2 = *lwork - iwork + 1;
02509                 zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[iwork], &
02510                         i__2, &ierr);
02511 
02512 /*              Zero out above L */
02513 
02514                 i__2 = *m - 1;
02515                 i__3 = *m - 1;
02516                 zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &a[(a_dim1 << 1) + 1]
02517 , lda);
02518                 ie = 1;
02519                 itauq = 1;
02520                 itaup = itauq + *m;
02521                 iwork = itaup + *m;
02522 
02523 /*              Bidiagonalize L in A */
02524 /*              (CWorkspace: need 3*M, prefer 2*M+2*M*NB) */
02525 /*              (RWorkspace: need M) */
02526 
02527                 i__2 = *lwork - iwork + 1;
02528                 zgebrd_(m, m, &a[a_offset], lda, &s[1], &rwork[ie], &work[
02529                         itauq], &work[itaup], &work[iwork], &i__2, &ierr);
02530                 if (wntuo || wntuas) {
02531 
02532 /*                 If left singular vectors desired, generate Q */
02533 /*                 (CWorkspace: need 3*M, prefer 2*M+M*NB) */
02534 /*                 (RWorkspace: 0) */
02535 
02536                     i__2 = *lwork - iwork + 1;
02537                     zungbr_("Q", m, m, m, &a[a_offset], lda, &work[itauq], &
02538                             work[iwork], &i__2, &ierr);
02539                 }
02540                 irwork = ie + *m;
02541                 nru = 0;
02542                 if (wntuo || wntuas) {
02543                     nru = *m;
02544                 }
02545 
02546 /*              Perform bidiagonal QR iteration, computing left singular */
02547 /*              vectors of A in A if desired */
02548 /*              (CWorkspace: 0) */
02549 /*              (RWorkspace: need BDSPAC) */
02550 
02551                 zbdsqr_("U", m, &c__0, &nru, &c__0, &s[1], &rwork[ie], cdum, &
02552                         c__1, &a[a_offset], lda, cdum, &c__1, &rwork[irwork], 
02553                         info);
02554 
02555 /*              If left singular vectors desired in U, copy them there */
02556 
02557                 if (wntuas) {
02558                     zlacpy_("F", m, m, &a[a_offset], lda, &u[u_offset], ldu);
02559                 }
02560 
02561             } else if (wntvo && wntun) {
02562 
02563 /*              Path 2t(N much larger than M, JOBU='N', JOBVT='O') */
02564 /*              M right singular vectors to be overwritten on A and */
02565 /*              no left singular vectors to be computed */
02566 
02567                 if (*lwork >= *m * *m + *m * 3) {
02568 
02569 /*                 Sufficient workspace for a fast algorithm */
02570 
02571                     ir = 1;
02572 /* Computing MAX */
02573                     i__2 = wrkbl, i__3 = *lda * *n;
02574                     if (*lwork >= max(i__2,i__3) + *lda * *m) {
02575 
02576 /*                    WORK(IU) is LDA by N and WORK(IR) is LDA by M */
02577 
02578                         ldwrku = *lda;
02579                         chunk = *n;
02580                         ldwrkr = *lda;
02581                     } else /* if(complicated condition) */ {
02582 /* Computing MAX */
02583                         i__2 = wrkbl, i__3 = *lda * *n;
02584                         if (*lwork >= max(i__2,i__3) + *m * *m) {
02585 
02586 /*                    WORK(IU) is LDA by N and WORK(IR) is M by M */
02587 
02588                             ldwrku = *lda;
02589                             chunk = *n;
02590                             ldwrkr = *m;
02591                         } else {
02592 
02593 /*                    WORK(IU) is M by CHUNK and WORK(IR) is M by M */
02594 
02595                             ldwrku = *m;
02596                             chunk = (*lwork - *m * *m) / *m;
02597                             ldwrkr = *m;
02598                         }
02599                     }
02600                     itau = ir + ldwrkr * *m;
02601                     iwork = itau + *m;
02602 
02603 /*                 Compute A=L*Q */
02604 /*                 (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
02605 /*                 (RWorkspace: 0) */
02606 
02607                     i__2 = *lwork - iwork + 1;
02608                     zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[iwork]
02609 , &i__2, &ierr);
02610 
02611 /*                 Copy L to WORK(IR) and zero out above it */
02612 
02613                     zlacpy_("L", m, m, &a[a_offset], lda, &work[ir], &ldwrkr);
02614                     i__2 = *m - 1;
02615                     i__3 = *m - 1;
02616                     zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &work[ir + 
02617                             ldwrkr], &ldwrkr);
02618 
02619 /*                 Generate Q in A */
02620 /*                 (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
02621 /*                 (RWorkspace: 0) */
02622 
02623                     i__2 = *lwork - iwork + 1;
02624                     zunglq_(m, n, m, &a[a_offset], lda, &work[itau], &work[
02625                             iwork], &i__2, &ierr);
02626                     ie = 1;
02627                     itauq = itau;
02628                     itaup = itauq + *m;
02629                     iwork = itaup + *m;
02630 
02631 /*                 Bidiagonalize L in WORK(IR) */
02632 /*                 (CWorkspace: need M*M+3*M, prefer M*M+2*M+2*M*NB) */
02633 /*                 (RWorkspace: need M) */
02634 
02635                     i__2 = *lwork - iwork + 1;
02636                     zgebrd_(m, m, &work[ir], &ldwrkr, &s[1], &rwork[ie], &
02637                             work[itauq], &work[itaup], &work[iwork], &i__2, &
02638                             ierr);
02639 
02640 /*                 Generate right vectors bidiagonalizing L */
02641 /*                 (CWorkspace: need M*M+3*M-1, prefer M*M+2*M+(M-1)*NB) */
02642 /*                 (RWorkspace: 0) */
02643 
02644                     i__2 = *lwork - iwork + 1;
02645                     zungbr_("P", m, m, m, &work[ir], &ldwrkr, &work[itaup], &
02646                             work[iwork], &i__2, &ierr);
02647                     irwork = ie + *m;
02648 
02649 /*                 Perform bidiagonal QR iteration, computing right */
02650 /*                 singular vectors of L in WORK(IR) */
02651 /*                 (CWorkspace: need M*M) */
02652 /*                 (RWorkspace: need BDSPAC) */
02653 
02654                     zbdsqr_("U", m, m, &c__0, &c__0, &s[1], &rwork[ie], &work[
02655                             ir], &ldwrkr, cdum, &c__1, cdum, &c__1, &rwork[
02656                             irwork], info);
02657                     iu = itauq;
02658 
02659 /*                 Multiply right singular vectors of L in WORK(IR) by Q */
02660 /*                 in A, storing result in WORK(IU) and copying to A */
02661 /*                 (CWorkspace: need M*M+M, prefer M*M+M*N) */
02662 /*                 (RWorkspace: 0) */
02663 
02664                     i__2 = *n;
02665                     i__3 = chunk;
02666                     for (i__ = 1; i__3 < 0 ? i__ >= i__2 : i__ <= i__2; i__ +=
02667                              i__3) {
02668 /* Computing MIN */
02669                         i__4 = *n - i__ + 1;
02670                         blk = min(i__4,chunk);
02671                         zgemm_("N", "N", m, &blk, m, &c_b2, &work[ir], &
02672                                 ldwrkr, &a[i__ * a_dim1 + 1], lda, &c_b1, &
02673                                 work[iu], &ldwrku);
02674                         zlacpy_("F", m, &blk, &work[iu], &ldwrku, &a[i__ * 
02675                                 a_dim1 + 1], lda);
02676 /* L30: */
02677                     }
02678 
02679                 } else {
02680 
02681 /*                 Insufficient workspace for a fast algorithm */
02682 
02683                     ie = 1;
02684                     itauq = 1;
02685                     itaup = itauq + *m;
02686                     iwork = itaup + *m;
02687 
02688 /*                 Bidiagonalize A */
02689 /*                 (CWorkspace: need 2*M+N, prefer 2*M+(M+N)*NB) */
02690 /*                 (RWorkspace: need M) */
02691 
02692                     i__3 = *lwork - iwork + 1;
02693                     zgebrd_(m, n, &a[a_offset], lda, &s[1], &rwork[ie], &work[
02694                             itauq], &work[itaup], &work[iwork], &i__3, &ierr);
02695 
02696 /*                 Generate right vectors bidiagonalizing A */
02697 /*                 (CWorkspace: need 3*M, prefer 2*M+M*NB) */
02698 /*                 (RWorkspace: 0) */
02699 
02700                     i__3 = *lwork - iwork + 1;
02701                     zungbr_("P", m, n, m, &a[a_offset], lda, &work[itaup], &
02702                             work[iwork], &i__3, &ierr);
02703                     irwork = ie + *m;
02704 
02705 /*                 Perform bidiagonal QR iteration, computing right */
02706 /*                 singular vectors of A in A */
02707 /*                 (CWorkspace: 0) */
02708 /*                 (RWorkspace: need BDSPAC) */
02709 
02710                     zbdsqr_("L", m, n, &c__0, &c__0, &s[1], &rwork[ie], &a[
02711                             a_offset], lda, cdum, &c__1, cdum, &c__1, &rwork[
02712                             irwork], info);
02713 
02714                 }
02715 
02716             } else if (wntvo && wntuas) {
02717 
02718 /*              Path 3t(N much larger than M, JOBU='S' or 'A', JOBVT='O') */
02719 /*              M right singular vectors to be overwritten on A and */
02720 /*              M left singular vectors to be computed in U */
02721 
02722                 if (*lwork >= *m * *m + *m * 3) {
02723 
02724 /*                 Sufficient workspace for a fast algorithm */
02725 
02726                     ir = 1;
02727 /* Computing MAX */
02728                     i__3 = wrkbl, i__2 = *lda * *n;
02729                     if (*lwork >= max(i__3,i__2) + *lda * *m) {
02730 
02731 /*                    WORK(IU) is LDA by N and WORK(IR) is LDA by M */
02732 
02733                         ldwrku = *lda;
02734                         chunk = *n;
02735                         ldwrkr = *lda;
02736                     } else /* if(complicated condition) */ {
02737 /* Computing MAX */
02738                         i__3 = wrkbl, i__2 = *lda * *n;
02739                         if (*lwork >= max(i__3,i__2) + *m * *m) {
02740 
02741 /*                    WORK(IU) is LDA by N and WORK(IR) is M by M */
02742 
02743                             ldwrku = *lda;
02744                             chunk = *n;
02745                             ldwrkr = *m;
02746                         } else {
02747 
02748 /*                    WORK(IU) is M by CHUNK and WORK(IR) is M by M */
02749 
02750                             ldwrku = *m;
02751                             chunk = (*lwork - *m * *m) / *m;
02752                             ldwrkr = *m;
02753                         }
02754                     }
02755                     itau = ir + ldwrkr * *m;
02756                     iwork = itau + *m;
02757 
02758 /*                 Compute A=L*Q */
02759 /*                 (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
02760 /*                 (RWorkspace: 0) */
02761 
02762                     i__3 = *lwork - iwork + 1;
02763                     zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[iwork]
02764 , &i__3, &ierr);
02765 
02766 /*                 Copy L to U, zeroing about above it */
02767 
02768                     zlacpy_("L", m, m, &a[a_offset], lda, &u[u_offset], ldu);
02769                     i__3 = *m - 1;
02770                     i__2 = *m - 1;
02771                     zlaset_("U", &i__3, &i__2, &c_b1, &c_b1, &u[(u_dim1 << 1) 
02772                             + 1], ldu);
02773 
02774 /*                 Generate Q in A */
02775 /*                 (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
02776 /*                 (RWorkspace: 0) */
02777 
02778                     i__3 = *lwork - iwork + 1;
02779                     zunglq_(m, n, m, &a[a_offset], lda, &work[itau], &work[
02780                             iwork], &i__3, &ierr);
02781                     ie = 1;
02782                     itauq = itau;
02783                     itaup = itauq + *m;
02784                     iwork = itaup + *m;
02785 
02786 /*                 Bidiagonalize L in U, copying result to WORK(IR) */
02787 /*                 (CWorkspace: need M*M+3*M, prefer M*M+2*M+2*M*NB) */
02788 /*                 (RWorkspace: need M) */
02789 
02790                     i__3 = *lwork - iwork + 1;
02791                     zgebrd_(m, m, &u[u_offset], ldu, &s[1], &rwork[ie], &work[
02792                             itauq], &work[itaup], &work[iwork], &i__3, &ierr);
02793                     zlacpy_("U", m, m, &u[u_offset], ldu, &work[ir], &ldwrkr);
02794 
02795 /*                 Generate right vectors bidiagonalizing L in WORK(IR) */
02796 /*                 (CWorkspace: need M*M+3*M-1, prefer M*M+2*M+(M-1)*NB) */
02797 /*                 (RWorkspace: 0) */
02798 
02799                     i__3 = *lwork - iwork + 1;
02800                     zungbr_("P", m, m, m, &work[ir], &ldwrkr, &work[itaup], &
02801                             work[iwork], &i__3, &ierr);
02802 
02803 /*                 Generate left vectors bidiagonalizing L in U */
02804 /*                 (CWorkspace: need M*M+3*M, prefer M*M+2*M+M*NB) */
02805 /*                 (RWorkspace: 0) */
02806 
02807                     i__3 = *lwork - iwork + 1;
02808                     zungbr_("Q", m, m, m, &u[u_offset], ldu, &work[itauq], &
02809                             work[iwork], &i__3, &ierr);
02810                     irwork = ie + *m;
02811 
02812 /*                 Perform bidiagonal QR iteration, computing left */
02813 /*                 singular vectors of L in U, and computing right */
02814 /*                 singular vectors of L in WORK(IR) */
02815 /*                 (CWorkspace: need M*M) */
02816 /*                 (RWorkspace: need BDSPAC) */
02817 
02818                     zbdsqr_("U", m, m, m, &c__0, &s[1], &rwork[ie], &work[ir], 
02819                              &ldwrkr, &u[u_offset], ldu, cdum, &c__1, &rwork[
02820                             irwork], info);
02821                     iu = itauq;
02822 
02823 /*                 Multiply right singular vectors of L in WORK(IR) by Q */
02824 /*                 in A, storing result in WORK(IU) and copying to A */
02825 /*                 (CWorkspace: need M*M+M, prefer M*M+M*N)) */
02826 /*                 (RWorkspace: 0) */
02827 
02828                     i__3 = *n;
02829                     i__2 = chunk;
02830                     for (i__ = 1; i__2 < 0 ? i__ >= i__3 : i__ <= i__3; i__ +=
02831                              i__2) {
02832 /* Computing MIN */
02833                         i__4 = *n - i__ + 1;
02834                         blk = min(i__4,chunk);
02835                         zgemm_("N", "N", m, &blk, m, &c_b2, &work[ir], &
02836                                 ldwrkr, &a[i__ * a_dim1 + 1], lda, &c_b1, &
02837                                 work[iu], &ldwrku);
02838                         zlacpy_("F", m, &blk, &work[iu], &ldwrku, &a[i__ * 
02839                                 a_dim1 + 1], lda);
02840 /* L40: */
02841                     }
02842 
02843                 } else {
02844 
02845 /*                 Insufficient workspace for a fast algorithm */
02846 
02847                     itau = 1;
02848                     iwork = itau + *m;
02849 
02850 /*                 Compute A=L*Q */
02851 /*                 (CWorkspace: need 2*M, prefer M+M*NB) */
02852 /*                 (RWorkspace: 0) */
02853 
02854                     i__2 = *lwork - iwork + 1;
02855                     zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[iwork]
02856 , &i__2, &ierr);
02857 
02858 /*                 Copy L to U, zeroing out above it */
02859 
02860                     zlacpy_("L", m, m, &a[a_offset], lda, &u[u_offset], ldu);
02861                     i__2 = *m - 1;
02862                     i__3 = *m - 1;
02863                     zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &u[(u_dim1 << 1) 
02864                             + 1], ldu);
02865 
02866 /*                 Generate Q in A */
02867 /*                 (CWorkspace: need 2*M, prefer M+M*NB) */
02868 /*                 (RWorkspace: 0) */
02869 
02870                     i__2 = *lwork - iwork + 1;
02871                     zunglq_(m, n, m, &a[a_offset], lda, &work[itau], &work[
02872                             iwork], &i__2, &ierr);
02873                     ie = 1;
02874                     itauq = itau;
02875                     itaup = itauq + *m;
02876                     iwork = itaup + *m;
02877 
02878 /*                 Bidiagonalize L in U */
02879 /*                 (CWorkspace: need 3*M, prefer 2*M+2*M*NB) */
02880 /*                 (RWorkspace: need M) */
02881 
02882                     i__2 = *lwork - iwork + 1;
02883                     zgebrd_(m, m, &u[u_offset], ldu, &s[1], &rwork[ie], &work[
02884                             itauq], &work[itaup], &work[iwork], &i__2, &ierr);
02885 
02886 /*                 Multiply right vectors bidiagonalizing L by Q in A */
02887 /*                 (CWorkspace: need 2*M+N, prefer 2*M+N*NB) */
02888 /*                 (RWorkspace: 0) */
02889 
02890                     i__2 = *lwork - iwork + 1;
02891                     zunmbr_("P", "L", "C", m, n, m, &u[u_offset], ldu, &work[
02892                             itaup], &a[a_offset], lda, &work[iwork], &i__2, &
02893                             ierr);
02894 
02895 /*                 Generate left vectors bidiagonalizing L in U */
02896 /*                 (CWorkspace: need 3*M, prefer 2*M+M*NB) */
02897 /*                 (RWorkspace: 0) */
02898 
02899                     i__2 = *lwork - iwork + 1;
02900                     zungbr_("Q", m, m, m, &u[u_offset], ldu, &work[itauq], &
02901                             work[iwork], &i__2, &ierr);
02902                     irwork = ie + *m;
02903 
02904 /*                 Perform bidiagonal QR iteration, computing left */
02905 /*                 singular vectors of A in U and computing right */
02906 /*                 singular vectors of A in A */
02907 /*                 (CWorkspace: 0) */
02908 /*                 (RWorkspace: need BDSPAC) */
02909 
02910                     zbdsqr_("U", m, n, m, &c__0, &s[1], &rwork[ie], &a[
02911                             a_offset], lda, &u[u_offset], ldu, cdum, &c__1, &
02912                             rwork[irwork], info);
02913 
02914                 }
02915 
02916             } else if (wntvs) {
02917 
02918                 if (wntun) {
02919 
02920 /*                 Path 4t(N much larger than M, JOBU='N', JOBVT='S') */
02921 /*                 M right singular vectors to be computed in VT and */
02922 /*                 no left singular vectors to be computed */
02923 
02924                     if (*lwork >= *m * *m + *m * 3) {
02925 
02926 /*                    Sufficient workspace for a fast algorithm */
02927 
02928                         ir = 1;
02929                         if (*lwork >= wrkbl + *lda * *m) {
02930 
02931 /*                       WORK(IR) is LDA by M */
02932 
02933                             ldwrkr = *lda;
02934                         } else {
02935 
02936 /*                       WORK(IR) is M by M */
02937 
02938                             ldwrkr = *m;
02939                         }
02940                         itau = ir + ldwrkr * *m;
02941                         iwork = itau + *m;
02942 
02943 /*                    Compute A=L*Q */
02944 /*                    (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
02945 /*                    (RWorkspace: 0) */
02946 
02947                         i__2 = *lwork - iwork + 1;
02948                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
02949                                 iwork], &i__2, &ierr);
02950 
02951 /*                    Copy L to WORK(IR), zeroing out above it */
02952 
02953                         zlacpy_("L", m, m, &a[a_offset], lda, &work[ir], &
02954                                 ldwrkr);
02955                         i__2 = *m - 1;
02956                         i__3 = *m - 1;
02957                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &work[ir + 
02958                                 ldwrkr], &ldwrkr);
02959 
02960 /*                    Generate Q in A */
02961 /*                    (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
02962 /*                    (RWorkspace: 0) */
02963 
02964                         i__2 = *lwork - iwork + 1;
02965                         zunglq_(m, n, m, &a[a_offset], lda, &work[itau], &
02966                                 work[iwork], &i__2, &ierr);
02967                         ie = 1;
02968                         itauq = itau;
02969                         itaup = itauq + *m;
02970                         iwork = itaup + *m;
02971 
02972 /*                    Bidiagonalize L in WORK(IR) */
02973 /*                    (CWorkspace: need M*M+3*M, prefer M*M+2*M+2*M*NB) */
02974 /*                    (RWorkspace: need M) */
02975 
02976                         i__2 = *lwork - iwork + 1;
02977                         zgebrd_(m, m, &work[ir], &ldwrkr, &s[1], &rwork[ie], &
02978                                 work[itauq], &work[itaup], &work[iwork], &
02979                                 i__2, &ierr);
02980 
02981 /*                    Generate right vectors bidiagonalizing L in */
02982 /*                    WORK(IR) */
02983 /*                    (CWorkspace: need M*M+3*M, prefer M*M+2*M+(M-1)*NB) */
02984 /*                    (RWorkspace: 0) */
02985 
02986                         i__2 = *lwork - iwork + 1;
02987                         zungbr_("P", m, m, m, &work[ir], &ldwrkr, &work[itaup]
02988 , &work[iwork], &i__2, &ierr);
02989                         irwork = ie + *m;
02990 
02991 /*                    Perform bidiagonal QR iteration, computing right */
02992 /*                    singular vectors of L in WORK(IR) */
02993 /*                    (CWorkspace: need M*M) */
02994 /*                    (RWorkspace: need BDSPAC) */
02995 
02996                         zbdsqr_("U", m, m, &c__0, &c__0, &s[1], &rwork[ie], &
02997                                 work[ir], &ldwrkr, cdum, &c__1, cdum, &c__1, &
02998                                 rwork[irwork], info);
02999 
03000 /*                    Multiply right singular vectors of L in WORK(IR) by */
03001 /*                    Q in A, storing result in VT */
03002 /*                    (CWorkspace: need M*M) */
03003 /*                    (RWorkspace: 0) */
03004 
03005                         zgemm_("N", "N", m, n, m, &c_b2, &work[ir], &ldwrkr, &
03006                                 a[a_offset], lda, &c_b1, &vt[vt_offset], ldvt);
03007 
03008                     } else {
03009 
03010 /*                    Insufficient workspace for a fast algorithm */
03011 
03012                         itau = 1;
03013                         iwork = itau + *m;
03014 
03015 /*                    Compute A=L*Q */
03016 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03017 /*                    (RWorkspace: 0) */
03018 
03019                         i__2 = *lwork - iwork + 1;
03020                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03021                                 iwork], &i__2, &ierr);
03022 
03023 /*                    Copy result to VT */
03024 
03025                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03026                                 ldvt);
03027 
03028 /*                    Generate Q in VT */
03029 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03030 /*                    (RWorkspace: 0) */
03031 
03032                         i__2 = *lwork - iwork + 1;
03033                         zunglq_(m, n, m, &vt[vt_offset], ldvt, &work[itau], &
03034                                 work[iwork], &i__2, &ierr);
03035                         ie = 1;
03036                         itauq = itau;
03037                         itaup = itauq + *m;
03038                         iwork = itaup + *m;
03039 
03040 /*                    Zero out above L in A */
03041 
03042                         i__2 = *m - 1;
03043                         i__3 = *m - 1;
03044                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &a[(a_dim1 <<
03045                                  1) + 1], lda);
03046 
03047 /*                    Bidiagonalize L in A */
03048 /*                    (CWorkspace: need 3*M, prefer 2*M+2*M*NB) */
03049 /*                    (RWorkspace: need M) */
03050 
03051                         i__2 = *lwork - iwork + 1;
03052                         zgebrd_(m, m, &a[a_offset], lda, &s[1], &rwork[ie], &
03053                                 work[itauq], &work[itaup], &work[iwork], &
03054                                 i__2, &ierr);
03055 
03056 /*                    Multiply right vectors bidiagonalizing L by Q in VT */
03057 /*                    (CWorkspace: need 2*M+N, prefer 2*M+N*NB) */
03058 /*                    (RWorkspace: 0) */
03059 
03060                         i__2 = *lwork - iwork + 1;
03061                         zunmbr_("P", "L", "C", m, n, m, &a[a_offset], lda, &
03062                                 work[itaup], &vt[vt_offset], ldvt, &work[
03063                                 iwork], &i__2, &ierr);
03064                         irwork = ie + *m;
03065 
03066 /*                    Perform bidiagonal QR iteration, computing right */
03067 /*                    singular vectors of A in VT */
03068 /*                    (CWorkspace: 0) */
03069 /*                    (RWorkspace: need BDSPAC) */
03070 
03071                         zbdsqr_("U", m, n, &c__0, &c__0, &s[1], &rwork[ie], &
03072                                 vt[vt_offset], ldvt, cdum, &c__1, cdum, &c__1, 
03073                                  &rwork[irwork], info);
03074 
03075                     }
03076 
03077                 } else if (wntuo) {
03078 
03079 /*                 Path 5t(N much larger than M, JOBU='O', JOBVT='S') */
03080 /*                 M right singular vectors to be computed in VT and */
03081 /*                 M left singular vectors to be overwritten on A */
03082 
03083                     if (*lwork >= (*m << 1) * *m + *m * 3) {
03084 
03085 /*                    Sufficient workspace for a fast algorithm */
03086 
03087                         iu = 1;
03088                         if (*lwork >= wrkbl + (*lda << 1) * *m) {
03089 
03090 /*                       WORK(IU) is LDA by M and WORK(IR) is LDA by M */
03091 
03092                             ldwrku = *lda;
03093                             ir = iu + ldwrku * *m;
03094                             ldwrkr = *lda;
03095                         } else if (*lwork >= wrkbl + (*lda + *m) * *m) {
03096 
03097 /*                       WORK(IU) is LDA by M and WORK(IR) is M by M */
03098 
03099                             ldwrku = *lda;
03100                             ir = iu + ldwrku * *m;
03101                             ldwrkr = *m;
03102                         } else {
03103 
03104 /*                       WORK(IU) is M by M and WORK(IR) is M by M */
03105 
03106                             ldwrku = *m;
03107                             ir = iu + ldwrku * *m;
03108                             ldwrkr = *m;
03109                         }
03110                         itau = ir + ldwrkr * *m;
03111                         iwork = itau + *m;
03112 
03113 /*                    Compute A=L*Q */
03114 /*                    (CWorkspace: need 2*M*M+2*M, prefer 2*M*M+M+M*NB) */
03115 /*                    (RWorkspace: 0) */
03116 
03117                         i__2 = *lwork - iwork + 1;
03118                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03119                                 iwork], &i__2, &ierr);
03120 
03121 /*                    Copy L to WORK(IU), zeroing out below it */
03122 
03123                         zlacpy_("L", m, m, &a[a_offset], lda, &work[iu], &
03124                                 ldwrku);
03125                         i__2 = *m - 1;
03126                         i__3 = *m - 1;
03127                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &work[iu + 
03128                                 ldwrku], &ldwrku);
03129 
03130 /*                    Generate Q in A */
03131 /*                    (CWorkspace: need 2*M*M+2*M, prefer 2*M*M+M+M*NB) */
03132 /*                    (RWorkspace: 0) */
03133 
03134                         i__2 = *lwork - iwork + 1;
03135                         zunglq_(m, n, m, &a[a_offset], lda, &work[itau], &
03136                                 work[iwork], &i__2, &ierr);
03137                         ie = 1;
03138                         itauq = itau;
03139                         itaup = itauq + *m;
03140                         iwork = itaup + *m;
03141 
03142 /*                    Bidiagonalize L in WORK(IU), copying result to */
03143 /*                    WORK(IR) */
03144 /*                    (CWorkspace: need   2*M*M+3*M, */
03145 /*                                 prefer 2*M*M+2*M+2*M*NB) */
03146 /*                    (RWorkspace: need   M) */
03147 
03148                         i__2 = *lwork - iwork + 1;
03149                         zgebrd_(m, m, &work[iu], &ldwrku, &s[1], &rwork[ie], &
03150                                 work[itauq], &work[itaup], &work[iwork], &
03151                                 i__2, &ierr);
03152                         zlacpy_("L", m, m, &work[iu], &ldwrku, &work[ir], &
03153                                 ldwrkr);
03154 
03155 /*                    Generate right bidiagonalizing vectors in WORK(IU) */
03156 /*                    (CWorkspace: need   2*M*M+3*M-1, */
03157 /*                                 prefer 2*M*M+2*M+(M-1)*NB) */
03158 /*                    (RWorkspace: 0) */
03159 
03160                         i__2 = *lwork - iwork + 1;
03161                         zungbr_("P", m, m, m, &work[iu], &ldwrku, &work[itaup]
03162 , &work[iwork], &i__2, &ierr);
03163 
03164 /*                    Generate left bidiagonalizing vectors in WORK(IR) */
03165 /*                    (CWorkspace: need 2*M*M+3*M, prefer 2*M*M+2*M+M*NB) */
03166 /*                    (RWorkspace: 0) */
03167 
03168                         i__2 = *lwork - iwork + 1;
03169                         zungbr_("Q", m, m, m, &work[ir], &ldwrkr, &work[itauq]
03170 , &work[iwork], &i__2, &ierr);
03171                         irwork = ie + *m;
03172 
03173 /*                    Perform bidiagonal QR iteration, computing left */
03174 /*                    singular vectors of L in WORK(IR) and computing */
03175 /*                    right singular vectors of L in WORK(IU) */
03176 /*                    (CWorkspace: need 2*M*M) */
03177 /*                    (RWorkspace: need BDSPAC) */
03178 
03179                         zbdsqr_("U", m, m, m, &c__0, &s[1], &rwork[ie], &work[
03180                                 iu], &ldwrku, &work[ir], &ldwrkr, cdum, &c__1, 
03181                                  &rwork[irwork], info);
03182 
03183 /*                    Multiply right singular vectors of L in WORK(IU) by */
03184 /*                    Q in A, storing result in VT */
03185 /*                    (CWorkspace: need M*M) */
03186 /*                    (RWorkspace: 0) */
03187 
03188                         zgemm_("N", "N", m, n, m, &c_b2, &work[iu], &ldwrku, &
03189                                 a[a_offset], lda, &c_b1, &vt[vt_offset], ldvt);
03190 
03191 /*                    Copy left singular vectors of L to A */
03192 /*                    (CWorkspace: need M*M) */
03193 /*                    (RWorkspace: 0) */
03194 
03195                         zlacpy_("F", m, m, &work[ir], &ldwrkr, &a[a_offset], 
03196                                 lda);
03197 
03198                     } else {
03199 
03200 /*                    Insufficient workspace for a fast algorithm */
03201 
03202                         itau = 1;
03203                         iwork = itau + *m;
03204 
03205 /*                    Compute A=L*Q, copying result to VT */
03206 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03207 /*                    (RWorkspace: 0) */
03208 
03209                         i__2 = *lwork - iwork + 1;
03210                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03211                                 iwork], &i__2, &ierr);
03212                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03213                                 ldvt);
03214 
03215 /*                    Generate Q in VT */
03216 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03217 /*                    (RWorkspace: 0) */
03218 
03219                         i__2 = *lwork - iwork + 1;
03220                         zunglq_(m, n, m, &vt[vt_offset], ldvt, &work[itau], &
03221                                 work[iwork], &i__2, &ierr);
03222                         ie = 1;
03223                         itauq = itau;
03224                         itaup = itauq + *m;
03225                         iwork = itaup + *m;
03226 
03227 /*                    Zero out above L in A */
03228 
03229                         i__2 = *m - 1;
03230                         i__3 = *m - 1;
03231                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &a[(a_dim1 <<
03232                                  1) + 1], lda);
03233 
03234 /*                    Bidiagonalize L in A */
03235 /*                    (CWorkspace: need 3*M, prefer 2*M+2*M*NB) */
03236 /*                    (RWorkspace: need M) */
03237 
03238                         i__2 = *lwork - iwork + 1;
03239                         zgebrd_(m, m, &a[a_offset], lda, &s[1], &rwork[ie], &
03240                                 work[itauq], &work[itaup], &work[iwork], &
03241                                 i__2, &ierr);
03242 
03243 /*                    Multiply right vectors bidiagonalizing L by Q in VT */
03244 /*                    (CWorkspace: need 2*M+N, prefer 2*M+N*NB) */
03245 /*                    (RWorkspace: 0) */
03246 
03247                         i__2 = *lwork - iwork + 1;
03248                         zunmbr_("P", "L", "C", m, n, m, &a[a_offset], lda, &
03249                                 work[itaup], &vt[vt_offset], ldvt, &work[
03250                                 iwork], &i__2, &ierr);
03251 
03252 /*                    Generate left bidiagonalizing vectors of L in A */
03253 /*                    (CWorkspace: need 3*M, prefer 2*M+M*NB) */
03254 /*                    (RWorkspace: 0) */
03255 
03256                         i__2 = *lwork - iwork + 1;
03257                         zungbr_("Q", m, m, m, &a[a_offset], lda, &work[itauq], 
03258                                  &work[iwork], &i__2, &ierr);
03259                         irwork = ie + *m;
03260 
03261 /*                    Perform bidiagonal QR iteration, computing left */
03262 /*                    singular vectors of A in A and computing right */
03263 /*                    singular vectors of A in VT */
03264 /*                    (CWorkspace: 0) */
03265 /*                    (RWorkspace: need BDSPAC) */
03266 
03267                         zbdsqr_("U", m, n, m, &c__0, &s[1], &rwork[ie], &vt[
03268                                 vt_offset], ldvt, &a[a_offset], lda, cdum, &
03269                                 c__1, &rwork[irwork], info);
03270 
03271                     }
03272 
03273                 } else if (wntuas) {
03274 
03275 /*                 Path 6t(N much larger than M, JOBU='S' or 'A', */
03276 /*                         JOBVT='S') */
03277 /*                 M right singular vectors to be computed in VT and */
03278 /*                 M left singular vectors to be computed in U */
03279 
03280                     if (*lwork >= *m * *m + *m * 3) {
03281 
03282 /*                    Sufficient workspace for a fast algorithm */
03283 
03284                         iu = 1;
03285                         if (*lwork >= wrkbl + *lda * *m) {
03286 
03287 /*                       WORK(IU) is LDA by N */
03288 
03289                             ldwrku = *lda;
03290                         } else {
03291 
03292 /*                       WORK(IU) is LDA by M */
03293 
03294                             ldwrku = *m;
03295                         }
03296                         itau = iu + ldwrku * *m;
03297                         iwork = itau + *m;
03298 
03299 /*                    Compute A=L*Q */
03300 /*                    (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
03301 /*                    (RWorkspace: 0) */
03302 
03303                         i__2 = *lwork - iwork + 1;
03304                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03305                                 iwork], &i__2, &ierr);
03306 
03307 /*                    Copy L to WORK(IU), zeroing out above it */
03308 
03309                         zlacpy_("L", m, m, &a[a_offset], lda, &work[iu], &
03310                                 ldwrku);
03311                         i__2 = *m - 1;
03312                         i__3 = *m - 1;
03313                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &work[iu + 
03314                                 ldwrku], &ldwrku);
03315 
03316 /*                    Generate Q in A */
03317 /*                    (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
03318 /*                    (RWorkspace: 0) */
03319 
03320                         i__2 = *lwork - iwork + 1;
03321                         zunglq_(m, n, m, &a[a_offset], lda, &work[itau], &
03322                                 work[iwork], &i__2, &ierr);
03323                         ie = 1;
03324                         itauq = itau;
03325                         itaup = itauq + *m;
03326                         iwork = itaup + *m;
03327 
03328 /*                    Bidiagonalize L in WORK(IU), copying result to U */
03329 /*                    (CWorkspace: need M*M+3*M, prefer M*M+2*M+2*M*NB) */
03330 /*                    (RWorkspace: need M) */
03331 
03332                         i__2 = *lwork - iwork + 1;
03333                         zgebrd_(m, m, &work[iu], &ldwrku, &s[1], &rwork[ie], &
03334                                 work[itauq], &work[itaup], &work[iwork], &
03335                                 i__2, &ierr);
03336                         zlacpy_("L", m, m, &work[iu], &ldwrku, &u[u_offset], 
03337                                 ldu);
03338 
03339 /*                    Generate right bidiagonalizing vectors in WORK(IU) */
03340 /*                    (CWorkspace: need   M*M+3*M-1, */
03341 /*                                 prefer M*M+2*M+(M-1)*NB) */
03342 /*                    (RWorkspace: 0) */
03343 
03344                         i__2 = *lwork - iwork + 1;
03345                         zungbr_("P", m, m, m, &work[iu], &ldwrku, &work[itaup]
03346 , &work[iwork], &i__2, &ierr);
03347 
03348 /*                    Generate left bidiagonalizing vectors in U */
03349 /*                    (CWorkspace: need M*M+3*M, prefer M*M+2*M+M*NB) */
03350 /*                    (RWorkspace: 0) */
03351 
03352                         i__2 = *lwork - iwork + 1;
03353                         zungbr_("Q", m, m, m, &u[u_offset], ldu, &work[itauq], 
03354                                  &work[iwork], &i__2, &ierr);
03355                         irwork = ie + *m;
03356 
03357 /*                    Perform bidiagonal QR iteration, computing left */
03358 /*                    singular vectors of L in U and computing right */
03359 /*                    singular vectors of L in WORK(IU) */
03360 /*                    (CWorkspace: need M*M) */
03361 /*                    (RWorkspace: need BDSPAC) */
03362 
03363                         zbdsqr_("U", m, m, m, &c__0, &s[1], &rwork[ie], &work[
03364                                 iu], &ldwrku, &u[u_offset], ldu, cdum, &c__1, 
03365                                 &rwork[irwork], info);
03366 
03367 /*                    Multiply right singular vectors of L in WORK(IU) by */
03368 /*                    Q in A, storing result in VT */
03369 /*                    (CWorkspace: need M*M) */
03370 /*                    (RWorkspace: 0) */
03371 
03372                         zgemm_("N", "N", m, n, m, &c_b2, &work[iu], &ldwrku, &
03373                                 a[a_offset], lda, &c_b1, &vt[vt_offset], ldvt);
03374 
03375                     } else {
03376 
03377 /*                    Insufficient workspace for a fast algorithm */
03378 
03379                         itau = 1;
03380                         iwork = itau + *m;
03381 
03382 /*                    Compute A=L*Q, copying result to VT */
03383 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03384 /*                    (RWorkspace: 0) */
03385 
03386                         i__2 = *lwork - iwork + 1;
03387                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03388                                 iwork], &i__2, &ierr);
03389                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03390                                 ldvt);
03391 
03392 /*                    Generate Q in VT */
03393 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03394 /*                    (RWorkspace: 0) */
03395 
03396                         i__2 = *lwork - iwork + 1;
03397                         zunglq_(m, n, m, &vt[vt_offset], ldvt, &work[itau], &
03398                                 work[iwork], &i__2, &ierr);
03399 
03400 /*                    Copy L to U, zeroing out above it */
03401 
03402                         zlacpy_("L", m, m, &a[a_offset], lda, &u[u_offset], 
03403                                 ldu);
03404                         i__2 = *m - 1;
03405                         i__3 = *m - 1;
03406                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &u[(u_dim1 <<
03407                                  1) + 1], ldu);
03408                         ie = 1;
03409                         itauq = itau;
03410                         itaup = itauq + *m;
03411                         iwork = itaup + *m;
03412 
03413 /*                    Bidiagonalize L in U */
03414 /*                    (CWorkspace: need 3*M, prefer 2*M+2*M*NB) */
03415 /*                    (RWorkspace: need M) */
03416 
03417                         i__2 = *lwork - iwork + 1;
03418                         zgebrd_(m, m, &u[u_offset], ldu, &s[1], &rwork[ie], &
03419                                 work[itauq], &work[itaup], &work[iwork], &
03420                                 i__2, &ierr);
03421 
03422 /*                    Multiply right bidiagonalizing vectors in U by Q */
03423 /*                    in VT */
03424 /*                    (CWorkspace: need 2*M+N, prefer 2*M+N*NB) */
03425 /*                    (RWorkspace: 0) */
03426 
03427                         i__2 = *lwork - iwork + 1;
03428                         zunmbr_("P", "L", "C", m, n, m, &u[u_offset], ldu, &
03429                                 work[itaup], &vt[vt_offset], ldvt, &work[
03430                                 iwork], &i__2, &ierr);
03431 
03432 /*                    Generate left bidiagonalizing vectors in U */
03433 /*                    (CWorkspace: need 3*M, prefer 2*M+M*NB) */
03434 /*                    (RWorkspace: 0) */
03435 
03436                         i__2 = *lwork - iwork + 1;
03437                         zungbr_("Q", m, m, m, &u[u_offset], ldu, &work[itauq], 
03438                                  &work[iwork], &i__2, &ierr);
03439                         irwork = ie + *m;
03440 
03441 /*                    Perform bidiagonal QR iteration, computing left */
03442 /*                    singular vectors of A in U and computing right */
03443 /*                    singular vectors of A in VT */
03444 /*                    (CWorkspace: 0) */
03445 /*                    (RWorkspace: need BDSPAC) */
03446 
03447                         zbdsqr_("U", m, n, m, &c__0, &s[1], &rwork[ie], &vt[
03448                                 vt_offset], ldvt, &u[u_offset], ldu, cdum, &
03449                                 c__1, &rwork[irwork], info);
03450 
03451                     }
03452 
03453                 }
03454 
03455             } else if (wntva) {
03456 
03457                 if (wntun) {
03458 
03459 /*                 Path 7t(N much larger than M, JOBU='N', JOBVT='A') */
03460 /*                 N right singular vectors to be computed in VT and */
03461 /*                 no left singular vectors to be computed */
03462 
03463 /* Computing MAX */
03464                     i__2 = *n + *m, i__3 = *m * 3;
03465                     if (*lwork >= *m * *m + max(i__2,i__3)) {
03466 
03467 /*                    Sufficient workspace for a fast algorithm */
03468 
03469                         ir = 1;
03470                         if (*lwork >= wrkbl + *lda * *m) {
03471 
03472 /*                       WORK(IR) is LDA by M */
03473 
03474                             ldwrkr = *lda;
03475                         } else {
03476 
03477 /*                       WORK(IR) is M by M */
03478 
03479                             ldwrkr = *m;
03480                         }
03481                         itau = ir + ldwrkr * *m;
03482                         iwork = itau + *m;
03483 
03484 /*                    Compute A=L*Q, copying result to VT */
03485 /*                    (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
03486 /*                    (RWorkspace: 0) */
03487 
03488                         i__2 = *lwork - iwork + 1;
03489                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03490                                 iwork], &i__2, &ierr);
03491                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03492                                 ldvt);
03493 
03494 /*                    Copy L to WORK(IR), zeroing out above it */
03495 
03496                         zlacpy_("L", m, m, &a[a_offset], lda, &work[ir], &
03497                                 ldwrkr);
03498                         i__2 = *m - 1;
03499                         i__3 = *m - 1;
03500                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &work[ir + 
03501                                 ldwrkr], &ldwrkr);
03502 
03503 /*                    Generate Q in VT */
03504 /*                    (CWorkspace: need M*M+M+N, prefer M*M+M+N*NB) */
03505 /*                    (RWorkspace: 0) */
03506 
03507                         i__2 = *lwork - iwork + 1;
03508                         zunglq_(n, n, m, &vt[vt_offset], ldvt, &work[itau], &
03509                                 work[iwork], &i__2, &ierr);
03510                         ie = 1;
03511                         itauq = itau;
03512                         itaup = itauq + *m;
03513                         iwork = itaup + *m;
03514 
03515 /*                    Bidiagonalize L in WORK(IR) */
03516 /*                    (CWorkspace: need M*M+3*M, prefer M*M+2*M+2*M*NB) */
03517 /*                    (RWorkspace: need M) */
03518 
03519                         i__2 = *lwork - iwork + 1;
03520                         zgebrd_(m, m, &work[ir], &ldwrkr, &s[1], &rwork[ie], &
03521                                 work[itauq], &work[itaup], &work[iwork], &
03522                                 i__2, &ierr);
03523 
03524 /*                    Generate right bidiagonalizing vectors in WORK(IR) */
03525 /*                    (CWorkspace: need   M*M+3*M-1, */
03526 /*                                 prefer M*M+2*M+(M-1)*NB) */
03527 /*                    (RWorkspace: 0) */
03528 
03529                         i__2 = *lwork - iwork + 1;
03530                         zungbr_("P", m, m, m, &work[ir], &ldwrkr, &work[itaup]
03531 , &work[iwork], &i__2, &ierr);
03532                         irwork = ie + *m;
03533 
03534 /*                    Perform bidiagonal QR iteration, computing right */
03535 /*                    singular vectors of L in WORK(IR) */
03536 /*                    (CWorkspace: need M*M) */
03537 /*                    (RWorkspace: need BDSPAC) */
03538 
03539                         zbdsqr_("U", m, m, &c__0, &c__0, &s[1], &rwork[ie], &
03540                                 work[ir], &ldwrkr, cdum, &c__1, cdum, &c__1, &
03541                                 rwork[irwork], info);
03542 
03543 /*                    Multiply right singular vectors of L in WORK(IR) by */
03544 /*                    Q in VT, storing result in A */
03545 /*                    (CWorkspace: need M*M) */
03546 /*                    (RWorkspace: 0) */
03547 
03548                         zgemm_("N", "N", m, n, m, &c_b2, &work[ir], &ldwrkr, &
03549                                 vt[vt_offset], ldvt, &c_b1, &a[a_offset], lda);
03550 
03551 /*                    Copy right singular vectors of A from A to VT */
03552 
03553                         zlacpy_("F", m, n, &a[a_offset], lda, &vt[vt_offset], 
03554                                 ldvt);
03555 
03556                     } else {
03557 
03558 /*                    Insufficient workspace for a fast algorithm */
03559 
03560                         itau = 1;
03561                         iwork = itau + *m;
03562 
03563 /*                    Compute A=L*Q, copying result to VT */
03564 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03565 /*                    (RWorkspace: 0) */
03566 
03567                         i__2 = *lwork - iwork + 1;
03568                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03569                                 iwork], &i__2, &ierr);
03570                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03571                                 ldvt);
03572 
03573 /*                    Generate Q in VT */
03574 /*                    (CWorkspace: need M+N, prefer M+N*NB) */
03575 /*                    (RWorkspace: 0) */
03576 
03577                         i__2 = *lwork - iwork + 1;
03578                         zunglq_(n, n, m, &vt[vt_offset], ldvt, &work[itau], &
03579                                 work[iwork], &i__2, &ierr);
03580                         ie = 1;
03581                         itauq = itau;
03582                         itaup = itauq + *m;
03583                         iwork = itaup + *m;
03584 
03585 /*                    Zero out above L in A */
03586 
03587                         i__2 = *m - 1;
03588                         i__3 = *m - 1;
03589                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &a[(a_dim1 <<
03590                                  1) + 1], lda);
03591 
03592 /*                    Bidiagonalize L in A */
03593 /*                    (CWorkspace: need 3*M, prefer 2*M+2*M*NB) */
03594 /*                    (RWorkspace: need M) */
03595 
03596                         i__2 = *lwork - iwork + 1;
03597                         zgebrd_(m, m, &a[a_offset], lda, &s[1], &rwork[ie], &
03598                                 work[itauq], &work[itaup], &work[iwork], &
03599                                 i__2, &ierr);
03600 
03601 /*                    Multiply right bidiagonalizing vectors in A by Q */
03602 /*                    in VT */
03603 /*                    (CWorkspace: need 2*M+N, prefer 2*M+N*NB) */
03604 /*                    (RWorkspace: 0) */
03605 
03606                         i__2 = *lwork - iwork + 1;
03607                         zunmbr_("P", "L", "C", m, n, m, &a[a_offset], lda, &
03608                                 work[itaup], &vt[vt_offset], ldvt, &work[
03609                                 iwork], &i__2, &ierr);
03610                         irwork = ie + *m;
03611 
03612 /*                    Perform bidiagonal QR iteration, computing right */
03613 /*                    singular vectors of A in VT */
03614 /*                    (CWorkspace: 0) */
03615 /*                    (RWorkspace: need BDSPAC) */
03616 
03617                         zbdsqr_("U", m, n, &c__0, &c__0, &s[1], &rwork[ie], &
03618                                 vt[vt_offset], ldvt, cdum, &c__1, cdum, &c__1, 
03619                                  &rwork[irwork], info);
03620 
03621                     }
03622 
03623                 } else if (wntuo) {
03624 
03625 /*                 Path 8t(N much larger than M, JOBU='O', JOBVT='A') */
03626 /*                 N right singular vectors to be computed in VT and */
03627 /*                 M left singular vectors to be overwritten on A */
03628 
03629 /* Computing MAX */
03630                     i__2 = *n + *m, i__3 = *m * 3;
03631                     if (*lwork >= (*m << 1) * *m + max(i__2,i__3)) {
03632 
03633 /*                    Sufficient workspace for a fast algorithm */
03634 
03635                         iu = 1;
03636                         if (*lwork >= wrkbl + (*lda << 1) * *m) {
03637 
03638 /*                       WORK(IU) is LDA by M and WORK(IR) is LDA by M */
03639 
03640                             ldwrku = *lda;
03641                             ir = iu + ldwrku * *m;
03642                             ldwrkr = *lda;
03643                         } else if (*lwork >= wrkbl + (*lda + *m) * *m) {
03644 
03645 /*                       WORK(IU) is LDA by M and WORK(IR) is M by M */
03646 
03647                             ldwrku = *lda;
03648                             ir = iu + ldwrku * *m;
03649                             ldwrkr = *m;
03650                         } else {
03651 
03652 /*                       WORK(IU) is M by M and WORK(IR) is M by M */
03653 
03654                             ldwrku = *m;
03655                             ir = iu + ldwrku * *m;
03656                             ldwrkr = *m;
03657                         }
03658                         itau = ir + ldwrkr * *m;
03659                         iwork = itau + *m;
03660 
03661 /*                    Compute A=L*Q, copying result to VT */
03662 /*                    (CWorkspace: need 2*M*M+2*M, prefer 2*M*M+M+M*NB) */
03663 /*                    (RWorkspace: 0) */
03664 
03665                         i__2 = *lwork - iwork + 1;
03666                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03667                                 iwork], &i__2, &ierr);
03668                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03669                                 ldvt);
03670 
03671 /*                    Generate Q in VT */
03672 /*                    (CWorkspace: need 2*M*M+M+N, prefer 2*M*M+M+N*NB) */
03673 /*                    (RWorkspace: 0) */
03674 
03675                         i__2 = *lwork - iwork + 1;
03676                         zunglq_(n, n, m, &vt[vt_offset], ldvt, &work[itau], &
03677                                 work[iwork], &i__2, &ierr);
03678 
03679 /*                    Copy L to WORK(IU), zeroing out above it */
03680 
03681                         zlacpy_("L", m, m, &a[a_offset], lda, &work[iu], &
03682                                 ldwrku);
03683                         i__2 = *m - 1;
03684                         i__3 = *m - 1;
03685                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &work[iu + 
03686                                 ldwrku], &ldwrku);
03687                         ie = 1;
03688                         itauq = itau;
03689                         itaup = itauq + *m;
03690                         iwork = itaup + *m;
03691 
03692 /*                    Bidiagonalize L in WORK(IU), copying result to */
03693 /*                    WORK(IR) */
03694 /*                    (CWorkspace: need   2*M*M+3*M, */
03695 /*                                 prefer 2*M*M+2*M+2*M*NB) */
03696 /*                    (RWorkspace: need   M) */
03697 
03698                         i__2 = *lwork - iwork + 1;
03699                         zgebrd_(m, m, &work[iu], &ldwrku, &s[1], &rwork[ie], &
03700                                 work[itauq], &work[itaup], &work[iwork], &
03701                                 i__2, &ierr);
03702                         zlacpy_("L", m, m, &work[iu], &ldwrku, &work[ir], &
03703                                 ldwrkr);
03704 
03705 /*                    Generate right bidiagonalizing vectors in WORK(IU) */
03706 /*                    (CWorkspace: need   2*M*M+3*M-1, */
03707 /*                                 prefer 2*M*M+2*M+(M-1)*NB) */
03708 /*                    (RWorkspace: 0) */
03709 
03710                         i__2 = *lwork - iwork + 1;
03711                         zungbr_("P", m, m, m, &work[iu], &ldwrku, &work[itaup]
03712 , &work[iwork], &i__2, &ierr);
03713 
03714 /*                    Generate left bidiagonalizing vectors in WORK(IR) */
03715 /*                    (CWorkspace: need 2*M*M+3*M, prefer 2*M*M+2*M+M*NB) */
03716 /*                    (RWorkspace: 0) */
03717 
03718                         i__2 = *lwork - iwork + 1;
03719                         zungbr_("Q", m, m, m, &work[ir], &ldwrkr, &work[itauq]
03720 , &work[iwork], &i__2, &ierr);
03721                         irwork = ie + *m;
03722 
03723 /*                    Perform bidiagonal QR iteration, computing left */
03724 /*                    singular vectors of L in WORK(IR) and computing */
03725 /*                    right singular vectors of L in WORK(IU) */
03726 /*                    (CWorkspace: need 2*M*M) */
03727 /*                    (RWorkspace: need BDSPAC) */
03728 
03729                         zbdsqr_("U", m, m, m, &c__0, &s[1], &rwork[ie], &work[
03730                                 iu], &ldwrku, &work[ir], &ldwrkr, cdum, &c__1, 
03731                                  &rwork[irwork], info);
03732 
03733 /*                    Multiply right singular vectors of L in WORK(IU) by */
03734 /*                    Q in VT, storing result in A */
03735 /*                    (CWorkspace: need M*M) */
03736 /*                    (RWorkspace: 0) */
03737 
03738                         zgemm_("N", "N", m, n, m, &c_b2, &work[iu], &ldwrku, &
03739                                 vt[vt_offset], ldvt, &c_b1, &a[a_offset], lda);
03740 
03741 /*                    Copy right singular vectors of A from A to VT */
03742 
03743                         zlacpy_("F", m, n, &a[a_offset], lda, &vt[vt_offset], 
03744                                 ldvt);
03745 
03746 /*                    Copy left singular vectors of A from WORK(IR) to A */
03747 
03748                         zlacpy_("F", m, m, &work[ir], &ldwrkr, &a[a_offset], 
03749                                 lda);
03750 
03751                     } else {
03752 
03753 /*                    Insufficient workspace for a fast algorithm */
03754 
03755                         itau = 1;
03756                         iwork = itau + *m;
03757 
03758 /*                    Compute A=L*Q, copying result to VT */
03759 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03760 /*                    (RWorkspace: 0) */
03761 
03762                         i__2 = *lwork - iwork + 1;
03763                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03764                                 iwork], &i__2, &ierr);
03765                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03766                                 ldvt);
03767 
03768 /*                    Generate Q in VT */
03769 /*                    (CWorkspace: need M+N, prefer M+N*NB) */
03770 /*                    (RWorkspace: 0) */
03771 
03772                         i__2 = *lwork - iwork + 1;
03773                         zunglq_(n, n, m, &vt[vt_offset], ldvt, &work[itau], &
03774                                 work[iwork], &i__2, &ierr);
03775                         ie = 1;
03776                         itauq = itau;
03777                         itaup = itauq + *m;
03778                         iwork = itaup + *m;
03779 
03780 /*                    Zero out above L in A */
03781 
03782                         i__2 = *m - 1;
03783                         i__3 = *m - 1;
03784                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &a[(a_dim1 <<
03785                                  1) + 1], lda);
03786 
03787 /*                    Bidiagonalize L in A */
03788 /*                    (CWorkspace: need 3*M, prefer 2*M+2*M*NB) */
03789 /*                    (RWorkspace: need M) */
03790 
03791                         i__2 = *lwork - iwork + 1;
03792                         zgebrd_(m, m, &a[a_offset], lda, &s[1], &rwork[ie], &
03793                                 work[itauq], &work[itaup], &work[iwork], &
03794                                 i__2, &ierr);
03795 
03796 /*                    Multiply right bidiagonalizing vectors in A by Q */
03797 /*                    in VT */
03798 /*                    (CWorkspace: need 2*M+N, prefer 2*M+N*NB) */
03799 /*                    (RWorkspace: 0) */
03800 
03801                         i__2 = *lwork - iwork + 1;
03802                         zunmbr_("P", "L", "C", m, n, m, &a[a_offset], lda, &
03803                                 work[itaup], &vt[vt_offset], ldvt, &work[
03804                                 iwork], &i__2, &ierr);
03805 
03806 /*                    Generate left bidiagonalizing vectors in A */
03807 /*                    (CWorkspace: need 3*M, prefer 2*M+M*NB) */
03808 /*                    (RWorkspace: 0) */
03809 
03810                         i__2 = *lwork - iwork + 1;
03811                         zungbr_("Q", m, m, m, &a[a_offset], lda, &work[itauq], 
03812                                  &work[iwork], &i__2, &ierr);
03813                         irwork = ie + *m;
03814 
03815 /*                    Perform bidiagonal QR iteration, computing left */
03816 /*                    singular vectors of A in A and computing right */
03817 /*                    singular vectors of A in VT */
03818 /*                    (CWorkspace: 0) */
03819 /*                    (RWorkspace: need BDSPAC) */
03820 
03821                         zbdsqr_("U", m, n, m, &c__0, &s[1], &rwork[ie], &vt[
03822                                 vt_offset], ldvt, &a[a_offset], lda, cdum, &
03823                                 c__1, &rwork[irwork], info);
03824 
03825                     }
03826 
03827                 } else if (wntuas) {
03828 
03829 /*                 Path 9t(N much larger than M, JOBU='S' or 'A', */
03830 /*                         JOBVT='A') */
03831 /*                 N right singular vectors to be computed in VT and */
03832 /*                 M left singular vectors to be computed in U */
03833 
03834 /* Computing MAX */
03835                     i__2 = *n + *m, i__3 = *m * 3;
03836                     if (*lwork >= *m * *m + max(i__2,i__3)) {
03837 
03838 /*                    Sufficient workspace for a fast algorithm */
03839 
03840                         iu = 1;
03841                         if (*lwork >= wrkbl + *lda * *m) {
03842 
03843 /*                       WORK(IU) is LDA by M */
03844 
03845                             ldwrku = *lda;
03846                         } else {
03847 
03848 /*                       WORK(IU) is M by M */
03849 
03850                             ldwrku = *m;
03851                         }
03852                         itau = iu + ldwrku * *m;
03853                         iwork = itau + *m;
03854 
03855 /*                    Compute A=L*Q, copying result to VT */
03856 /*                    (CWorkspace: need M*M+2*M, prefer M*M+M+M*NB) */
03857 /*                    (RWorkspace: 0) */
03858 
03859                         i__2 = *lwork - iwork + 1;
03860                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03861                                 iwork], &i__2, &ierr);
03862                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03863                                 ldvt);
03864 
03865 /*                    Generate Q in VT */
03866 /*                    (CWorkspace: need M*M+M+N, prefer M*M+M+N*NB) */
03867 /*                    (RWorkspace: 0) */
03868 
03869                         i__2 = *lwork - iwork + 1;
03870                         zunglq_(n, n, m, &vt[vt_offset], ldvt, &work[itau], &
03871                                 work[iwork], &i__2, &ierr);
03872 
03873 /*                    Copy L to WORK(IU), zeroing out above it */
03874 
03875                         zlacpy_("L", m, m, &a[a_offset], lda, &work[iu], &
03876                                 ldwrku);
03877                         i__2 = *m - 1;
03878                         i__3 = *m - 1;
03879                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &work[iu + 
03880                                 ldwrku], &ldwrku);
03881                         ie = 1;
03882                         itauq = itau;
03883                         itaup = itauq + *m;
03884                         iwork = itaup + *m;
03885 
03886 /*                    Bidiagonalize L in WORK(IU), copying result to U */
03887 /*                    (CWorkspace: need M*M+3*M, prefer M*M+2*M+2*M*NB) */
03888 /*                    (RWorkspace: need M) */
03889 
03890                         i__2 = *lwork - iwork + 1;
03891                         zgebrd_(m, m, &work[iu], &ldwrku, &s[1], &rwork[ie], &
03892                                 work[itauq], &work[itaup], &work[iwork], &
03893                                 i__2, &ierr);
03894                         zlacpy_("L", m, m, &work[iu], &ldwrku, &u[u_offset], 
03895                                 ldu);
03896 
03897 /*                    Generate right bidiagonalizing vectors in WORK(IU) */
03898 /*                    (CWorkspace: need M*M+3*M, prefer M*M+2*M+(M-1)*NB) */
03899 /*                    (RWorkspace: 0) */
03900 
03901                         i__2 = *lwork - iwork + 1;
03902                         zungbr_("P", m, m, m, &work[iu], &ldwrku, &work[itaup]
03903 , &work[iwork], &i__2, &ierr);
03904 
03905 /*                    Generate left bidiagonalizing vectors in U */
03906 /*                    (CWorkspace: need M*M+3*M, prefer M*M+2*M+M*NB) */
03907 /*                    (RWorkspace: 0) */
03908 
03909                         i__2 = *lwork - iwork + 1;
03910                         zungbr_("Q", m, m, m, &u[u_offset], ldu, &work[itauq], 
03911                                  &work[iwork], &i__2, &ierr);
03912                         irwork = ie + *m;
03913 
03914 /*                    Perform bidiagonal QR iteration, computing left */
03915 /*                    singular vectors of L in U and computing right */
03916 /*                    singular vectors of L in WORK(IU) */
03917 /*                    (CWorkspace: need M*M) */
03918 /*                    (RWorkspace: need BDSPAC) */
03919 
03920                         zbdsqr_("U", m, m, m, &c__0, &s[1], &rwork[ie], &work[
03921                                 iu], &ldwrku, &u[u_offset], ldu, cdum, &c__1, 
03922                                 &rwork[irwork], info);
03923 
03924 /*                    Multiply right singular vectors of L in WORK(IU) by */
03925 /*                    Q in VT, storing result in A */
03926 /*                    (CWorkspace: need M*M) */
03927 /*                    (RWorkspace: 0) */
03928 
03929                         zgemm_("N", "N", m, n, m, &c_b2, &work[iu], &ldwrku, &
03930                                 vt[vt_offset], ldvt, &c_b1, &a[a_offset], lda);
03931 
03932 /*                    Copy right singular vectors of A from A to VT */
03933 
03934                         zlacpy_("F", m, n, &a[a_offset], lda, &vt[vt_offset], 
03935                                 ldvt);
03936 
03937                     } else {
03938 
03939 /*                    Insufficient workspace for a fast algorithm */
03940 
03941                         itau = 1;
03942                         iwork = itau + *m;
03943 
03944 /*                    Compute A=L*Q, copying result to VT */
03945 /*                    (CWorkspace: need 2*M, prefer M+M*NB) */
03946 /*                    (RWorkspace: 0) */
03947 
03948                         i__2 = *lwork - iwork + 1;
03949                         zgelqf_(m, n, &a[a_offset], lda, &work[itau], &work[
03950                                 iwork], &i__2, &ierr);
03951                         zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], 
03952                                 ldvt);
03953 
03954 /*                    Generate Q in VT */
03955 /*                    (CWorkspace: need M+N, prefer M+N*NB) */
03956 /*                    (RWorkspace: 0) */
03957 
03958                         i__2 = *lwork - iwork + 1;
03959                         zunglq_(n, n, m, &vt[vt_offset], ldvt, &work[itau], &
03960                                 work[iwork], &i__2, &ierr);
03961 
03962 /*                    Copy L to U, zeroing out above it */
03963 
03964                         zlacpy_("L", m, m, &a[a_offset], lda, &u[u_offset], 
03965                                 ldu);
03966                         i__2 = *m - 1;
03967                         i__3 = *m - 1;
03968                         zlaset_("U", &i__2, &i__3, &c_b1, &c_b1, &u[(u_dim1 <<
03969                                  1) + 1], ldu);
03970                         ie = 1;
03971                         itauq = itau;
03972                         itaup = itauq + *m;
03973                         iwork = itaup + *m;
03974 
03975 /*                    Bidiagonalize L in U */
03976 /*                    (CWorkspace: need 3*M, prefer 2*M+2*M*NB) */
03977 /*                    (RWorkspace: need M) */
03978 
03979                         i__2 = *lwork - iwork + 1;
03980                         zgebrd_(m, m, &u[u_offset], ldu, &s[1], &rwork[ie], &
03981                                 work[itauq], &work[itaup], &work[iwork], &
03982                                 i__2, &ierr);
03983 
03984 /*                    Multiply right bidiagonalizing vectors in U by Q */
03985 /*                    in VT */
03986 /*                    (CWorkspace: need 2*M+N, prefer 2*M+N*NB) */
03987 /*                    (RWorkspace: 0) */
03988 
03989                         i__2 = *lwork - iwork + 1;
03990                         zunmbr_("P", "L", "C", m, n, m, &u[u_offset], ldu, &
03991                                 work[itaup], &vt[vt_offset], ldvt, &work[
03992                                 iwork], &i__2, &ierr);
03993 
03994 /*                    Generate left bidiagonalizing vectors in U */
03995 /*                    (CWorkspace: need 3*M, prefer 2*M+M*NB) */
03996 /*                    (RWorkspace: 0) */
03997 
03998                         i__2 = *lwork - iwork + 1;
03999                         zungbr_("Q", m, m, m, &u[u_offset], ldu, &work[itauq], 
04000                                  &work[iwork], &i__2, &ierr);
04001                         irwork = ie + *m;
04002 
04003 /*                    Perform bidiagonal QR iteration, computing left */
04004 /*                    singular vectors of A in U and computing right */
04005 /*                    singular vectors of A in VT */
04006 /*                    (CWorkspace: 0) */
04007 /*                    (RWorkspace: need BDSPAC) */
04008 
04009                         zbdsqr_("U", m, n, m, &c__0, &s[1], &rwork[ie], &vt[
04010                                 vt_offset], ldvt, &u[u_offset], ldu, cdum, &
04011                                 c__1, &rwork[irwork], info);
04012 
04013                     }
04014 
04015                 }
04016 
04017             }
04018 
04019         } else {
04020 
04021 /*           N .LT. MNTHR */
04022 
04023 /*           Path 10t(N greater than M, but not much larger) */
04024 /*           Reduce to bidiagonal form without LQ decomposition */
04025 
04026             ie = 1;
04027             itauq = 1;
04028             itaup = itauq + *m;
04029             iwork = itaup + *m;
04030 
04031 /*           Bidiagonalize A */
04032 /*           (CWorkspace: need 2*M+N, prefer 2*M+(M+N)*NB) */
04033 /*           (RWorkspace: M) */
04034 
04035             i__2 = *lwork - iwork + 1;
04036             zgebrd_(m, n, &a[a_offset], lda, &s[1], &rwork[ie], &work[itauq], 
04037                     &work[itaup], &work[iwork], &i__2, &ierr);
04038             if (wntuas) {
04039 
04040 /*              If left singular vectors desired in U, copy result to U */
04041 /*              and generate left bidiagonalizing vectors in U */
04042 /*              (CWorkspace: need 3*M-1, prefer 2*M+(M-1)*NB) */
04043 /*              (RWorkspace: 0) */
04044 
04045                 zlacpy_("L", m, m, &a[a_offset], lda, &u[u_offset], ldu);
04046                 i__2 = *lwork - iwork + 1;
04047                 zungbr_("Q", m, m, n, &u[u_offset], ldu, &work[itauq], &work[
04048                         iwork], &i__2, &ierr);
04049             }
04050             if (wntvas) {
04051 
04052 /*              If right singular vectors desired in VT, copy result to */
04053 /*              VT and generate right bidiagonalizing vectors in VT */
04054 /*              (CWorkspace: need 2*M+NRVT, prefer 2*M+NRVT*NB) */
04055 /*              (RWorkspace: 0) */
04056 
04057                 zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset], ldvt);
04058                 if (wntva) {
04059                     nrvt = *n;
04060                 }
04061                 if (wntvs) {
04062                     nrvt = *m;
04063                 }
04064                 i__2 = *lwork - iwork + 1;
04065                 zungbr_("P", &nrvt, n, m, &vt[vt_offset], ldvt, &work[itaup], 
04066                         &work[iwork], &i__2, &ierr);
04067             }
04068             if (wntuo) {
04069 
04070 /*              If left singular vectors desired in A, generate left */
04071 /*              bidiagonalizing vectors in A */
04072 /*              (CWorkspace: need 3*M-1, prefer 2*M+(M-1)*NB) */
04073 /*              (RWorkspace: 0) */
04074 
04075                 i__2 = *lwork - iwork + 1;
04076                 zungbr_("Q", m, m, n, &a[a_offset], lda, &work[itauq], &work[
04077                         iwork], &i__2, &ierr);
04078             }
04079             if (wntvo) {
04080 
04081 /*              If right singular vectors desired in A, generate right */
04082 /*              bidiagonalizing vectors in A */
04083 /*              (CWorkspace: need 3*M, prefer 2*M+M*NB) */
04084 /*              (RWorkspace: 0) */
04085 
04086                 i__2 = *lwork - iwork + 1;
04087                 zungbr_("P", m, n, m, &a[a_offset], lda, &work[itaup], &work[
04088                         iwork], &i__2, &ierr);
04089             }
04090             irwork = ie + *m;
04091             if (wntuas || wntuo) {
04092                 nru = *m;
04093             }
04094             if (wntun) {
04095                 nru = 0;
04096             }
04097             if (wntvas || wntvo) {
04098                 ncvt = *n;
04099             }
04100             if (wntvn) {
04101                 ncvt = 0;
04102             }
04103             if (! wntuo && ! wntvo) {
04104 
04105 /*              Perform bidiagonal QR iteration, if desired, computing */
04106 /*              left singular vectors in U and computing right singular */
04107 /*              vectors in VT */
04108 /*              (CWorkspace: 0) */
04109 /*              (RWorkspace: need BDSPAC) */
04110 
04111                 zbdsqr_("L", m, &ncvt, &nru, &c__0, &s[1], &rwork[ie], &vt[
04112                         vt_offset], ldvt, &u[u_offset], ldu, cdum, &c__1, &
04113                         rwork[irwork], info);
04114             } else if (! wntuo && wntvo) {
04115 
04116 /*              Perform bidiagonal QR iteration, if desired, computing */
04117 /*              left singular vectors in U and computing right singular */
04118 /*              vectors in A */
04119 /*              (CWorkspace: 0) */
04120 /*              (RWorkspace: need BDSPAC) */
04121 
04122                 zbdsqr_("L", m, &ncvt, &nru, &c__0, &s[1], &rwork[ie], &a[
04123                         a_offset], lda, &u[u_offset], ldu, cdum, &c__1, &
04124                         rwork[irwork], info);
04125             } else {
04126 
04127 /*              Perform bidiagonal QR iteration, if desired, computing */
04128 /*              left singular vectors in A and computing right singular */
04129 /*              vectors in VT */
04130 /*              (CWorkspace: 0) */
04131 /*              (RWorkspace: need BDSPAC) */
04132 
04133                 zbdsqr_("L", m, &ncvt, &nru, &c__0, &s[1], &rwork[ie], &vt[
04134                         vt_offset], ldvt, &a[a_offset], lda, cdum, &c__1, &
04135                         rwork[irwork], info);
04136             }
04137 
04138         }
04139 
04140     }
04141 
04142 /*     Undo scaling if necessary */
04143 
04144     if (iscl == 1) {
04145         if (anrm > bignum) {
04146             dlascl_("G", &c__0, &c__0, &bignum, &anrm, &minmn, &c__1, &s[1], &
04147                     minmn, &ierr);
04148         }
04149         if (*info != 0 && anrm > bignum) {
04150             i__2 = minmn - 1;
04151             dlascl_("G", &c__0, &c__0, &bignum, &anrm, &i__2, &c__1, &rwork[
04152                     ie], &minmn, &ierr);
04153         }
04154         if (anrm < smlnum) {
04155             dlascl_("G", &c__0, &c__0, &smlnum, &anrm, &minmn, &c__1, &s[1], &
04156                     minmn, &ierr);
04157         }
04158         if (*info != 0 && anrm < smlnum) {
04159             i__2 = minmn - 1;
04160             dlascl_("G", &c__0, &c__0, &smlnum, &anrm, &i__2, &c__1, &rwork[
04161                     ie], &minmn, &ierr);
04162         }
04163     }
04164 
04165 /*     Return optimal workspace in WORK(1) */
04166 
04167     work[1].r = (doublereal) maxwrk, work[1].i = 0.;
04168 
04169     return 0;
04170 
04171 /*     End of ZGESVD */
04172 
04173 } /* zgesvd_ */


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