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__4 = 4;
00021 static integer c__1 = 1;
00022 static integer c__0 = 0;
00023
00024 int zdrvbd_(integer *nsizes, integer *mm, integer *nn,
00025 integer *ntypes, logical *dotype, integer *iseed, doublereal *thresh,
00026 doublecomplex *a, integer *lda, doublecomplex *u, integer *ldu,
00027 doublecomplex *vt, integer *ldvt, doublecomplex *asav, doublecomplex *
00028 usav, doublecomplex *vtsav, doublereal *s, doublereal *ssav,
00029 doublereal *e, doublecomplex *work, integer *lwork, doublereal *rwork,
00030 integer *iwork, integer *nounit, integer *info)
00031 {
00032
00033
00034 static char cjob[1*4] = "N" "O" "S" "A";
00035
00036
00037 static char fmt_9996[] = "(\002 ZDRVBD: \002,a,\002 returned INFO=\002,i"
00038 "6,\002.\002,/9x,\002M=\002,i6,\002, N=\002,i6,\002, JTYPE=\002,i"
00039 "6,\002, ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00040 static char fmt_9995[] = "(\002 ZDRVBD: \002,a,\002 returned INFO=\002,i"
00041 "6,\002.\002,/9x,\002M=\002,i6,\002, N=\002,i6,\002, JTYPE=\002,i"
00042 "6,\002, LSWORK=\002,i6,/9x,\002ISEED=(\002,3(i5,\002,\002),i5"
00043 ",\002)\002)";
00044 static char fmt_9999[] = "(\002 SVD -- Complex Singular Value Decomposit"
00045 "ion Driver \002,/\002 Matrix types (see ZDRVBD for details):\002"
00046 ",//\002 1 = Zero matrix\002,/\002 2 = Identity matrix\002,/\002 "
00047 "3 = Evenly spaced singular values near 1\002,/\002 4 = Evenly sp"
00048 "aced singular values near underflow\002,/\002 5 = Evenly spaced "
00049 "singular values near overflow\002,//\002 Tests performed: ( A is"
00050 " dense, U and V are unitary,\002,/19x,\002 S is an array, and Up"
00051 "artial, VTpartial, and\002,/19x,\002 Spartial are partially comp"
00052 "uted U, VT and S),\002,/)";
00053 static char fmt_9998[] = "(\002 Tests performed with Test Threshold ="
00054 " \002,f8.2,/\002 ZGESVD: \002,/\002 1 = | A - U diag(S) VT | / ("
00055 " |A| max(M,N) ulp ) \002,/\002 2 = | I - U**T U | / ( M ulp )"
00056 " \002,/\002 3 = | I - VT VT**T | / ( N ulp ) \002,/\002 4 = 0 if"
00057 " S contains min(M,N) nonnegative values in\002,\002 decreasing o"
00058 "rder, else 1/ulp\002,/\002 5 = | U - Upartial | / ( M ulp )\002,/"
00059 "\002 6 = | VT - VTpartial | / ( N ulp )\002,/\002 7 = | S - Spar"
00060 "tial | / ( min(M,N) ulp |S| )\002,/\002 ZGESDD: \002,/\002 8 = |"
00061 " A - U diag(S) VT | / ( |A| max(M,N) ulp ) \002,/\002 9 = | I - "
00062 "U**T U | / ( M ulp ) \002,/\00210 = | I - VT VT**T | / ( N ulp ) "
00063 "\002,/\00211 = 0 if S contains min(M,N) nonnegative values in"
00064 "\002,\002 decreasing order, else 1/ulp\002,/\00212 = | U - Upart"
00065 "ial | / ( M ulp )\002,/\00213 = | VT - VTpartial | / ( N ulp "
00066 ")\002,/\00214 = | S - Spartial | / ( min(M,N) ulp |S| )\002,//)";
00067 static char fmt_9997[] = "(\002 M=\002,i5,\002, N=\002,i5,\002, type "
00068 "\002,i1,\002, IWS=\002,i1,\002, seed=\002,4(i4,\002,\002),\002 t"
00069 "est(\002,i1,\002)=\002,g11.4)";
00070
00071
00072 integer a_dim1, a_offset, asav_dim1, asav_offset, u_dim1, u_offset,
00073 usav_dim1, usav_offset, vt_dim1, vt_offset, vtsav_dim1,
00074 vtsav_offset, i__1, i__2, i__3, i__4, i__5, i__6, i__7, i__8,
00075 i__9, i__10, i__11, i__12, i__13, i__14;
00076 doublereal d__1, d__2, d__3;
00077
00078
00079 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00080
00081
00082 integer i__, j, m, n;
00083 doublereal dif, div;
00084 integer ijq, iju;
00085 doublereal ulp;
00086 char jobq[1], jobu[1];
00087 integer mmax, nmax;
00088 doublereal unfl, ovfl;
00089 integer ijvt;
00090 logical badmm, badnn;
00091 integer nfail, iinfo;
00092 extern int zbdt01_(integer *, integer *, integer *,
00093 doublecomplex *, integer *, doublecomplex *, integer *,
00094 doublereal *, doublereal *, doublecomplex *, integer *,
00095 doublecomplex *, doublereal *, doublereal *);
00096 doublereal anorm;
00097 integer mnmin, mnmax;
00098 char jobvt[1];
00099 integer iwspc, jsize, nerrs, jtype, ntest, iwtmp;
00100 extern int zunt01_(char *, integer *, integer *,
00101 doublecomplex *, integer *, doublecomplex *, integer *,
00102 doublereal *, doublereal *), zunt03_(char *, integer *,
00103 integer *, integer *, integer *, doublecomplex *, integer *,
00104 doublecomplex *, integer *, doublecomplex *, integer *,
00105 doublereal *, doublereal *, integer *);
00106 extern doublereal dlamch_(char *);
00107 extern int xerbla_(char *, integer *);
00108 integer ioldsd[4];
00109 extern int zgesdd_(char *, integer *, integer *,
00110 doublecomplex *, integer *, doublereal *, doublecomplex *,
00111 integer *, doublecomplex *, integer *, doublecomplex *, integer *,
00112 doublereal *, integer *, integer *), alasvm_(char *,
00113 integer *, integer *, integer *, integer *), zgesvd_(char
00114 *, char *, integer *, integer *, doublecomplex *, integer *,
00115 doublereal *, doublecomplex *, integer *, doublecomplex *,
00116 integer *, doublecomplex *, integer *, doublereal *, integer *);
00117 integer ntestf;
00118 extern int zlacpy_(char *, integer *, integer *,
00119 doublecomplex *, integer *, doublecomplex *, integer *),
00120 zlaset_(char *, integer *, integer *, doublecomplex *,
00121 doublecomplex *, doublecomplex *, integer *);
00122 integer minwrk;
00123 extern int zlatms_(integer *, integer *, char *, integer
00124 *, char *, doublereal *, integer *, doublereal *, doublereal *,
00125 integer *, integer *, char *, doublecomplex *, integer *,
00126 doublecomplex *, integer *);
00127 doublereal ulpinv, result[14];
00128 integer lswork, mtypes, ntestt;
00129
00130
00131 static cilist io___27 = { 0, 0, 0, fmt_9996, 0 };
00132 static cilist io___32 = { 0, 0, 0, fmt_9995, 0 };
00133 static cilist io___39 = { 0, 0, 0, fmt_9995, 0 };
00134 static cilist io___43 = { 0, 0, 0, fmt_9999, 0 };
00135 static cilist io___44 = { 0, 0, 0, fmt_9998, 0 };
00136 static cilist io___45 = { 0, 0, 0, fmt_9997, 0 };
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
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377 --mm;
00378 --nn;
00379 --dotype;
00380 --iseed;
00381 asav_dim1 = *lda;
00382 asav_offset = 1 + asav_dim1;
00383 asav -= asav_offset;
00384 a_dim1 = *lda;
00385 a_offset = 1 + a_dim1;
00386 a -= a_offset;
00387 usav_dim1 = *ldu;
00388 usav_offset = 1 + usav_dim1;
00389 usav -= usav_offset;
00390 u_dim1 = *ldu;
00391 u_offset = 1 + u_dim1;
00392 u -= u_offset;
00393 vtsav_dim1 = *ldvt;
00394 vtsav_offset = 1 + vtsav_dim1;
00395 vtsav -= vtsav_offset;
00396 vt_dim1 = *ldvt;
00397 vt_offset = 1 + vt_dim1;
00398 vt -= vt_offset;
00399 --s;
00400 --ssav;
00401 --e;
00402 --work;
00403 --rwork;
00404 --iwork;
00405
00406
00407
00408
00409
00410
00411
00412 *info = 0;
00413
00414
00415
00416 nerrs = 0;
00417 ntestt = 0;
00418 ntestf = 0;
00419 badmm = FALSE_;
00420 badnn = FALSE_;
00421 mmax = 1;
00422 nmax = 1;
00423 mnmax = 1;
00424 minwrk = 1;
00425 i__1 = *nsizes;
00426 for (j = 1; j <= i__1; ++j) {
00427
00428 i__2 = mmax, i__3 = mm[j];
00429 mmax = max(i__2,i__3);
00430 if (mm[j] < 0) {
00431 badmm = TRUE_;
00432 }
00433
00434 i__2 = nmax, i__3 = nn[j];
00435 nmax = max(i__2,i__3);
00436 if (nn[j] < 0) {
00437 badnn = TRUE_;
00438 }
00439
00440
00441 i__4 = mm[j], i__5 = nn[j];
00442 i__2 = mnmax, i__3 = min(i__4,i__5);
00443 mnmax = max(i__2,i__3);
00444
00445
00446
00447 i__6 = mm[j], i__7 = nn[j];
00448
00449 i__9 = mm[j], i__10 = nn[j];
00450
00451 i__8 = max(i__9,i__10);
00452
00453 i__11 = mm[j], i__12 = nn[j];
00454
00455 i__13 = mm[j], i__14 = nn[j];
00456 i__4 = min(i__6,i__7) * 3 + i__8 * i__8, i__5 = min(i__11,i__12) * 5,
00457 i__4 = max(i__4,i__5), i__5 = max(i__13,i__14) * 3;
00458 i__2 = minwrk, i__3 = max(i__4,i__5);
00459 minwrk = max(i__2,i__3);
00460
00461 }
00462
00463
00464
00465 if (*nsizes < 0) {
00466 *info = -1;
00467 } else if (badmm) {
00468 *info = -2;
00469 } else if (badnn) {
00470 *info = -3;
00471 } else if (*ntypes < 0) {
00472 *info = -4;
00473 } else if (*lda < max(1,mmax)) {
00474 *info = -10;
00475 } else if (*ldu < max(1,mmax)) {
00476 *info = -12;
00477 } else if (*ldvt < max(1,nmax)) {
00478 *info = -14;
00479 } else if (minwrk > *lwork) {
00480 *info = -21;
00481 }
00482
00483 if (*info != 0) {
00484 i__1 = -(*info);
00485 xerbla_("ZDRVBD", &i__1);
00486 return 0;
00487 }
00488
00489
00490
00491 if (*nsizes == 0 || *ntypes == 0) {
00492 return 0;
00493 }
00494
00495
00496
00497 unfl = dlamch_("S");
00498 ovfl = 1. / unfl;
00499 ulp = dlamch_("E");
00500 ulpinv = 1. / ulp;
00501
00502
00503
00504 nerrs = 0;
00505
00506 i__1 = *nsizes;
00507 for (jsize = 1; jsize <= i__1; ++jsize) {
00508 m = mm[jsize];
00509 n = nn[jsize];
00510 mnmin = min(m,n);
00511
00512 if (*nsizes != 1) {
00513 mtypes = min(5,*ntypes);
00514 } else {
00515 mtypes = min(6,*ntypes);
00516 }
00517
00518 i__2 = mtypes;
00519 for (jtype = 1; jtype <= i__2; ++jtype) {
00520 if (! dotype[jtype]) {
00521 goto L170;
00522 }
00523 ntest = 0;
00524
00525 for (j = 1; j <= 4; ++j) {
00526 ioldsd[j - 1] = iseed[j];
00527
00528 }
00529
00530
00531
00532 if (mtypes > 5) {
00533 goto L50;
00534 }
00535
00536 if (jtype == 1) {
00537
00538
00539
00540 zlaset_("Full", &m, &n, &c_b1, &c_b1, &a[a_offset], lda);
00541 i__3 = min(m,n);
00542 for (i__ = 1; i__ <= i__3; ++i__) {
00543 s[i__] = 0.;
00544
00545 }
00546
00547 } else if (jtype == 2) {
00548
00549
00550
00551 zlaset_("Full", &m, &n, &c_b1, &c_b2, &a[a_offset], lda);
00552 i__3 = min(m,n);
00553 for (i__ = 1; i__ <= i__3; ++i__) {
00554 s[i__] = 1.;
00555
00556 }
00557
00558 } else {
00559
00560
00561
00562 if (jtype == 3) {
00563 anorm = 1.;
00564 }
00565 if (jtype == 4) {
00566 anorm = unfl / ulp;
00567 }
00568 if (jtype == 5) {
00569 anorm = ovfl * ulp;
00570 }
00571 d__1 = (doublereal) mnmin;
00572 i__3 = m - 1;
00573 i__4 = n - 1;
00574 zlatms_(&m, &n, "U", &iseed[1], "N", &s[1], &c__4, &d__1, &
00575 anorm, &i__3, &i__4, "N", &a[a_offset], lda, &work[1],
00576 &iinfo);
00577 if (iinfo != 0) {
00578 io___27.ciunit = *nounit;
00579 s_wsfe(&io___27);
00580 do_fio(&c__1, "Generator", (ftnlen)9);
00581 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00582 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00583 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00584 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00585 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00586 ;
00587 e_wsfe();
00588 *info = abs(iinfo);
00589 return 0;
00590 }
00591 }
00592
00593 L50:
00594 zlacpy_("F", &m, &n, &a[a_offset], lda, &asav[asav_offset], lda);
00595
00596
00597
00598 for (iwspc = 1; iwspc <= 4; ++iwspc) {
00599
00600
00601
00602 iwtmp = (min(m,n) << 1) + max(m,n);
00603 lswork = iwtmp + (iwspc - 1) * (*lwork - iwtmp) / 3;
00604 lswork = min(lswork,*lwork);
00605 lswork = max(lswork,1);
00606 if (iwspc == 4) {
00607 lswork = *lwork;
00608 }
00609
00610 for (j = 1; j <= 14; ++j) {
00611 result[j - 1] = -1.;
00612
00613 }
00614
00615
00616
00617 if (iwspc > 1) {
00618 zlacpy_("F", &m, &n, &asav[asav_offset], lda, &a[a_offset]
00619 , lda);
00620 }
00621 zgesvd_("A", "A", &m, &n, &a[a_offset], lda, &ssav[1], &usav[
00622 usav_offset], ldu, &vtsav[vtsav_offset], ldvt, &work[
00623 1], &lswork, &rwork[1], &iinfo);
00624 if (iinfo != 0) {
00625 io___32.ciunit = *nounit;
00626 s_wsfe(&io___32);
00627 do_fio(&c__1, "GESVD", (ftnlen)5);
00628 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00629 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00630 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00631 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00632 do_fio(&c__1, (char *)&lswork, (ftnlen)sizeof(integer));
00633 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00634 ;
00635 e_wsfe();
00636 *info = abs(iinfo);
00637 return 0;
00638 }
00639
00640
00641
00642 zbdt01_(&m, &n, &c__0, &asav[asav_offset], lda, &usav[
00643 usav_offset], ldu, &ssav[1], &e[1], &vtsav[
00644 vtsav_offset], ldvt, &work[1], &rwork[1], result);
00645 if (m != 0 && n != 0) {
00646 zunt01_("Columns", &mnmin, &m, &usav[usav_offset], ldu, &
00647 work[1], lwork, &rwork[1], &result[1]);
00648 zunt01_("Rows", &mnmin, &n, &vtsav[vtsav_offset], ldvt, &
00649 work[1], lwork, &rwork[1], &result[2]);
00650 }
00651 result[3] = 0.;
00652 i__3 = mnmin - 1;
00653 for (i__ = 1; i__ <= i__3; ++i__) {
00654 if (ssav[i__] < ssav[i__ + 1]) {
00655 result[3] = ulpinv;
00656 }
00657 if (ssav[i__] < 0.) {
00658 result[3] = ulpinv;
00659 }
00660
00661 }
00662 if (mnmin >= 1) {
00663 if (ssav[mnmin] < 0.) {
00664 result[3] = ulpinv;
00665 }
00666 }
00667
00668
00669
00670 result[4] = 0.;
00671 result[5] = 0.;
00672 result[6] = 0.;
00673 for (iju = 0; iju <= 3; ++iju) {
00674 for (ijvt = 0; ijvt <= 3; ++ijvt) {
00675 if (iju == 3 && ijvt == 3 || iju == 1 && ijvt == 1) {
00676 goto L90;
00677 }
00678 *(unsigned char *)jobu = *(unsigned char *)&cjob[iju];
00679 *(unsigned char *)jobvt = *(unsigned char *)&cjob[
00680 ijvt];
00681 zlacpy_("F", &m, &n, &asav[asav_offset], lda, &a[
00682 a_offset], lda);
00683 zgesvd_(jobu, jobvt, &m, &n, &a[a_offset], lda, &s[1],
00684 &u[u_offset], ldu, &vt[vt_offset], ldvt, &
00685 work[1], &lswork, &rwork[1], &iinfo);
00686
00687
00688
00689 dif = 0.;
00690 if (m > 0 && n > 0) {
00691 if (iju == 1) {
00692 zunt03_("C", &m, &mnmin, &m, &mnmin, &usav[
00693 usav_offset], ldu, &a[a_offset], lda,
00694 &work[1], lwork, &rwork[1], &dif, &
00695 iinfo);
00696 } else if (iju == 2) {
00697 zunt03_("C", &m, &mnmin, &m, &mnmin, &usav[
00698 usav_offset], ldu, &u[u_offset], ldu,
00699 &work[1], lwork, &rwork[1], &dif, &
00700 iinfo);
00701 } else if (iju == 3) {
00702 zunt03_("C", &m, &m, &m, &mnmin, &usav[
00703 usav_offset], ldu, &u[u_offset], ldu,
00704 &work[1], lwork, &rwork[1], &dif, &
00705 iinfo);
00706 }
00707 }
00708 result[4] = max(result[4],dif);
00709
00710
00711
00712 dif = 0.;
00713 if (m > 0 && n > 0) {
00714 if (ijvt == 1) {
00715 zunt03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00716 vtsav_offset], ldvt, &a[a_offset],
00717 lda, &work[1], lwork, &rwork[1], &dif,
00718 &iinfo);
00719 } else if (ijvt == 2) {
00720 zunt03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00721 vtsav_offset], ldvt, &vt[vt_offset],
00722 ldvt, &work[1], lwork, &rwork[1], &
00723 dif, &iinfo);
00724 } else if (ijvt == 3) {
00725 zunt03_("R", &n, &n, &n, &mnmin, &vtsav[
00726 vtsav_offset], ldvt, &vt[vt_offset],
00727 ldvt, &work[1], lwork, &rwork[1], &
00728 dif, &iinfo);
00729 }
00730 }
00731 result[5] = max(result[5],dif);
00732
00733
00734
00735 dif = 0.;
00736
00737 d__1 = (doublereal) mnmin * ulp * s[1], d__2 =
00738 dlamch_("Safe minimum");
00739 div = max(d__1,d__2);
00740 i__3 = mnmin - 1;
00741 for (i__ = 1; i__ <= i__3; ++i__) {
00742 if (ssav[i__] < ssav[i__ + 1]) {
00743 dif = ulpinv;
00744 }
00745 if (ssav[i__] < 0.) {
00746 dif = ulpinv;
00747 }
00748
00749 d__2 = dif, d__3 = (d__1 = ssav[i__] - s[i__],
00750 abs(d__1)) / div;
00751 dif = max(d__2,d__3);
00752
00753 }
00754 result[6] = max(result[6],dif);
00755 L90:
00756 ;
00757 }
00758
00759 }
00760
00761
00762
00763 iwtmp = (mnmin << 1) * mnmin + (mnmin << 1) + max(m,n);
00764 lswork = iwtmp + (iwspc - 1) * (*lwork - iwtmp) / 3;
00765 lswork = min(lswork,*lwork);
00766 lswork = max(lswork,1);
00767 if (iwspc == 4) {
00768 lswork = *lwork;
00769 }
00770
00771
00772
00773 zlacpy_("F", &m, &n, &asav[asav_offset], lda, &a[a_offset],
00774 lda);
00775 zgesdd_("A", &m, &n, &a[a_offset], lda, &ssav[1], &usav[
00776 usav_offset], ldu, &vtsav[vtsav_offset], ldvt, &work[
00777 1], &lswork, &rwork[1], &iwork[1], &iinfo);
00778 if (iinfo != 0) {
00779 io___39.ciunit = *nounit;
00780 s_wsfe(&io___39);
00781 do_fio(&c__1, "GESDD", (ftnlen)5);
00782 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00783 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00784 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00785 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00786 do_fio(&c__1, (char *)&lswork, (ftnlen)sizeof(integer));
00787 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00788 ;
00789 e_wsfe();
00790 *info = abs(iinfo);
00791 return 0;
00792 }
00793
00794
00795
00796 zbdt01_(&m, &n, &c__0, &asav[asav_offset], lda, &usav[
00797 usav_offset], ldu, &ssav[1], &e[1], &vtsav[
00798 vtsav_offset], ldvt, &work[1], &rwork[1], &result[7]);
00799 if (m != 0 && n != 0) {
00800 zunt01_("Columns", &mnmin, &m, &usav[usav_offset], ldu, &
00801 work[1], lwork, &rwork[1], &result[8]);
00802 zunt01_("Rows", &mnmin, &n, &vtsav[vtsav_offset], ldvt, &
00803 work[1], lwork, &rwork[1], &result[9]);
00804 }
00805 result[10] = 0.;
00806 i__3 = mnmin - 1;
00807 for (i__ = 1; i__ <= i__3; ++i__) {
00808 if (ssav[i__] < ssav[i__ + 1]) {
00809 result[10] = ulpinv;
00810 }
00811 if (ssav[i__] < 0.) {
00812 result[10] = ulpinv;
00813 }
00814
00815 }
00816 if (mnmin >= 1) {
00817 if (ssav[mnmin] < 0.) {
00818 result[10] = ulpinv;
00819 }
00820 }
00821
00822
00823
00824 result[11] = 0.;
00825 result[12] = 0.;
00826 result[13] = 0.;
00827 for (ijq = 0; ijq <= 2; ++ijq) {
00828 *(unsigned char *)jobq = *(unsigned char *)&cjob[ijq];
00829 zlacpy_("F", &m, &n, &asav[asav_offset], lda, &a[a_offset]
00830 , lda);
00831 zgesdd_(jobq, &m, &n, &a[a_offset], lda, &s[1], &u[
00832 u_offset], ldu, &vt[vt_offset], ldvt, &work[1], &
00833 lswork, &rwork[1], &iwork[1], &iinfo);
00834
00835
00836
00837 dif = 0.;
00838 if (m > 0 && n > 0) {
00839 if (ijq == 1) {
00840 if (m >= n) {
00841 zunt03_("C", &m, &mnmin, &m, &mnmin, &usav[
00842 usav_offset], ldu, &a[a_offset], lda,
00843 &work[1], lwork, &rwork[1], &dif, &
00844 iinfo);
00845 } else {
00846 zunt03_("C", &m, &mnmin, &m, &mnmin, &usav[
00847 usav_offset], ldu, &u[u_offset], ldu,
00848 &work[1], lwork, &rwork[1], &dif, &
00849 iinfo);
00850 }
00851 } else if (ijq == 2) {
00852 zunt03_("C", &m, &mnmin, &m, &mnmin, &usav[
00853 usav_offset], ldu, &u[u_offset], ldu, &
00854 work[1], lwork, &rwork[1], &dif, &iinfo);
00855 }
00856 }
00857 result[11] = max(result[11],dif);
00858
00859
00860
00861 dif = 0.;
00862 if (m > 0 && n > 0) {
00863 if (ijq == 1) {
00864 if (m >= n) {
00865 zunt03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00866 vtsav_offset], ldvt, &vt[vt_offset],
00867 ldvt, &work[1], lwork, &rwork[1], &
00868 dif, &iinfo);
00869 } else {
00870 zunt03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00871 vtsav_offset], ldvt, &a[a_offset],
00872 lda, &work[1], lwork, &rwork[1], &dif,
00873 &iinfo);
00874 }
00875 } else if (ijq == 2) {
00876 zunt03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00877 vtsav_offset], ldvt, &vt[vt_offset], ldvt,
00878 &work[1], lwork, &rwork[1], &dif, &iinfo);
00879 }
00880 }
00881 result[12] = max(result[12],dif);
00882
00883
00884
00885 dif = 0.;
00886
00887 d__1 = (doublereal) mnmin * ulp * s[1], d__2 = dlamch_(
00888 "Safe minimum");
00889 div = max(d__1,d__2);
00890 i__3 = mnmin - 1;
00891 for (i__ = 1; i__ <= i__3; ++i__) {
00892 if (ssav[i__] < ssav[i__ + 1]) {
00893 dif = ulpinv;
00894 }
00895 if (ssav[i__] < 0.) {
00896 dif = ulpinv;
00897 }
00898
00899 d__2 = dif, d__3 = (d__1 = ssav[i__] - s[i__], abs(
00900 d__1)) / div;
00901 dif = max(d__2,d__3);
00902
00903 }
00904 result[13] = max(result[13],dif);
00905
00906 }
00907
00908
00909
00910 ntest = 0;
00911 nfail = 0;
00912 for (j = 1; j <= 14; ++j) {
00913 if (result[j - 1] >= 0.) {
00914 ++ntest;
00915 }
00916 if (result[j - 1] >= *thresh) {
00917 ++nfail;
00918 }
00919
00920 }
00921
00922 if (nfail > 0) {
00923 ++ntestf;
00924 }
00925 if (ntestf == 1) {
00926 io___43.ciunit = *nounit;
00927 s_wsfe(&io___43);
00928 e_wsfe();
00929 io___44.ciunit = *nounit;
00930 s_wsfe(&io___44);
00931 do_fio(&c__1, (char *)&(*thresh), (ftnlen)sizeof(
00932 doublereal));
00933 e_wsfe();
00934 ntestf = 2;
00935 }
00936
00937 for (j = 1; j <= 14; ++j) {
00938 if (result[j - 1] >= *thresh) {
00939 io___45.ciunit = *nounit;
00940 s_wsfe(&io___45);
00941 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00942 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00943 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
00944 ;
00945 do_fio(&c__1, (char *)&iwspc, (ftnlen)sizeof(integer))
00946 ;
00947 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
00948 integer));
00949 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
00950 do_fio(&c__1, (char *)&result[j - 1], (ftnlen)sizeof(
00951 doublereal));
00952 e_wsfe();
00953 }
00954
00955 }
00956
00957 nerrs += nfail;
00958 ntestt += ntest;
00959
00960
00961 }
00962
00963 L170:
00964 ;
00965 }
00966
00967 }
00968
00969
00970
00971 alasvm_("ZBD", nounit, &nerrs, &ntestt, &c__0);
00972
00973
00974 return 0;
00975
00976
00977
00978 }