00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
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 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
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
00038 int s_cat(char *, char **, integer *, integer *, ftnlen);
00039 double sqrt(doublereal);
00040
00041
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 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 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 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 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 int zungbr_(char *, integer *, integer *, integer
00085 *, doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00086 integer *, integer *);
00087 doublereal smlnum;
00088 integer irwork;
00089 extern 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 int zungqr_(integer *, integer *, integer *,
00097 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00098 integer *, integer *);
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
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
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
00292
00293
00294
00295
00296
00297
00298
00299 if (*info == 0) {
00300 minwrk = 1;
00301 maxwrk = 1;
00302 if (*m >= *n && minmn > 0) {
00303
00304
00305
00306
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
00315
00316 maxwrk = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00317 c_n1, &c_n1);
00318
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
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
00332
00333 wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00334 c_n1, &c_n1);
00335
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
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
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
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
00354
00355
00356 wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00357 c_n1, &c_n1);
00358
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
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
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
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
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
00381
00382 wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00383 c_n1, &c_n1);
00384
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
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
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
00401
00402 wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00403 c_n1, &c_n1);
00404
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
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
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
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
00425
00426
00427 wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00428 c_n1, &c_n1);
00429
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
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
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
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
00450
00451 wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00452 c_n1, &c_n1);
00453
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
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
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
00470
00471 wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00472 c_n1, &c_n1);
00473
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
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
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
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
00494
00495
00496 wrkbl = *n + *n * ilaenv_(&c__1, "ZGEQRF", " ", m, n, &
00497 c_n1, &c_n1);
00498
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
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
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
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
00520
00521 maxwrk = (*n << 1) + (*m + *n) * ilaenv_(&c__1, "ZGEBRD",
00522 " ", m, n, &c_n1, &c_n1);
00523 if (wntus || wntuo) {
00524
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
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
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
00546
00547
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
00556
00557 maxwrk = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00558 c_n1, &c_n1);
00559
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
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
00573
00574 wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00575 c_n1, &c_n1);
00576
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
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
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
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
00595
00596
00597 wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00598 c_n1, &c_n1);
00599
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
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
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
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
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
00622
00623 wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00624 c_n1, &c_n1);
00625
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
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
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
00642
00643 wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00644 c_n1, &c_n1);
00645
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
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
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
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
00666
00667
00668 wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00669 c_n1, &c_n1);
00670
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
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
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
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
00691
00692 wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00693 c_n1, &c_n1);
00694
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
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
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
00711
00712 wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00713 c_n1, &c_n1);
00714
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
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
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
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
00735
00736
00737 wrkbl = *m + *m * ilaenv_(&c__1, "ZGELQF", " ", m, n, &
00738 c_n1, &c_n1);
00739
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
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
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
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
00761
00762 maxwrk = (*m << 1) + (*m + *n) * ilaenv_(&c__1, "ZGEBRD",
00763 " ", m, n, &c_n1, &c_n1);
00764 if (wntvs || wntvo) {
00765
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
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
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
00802
00803 if (*m == 0 || *n == 0) {
00804 return 0;
00805 }
00806
00807
00808
00809 eps = dlamch_("P");
00810 smlnum = sqrt(dlamch_("S")) / eps;
00811 bignum = 1. / smlnum;
00812
00813
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
00830
00831
00832
00833 if (*m >= mnthr) {
00834
00835 if (wntun) {
00836
00837
00838
00839
00840 itau = 1;
00841 iwork = itau + *n;
00842
00843
00844
00845
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
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
00862
00863
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
00872
00873
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
00883
00884
00885
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
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
00901
00902
00903
00904 if (*lwork >= *n * *n + *n * 3) {
00905
00906
00907
00908 ir = 1;
00909
00910 i__2 = wrkbl, i__3 = *lda * *n;
00911 if (*lwork >= max(i__2,i__3) + *lda * *n) {
00912
00913
00914
00915 ldwrku = *lda;
00916 ldwrkr = *lda;
00917 } else {
00918
00919 i__2 = wrkbl, i__3 = *lda * *n;
00920 if (*lwork >= max(i__2,i__3) + *n * *n) {
00921
00922
00923
00924 ldwrku = *lda;
00925 ldwrkr = *n;
00926 } else {
00927
00928
00929
00930 ldwrku = (*lwork - *n * *n) / *n;
00931 ldwrkr = *n;
00932 }
00933 }
00934 itau = ir + ldwrkr * *n;
00935 iwork = itau + *n;
00936
00937
00938
00939
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
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
00954
00955
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
00966
00967
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
00975
00976
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
00984
00985
00986
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
00994
00995
00996
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
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
01011 }
01012
01013 } else {
01014
01015
01016
01017 ie = 1;
01018 itauq = 1;
01019 itaup = itauq + *n;
01020 iwork = itaup + *n;
01021
01022
01023
01024
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
01031
01032
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
01040
01041
01042
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
01053
01054
01055
01056 if (*lwork >= *n * *n + *n * 3) {
01057
01058
01059
01060 ir = 1;
01061
01062 i__3 = wrkbl, i__2 = *lda * *n;
01063 if (*lwork >= max(i__3,i__2) + *lda * *n) {
01064
01065
01066
01067 ldwrku = *lda;
01068 ldwrkr = *lda;
01069 } else {
01070
01071 i__3 = wrkbl, i__2 = *lda * *n;
01072 if (*lwork >= max(i__3,i__2) + *n * *n) {
01073
01074
01075
01076 ldwrku = *lda;
01077 ldwrkr = *n;
01078 } else {
01079
01080
01081
01082 ldwrku = (*lwork - *n * *n) / *n;
01083 ldwrkr = *n;
01084 }
01085 }
01086 itau = ir + ldwrkr * *n;
01087 iwork = itau + *n;
01088
01089
01090
01091
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
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
01109
01110
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
01121
01122
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
01132
01133
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
01140
01141
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
01149
01150
01151
01152
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
01160
01161
01162
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
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
01177 }
01178
01179 } else {
01180
01181
01182
01183 itau = 1;
01184 iwork = itau + *n;
01185
01186
01187
01188
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
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
01206
01207
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
01218
01219
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
01227
01228
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
01236
01237
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
01245
01246
01247
01248
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
01261
01262
01263
01264 if (*lwork >= *n * *n + *n * 3) {
01265
01266
01267
01268 ir = 1;
01269 if (*lwork >= wrkbl + *lda * *n) {
01270
01271
01272
01273 ldwrkr = *lda;
01274 } else {
01275
01276
01277
01278 ldwrkr = *n;
01279 }
01280 itau = ir + ldwrkr * *n;
01281 iwork = itau + *n;
01282
01283
01284
01285
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
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
01301
01302
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
01313
01314
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
01322
01323
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
01331
01332
01333
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
01340
01341
01342
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
01350
01351 itau = 1;
01352 iwork = itau + *n;
01353
01354
01355
01356
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
01365
01366
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
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
01384
01385
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
01393
01394
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
01404
01405
01406
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
01417
01418
01419
01420 if (*lwork >= (*n << 1) * *n + *n * 3) {
01421
01422
01423
01424 iu = 1;
01425 if (*lwork >= wrkbl + (*lda << 1) * *n) {
01426
01427
01428
01429 ldwrku = *lda;
01430 ir = iu + ldwrku * *n;
01431 ldwrkr = *lda;
01432 } else if (*lwork >= wrkbl + (*lda + *n) * *n) {
01433
01434
01435
01436 ldwrku = *lda;
01437 ir = iu + ldwrku * *n;
01438 ldwrkr = *n;
01439 } else {
01440
01441
01442
01443 ldwrku = *n;
01444 ir = iu + ldwrku * *n;
01445 ldwrkr = *n;
01446 }
01447 itau = ir + ldwrkr * *n;
01448 iwork = itau + *n;
01449
01450
01451
01452
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
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
01468
01469
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
01480
01481
01482
01483
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
01493
01494
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
01501
01502
01503
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
01511
01512
01513
01514
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
01521
01522
01523
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
01529
01530
01531
01532 zlacpy_("F", n, n, &work[ir], &ldwrkr, &a[a_offset],
01533 lda);
01534
01535 } else {
01536
01537
01538
01539 itau = 1;
01540 iwork = itau + *n;
01541
01542
01543
01544
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
01553
01554
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
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
01572
01573
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
01581
01582
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
01591
01592
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
01600
01601
01602
01603
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
01614
01615
01616
01617
01618 if (*lwork >= *n * *n + *n * 3) {
01619
01620
01621
01622 iu = 1;
01623 if (*lwork >= wrkbl + *lda * *n) {
01624
01625
01626
01627 ldwrku = *lda;
01628 } else {
01629
01630
01631
01632 ldwrku = *n;
01633 }
01634 itau = iu + ldwrku * *n;
01635 iwork = itau + *n;
01636
01637
01638
01639
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
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
01655
01656
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
01667
01668
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
01678
01679
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
01686
01687
01688
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
01697
01698
01699
01700
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
01707
01708
01709
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
01717
01718 itau = 1;
01719 iwork = itau + *n;
01720
01721
01722
01723
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
01732
01733
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
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
01755
01756
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
01764
01765
01766
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
01774
01775
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
01784
01785
01786
01787
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
01802
01803
01804
01805
01806 i__2 = *n + *m, i__3 = *n * 3;
01807 if (*lwork >= *n * *n + max(i__2,i__3)) {
01808
01809
01810
01811 ir = 1;
01812 if (*lwork >= wrkbl + *lda * *n) {
01813
01814
01815
01816 ldwrkr = *lda;
01817 } else {
01818
01819
01820
01821 ldwrkr = *n;
01822 }
01823 itau = ir + ldwrkr * *n;
01824 iwork = itau + *n;
01825
01826
01827
01828
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
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
01846
01847
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
01858
01859
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
01867
01868
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
01876
01877
01878
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
01885
01886
01887
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
01893
01894 zlacpy_("F", m, n, &a[a_offset], lda, &u[u_offset],
01895 ldu);
01896
01897 } else {
01898
01899
01900
01901 itau = 1;
01902 iwork = itau + *n;
01903
01904
01905
01906
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
01915
01916
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
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
01934
01935
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
01943
01944
01945
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
01955
01956
01957
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
01968
01969
01970
01971
01972 i__2 = *n + *m, i__3 = *n * 3;
01973 if (*lwork >= (*n << 1) * *n + max(i__2,i__3)) {
01974
01975
01976
01977 iu = 1;
01978 if (*lwork >= wrkbl + (*lda << 1) * *n) {
01979
01980
01981
01982 ldwrku = *lda;
01983 ir = iu + ldwrku * *n;
01984 ldwrkr = *lda;
01985 } else if (*lwork >= wrkbl + (*lda + *n) * *n) {
01986
01987
01988
01989 ldwrku = *lda;
01990 ir = iu + ldwrku * *n;
01991 ldwrkr = *n;
01992 } else {
01993
01994
01995
01996 ldwrku = *n;
01997 ir = iu + ldwrku * *n;
01998 ldwrkr = *n;
01999 }
02000 itau = ir + ldwrkr * *n;
02001 iwork = itau + *n;
02002
02003
02004
02005
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
02014
02015
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
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
02035
02036
02037
02038
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
02048
02049
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
02056
02057
02058
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
02066
02067
02068
02069
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
02076
02077
02078
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
02084
02085 zlacpy_("F", m, n, &a[a_offset], lda, &u[u_offset],
02086 ldu);
02087
02088
02089
02090 zlacpy_("F", n, n, &work[ir], &ldwrkr, &a[a_offset],
02091 lda);
02092
02093 } else {
02094
02095
02096
02097 itau = 1;
02098 iwork = itau + *n;
02099
02100
02101
02102
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
02111
02112
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
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
02130
02131
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
02139
02140
02141
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
02150
02151
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
02159
02160
02161
02162
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
02173
02174
02175
02176
02177
02178 i__2 = *n + *m, i__3 = *n * 3;
02179 if (*lwork >= *n * *n + max(i__2,i__3)) {
02180
02181
02182
02183 iu = 1;
02184 if (*lwork >= wrkbl + *lda * *n) {
02185
02186
02187
02188 ldwrku = *lda;
02189 } else {
02190
02191
02192
02193 ldwrku = *n;
02194 }
02195 itau = iu + ldwrku * *n;
02196 iwork = itau + *n;
02197
02198
02199
02200
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
02209
02210
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
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
02230
02231
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
02241
02242
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
02249
02250
02251
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
02260
02261
02262
02263
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
02270
02271
02272
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
02278
02279 zlacpy_("F", m, n, &a[a_offset], lda, &u[u_offset],
02280 ldu);
02281
02282 } else {
02283
02284
02285
02286 itau = 1;
02287 iwork = itau + *n;
02288
02289
02290
02291
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
02300
02301
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
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
02323
02324
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
02332
02333
02334
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
02342
02343
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
02352
02353
02354
02355
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
02370
02371
02372
02373
02374 ie = 1;
02375 itauq = 1;
02376 itaup = itauq + *n;
02377 iwork = itaup + *n;
02378
02379
02380
02381
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
02389
02390
02391
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
02407
02408
02409
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
02419
02420
02421
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
02430
02431
02432
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
02454
02455
02456
02457
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
02465
02466
02467
02468
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
02476
02477
02478
02479
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
02491
02492
02493
02494 if (*n >= mnthr) {
02495
02496 if (wntvn) {
02497
02498
02499
02500
02501 itau = 1;
02502 iwork = itau + *m;
02503
02504
02505
02506
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
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
02524
02525
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
02533
02534
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
02547
02548
02549
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
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
02564
02565
02566
02567 if (*lwork >= *m * *m + *m * 3) {
02568
02569
02570
02571 ir = 1;
02572
02573 i__2 = wrkbl, i__3 = *lda * *n;
02574 if (*lwork >= max(i__2,i__3) + *lda * *m) {
02575
02576
02577
02578 ldwrku = *lda;
02579 chunk = *n;
02580 ldwrkr = *lda;
02581 } else {
02582
02583 i__2 = wrkbl, i__3 = *lda * *n;
02584 if (*lwork >= max(i__2,i__3) + *m * *m) {
02585
02586
02587
02588 ldwrku = *lda;
02589 chunk = *n;
02590 ldwrkr = *m;
02591 } else {
02592
02593
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
02604
02605
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
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
02620
02621
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
02632
02633
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
02641
02642
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
02650
02651
02652
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
02660
02661
02662
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
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
02677 }
02678
02679 } else {
02680
02681
02682
02683 ie = 1;
02684 itauq = 1;
02685 itaup = itauq + *m;
02686 iwork = itaup + *m;
02687
02688
02689
02690
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
02697
02698
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
02706
02707
02708
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
02719
02720
02721
02722 if (*lwork >= *m * *m + *m * 3) {
02723
02724
02725
02726 ir = 1;
02727
02728 i__3 = wrkbl, i__2 = *lda * *n;
02729 if (*lwork >= max(i__3,i__2) + *lda * *m) {
02730
02731
02732
02733 ldwrku = *lda;
02734 chunk = *n;
02735 ldwrkr = *lda;
02736 } else {
02737
02738 i__3 = wrkbl, i__2 = *lda * *n;
02739 if (*lwork >= max(i__3,i__2) + *m * *m) {
02740
02741
02742
02743 ldwrku = *lda;
02744 chunk = *n;
02745 ldwrkr = *m;
02746 } else {
02747
02748
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
02759
02760
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
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
02775
02776
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
02787
02788
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
02796
02797
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
02804
02805
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
02813
02814
02815
02816
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
02824
02825
02826
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
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
02841 }
02842
02843 } else {
02844
02845
02846
02847 itau = 1;
02848 iwork = itau + *m;
02849
02850
02851
02852
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
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
02867
02868
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
02879
02880
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
02887
02888
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
02896
02897
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
02905
02906
02907
02908
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
02921
02922
02923
02924 if (*lwork >= *m * *m + *m * 3) {
02925
02926
02927
02928 ir = 1;
02929 if (*lwork >= wrkbl + *lda * *m) {
02930
02931
02932
02933 ldwrkr = *lda;
02934 } else {
02935
02936
02937
02938 ldwrkr = *m;
02939 }
02940 itau = ir + ldwrkr * *m;
02941 iwork = itau + *m;
02942
02943
02944
02945
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
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
02961
02962
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
02973
02974
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
02982
02983
02984
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
02992
02993
02994
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
03001
03002
03003
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
03011
03012 itau = 1;
03013 iwork = itau + *m;
03014
03015
03016
03017
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
03024
03025 zlacpy_("U", m, n, &a[a_offset], lda, &vt[vt_offset],
03026 ldvt);
03027
03028
03029
03030
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
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
03048
03049
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
03057
03058
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
03067
03068
03069
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
03080
03081
03082
03083 if (*lwork >= (*m << 1) * *m + *m * 3) {
03084
03085
03086
03087 iu = 1;
03088 if (*lwork >= wrkbl + (*lda << 1) * *m) {
03089
03090
03091
03092 ldwrku = *lda;
03093 ir = iu + ldwrku * *m;
03094 ldwrkr = *lda;
03095 } else if (*lwork >= wrkbl + (*lda + *m) * *m) {
03096
03097
03098
03099 ldwrku = *lda;
03100 ir = iu + ldwrku * *m;
03101 ldwrkr = *m;
03102 } else {
03103
03104
03105
03106 ldwrku = *m;
03107 ir = iu + ldwrku * *m;
03108 ldwrkr = *m;
03109 }
03110 itau = ir + ldwrkr * *m;
03111 iwork = itau + *m;
03112
03113
03114
03115
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
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
03131
03132
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
03143
03144
03145
03146
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
03156
03157
03158
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
03165
03166
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
03174
03175
03176
03177
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
03184
03185
03186
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
03192
03193
03194
03195 zlacpy_("F", m, m, &work[ir], &ldwrkr, &a[a_offset],
03196 lda);
03197
03198 } else {
03199
03200
03201
03202 itau = 1;
03203 iwork = itau + *m;
03204
03205
03206
03207
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
03216
03217
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
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
03235
03236
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
03244
03245
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
03253
03254
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
03262
03263
03264
03265
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
03276
03277
03278
03279
03280 if (*lwork >= *m * *m + *m * 3) {
03281
03282
03283
03284 iu = 1;
03285 if (*lwork >= wrkbl + *lda * *m) {
03286
03287
03288
03289 ldwrku = *lda;
03290 } else {
03291
03292
03293
03294 ldwrku = *m;
03295 }
03296 itau = iu + ldwrku * *m;
03297 iwork = itau + *m;
03298
03299
03300
03301
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
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
03317
03318
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
03329
03330
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
03340
03341
03342
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
03349
03350
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
03358
03359
03360
03361
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
03368
03369
03370
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
03378
03379 itau = 1;
03380 iwork = itau + *m;
03381
03382
03383
03384
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
03393
03394
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
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
03414
03415
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
03423
03424
03425
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
03433
03434
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
03442
03443
03444
03445
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
03460
03461
03462
03463
03464 i__2 = *n + *m, i__3 = *m * 3;
03465 if (*lwork >= *m * *m + max(i__2,i__3)) {
03466
03467
03468
03469 ir = 1;
03470 if (*lwork >= wrkbl + *lda * *m) {
03471
03472
03473
03474 ldwrkr = *lda;
03475 } else {
03476
03477
03478
03479 ldwrkr = *m;
03480 }
03481 itau = ir + ldwrkr * *m;
03482 iwork = itau + *m;
03483
03484
03485
03486
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
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
03504
03505
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
03516
03517
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
03525
03526
03527
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
03535
03536
03537
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
03544
03545
03546
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
03552
03553 zlacpy_("F", m, n, &a[a_offset], lda, &vt[vt_offset],
03554 ldvt);
03555
03556 } else {
03557
03558
03559
03560 itau = 1;
03561 iwork = itau + *m;
03562
03563
03564
03565
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
03574
03575
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
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
03593
03594
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
03602
03603
03604
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
03613
03614
03615
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
03626
03627
03628
03629
03630 i__2 = *n + *m, i__3 = *m * 3;
03631 if (*lwork >= (*m << 1) * *m + max(i__2,i__3)) {
03632
03633
03634
03635 iu = 1;
03636 if (*lwork >= wrkbl + (*lda << 1) * *m) {
03637
03638
03639
03640 ldwrku = *lda;
03641 ir = iu + ldwrku * *m;
03642 ldwrkr = *lda;
03643 } else if (*lwork >= wrkbl + (*lda + *m) * *m) {
03644
03645
03646
03647 ldwrku = *lda;
03648 ir = iu + ldwrku * *m;
03649 ldwrkr = *m;
03650 } else {
03651
03652
03653
03654 ldwrku = *m;
03655 ir = iu + ldwrku * *m;
03656 ldwrkr = *m;
03657 }
03658 itau = ir + ldwrkr * *m;
03659 iwork = itau + *m;
03660
03661
03662
03663
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
03672
03673
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
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
03693
03694
03695
03696
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
03706
03707
03708
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
03715
03716
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
03724
03725
03726
03727
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
03734
03735
03736
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
03742
03743 zlacpy_("F", m, n, &a[a_offset], lda, &vt[vt_offset],
03744 ldvt);
03745
03746
03747
03748 zlacpy_("F", m, m, &work[ir], &ldwrkr, &a[a_offset],
03749 lda);
03750
03751 } else {
03752
03753
03754
03755 itau = 1;
03756 iwork = itau + *m;
03757
03758
03759
03760
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
03769
03770
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
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
03788
03789
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
03797
03798
03799
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
03807
03808
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
03816
03817
03818
03819
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
03830
03831
03832
03833
03834
03835 i__2 = *n + *m, i__3 = *m * 3;
03836 if (*lwork >= *m * *m + max(i__2,i__3)) {
03837
03838
03839
03840 iu = 1;
03841 if (*lwork >= wrkbl + *lda * *m) {
03842
03843
03844
03845 ldwrku = *lda;
03846 } else {
03847
03848
03849
03850 ldwrku = *m;
03851 }
03852 itau = iu + ldwrku * *m;
03853 iwork = itau + *m;
03854
03855
03856
03857
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
03866
03867
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
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
03887
03888
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
03898
03899
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
03906
03907
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
03915
03916
03917
03918
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
03925
03926
03927
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
03933
03934 zlacpy_("F", m, n, &a[a_offset], lda, &vt[vt_offset],
03935 ldvt);
03936
03937 } else {
03938
03939
03940
03941 itau = 1;
03942 iwork = itau + *m;
03943
03944
03945
03946
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
03955
03956
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
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
03976
03977
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
03985
03986
03987
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
03995
03996
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
04004
04005
04006
04007
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
04022
04023
04024
04025
04026 ie = 1;
04027 itauq = 1;
04028 itaup = itauq + *m;
04029 iwork = itaup + *m;
04030
04031
04032
04033
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
04041
04042
04043
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
04053
04054
04055
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
04071
04072
04073
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
04082
04083
04084
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
04106
04107
04108
04109
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
04117
04118
04119
04120
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
04128
04129
04130
04131
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
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
04166
04167 work[1].r = (doublereal) maxwrk, work[1].i = 0.;
04168
04169 return 0;
04170
04171
04172
04173 }