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