00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 struct {
00019 integer infot, nunit;
00020 logical ok, lerr;
00021 } infoc_;
00022
00023 #define infoc_1 infoc_
00024
00025 struct {
00026 char srnamt[32];
00027 } srnamc_;
00028
00029 #define srnamc_1 srnamc_
00030
00031
00032
00033 static real c_b13 = 0.f;
00034 static real c_b17 = 1.f;
00035 static integer c__4 = 4;
00036 static integer c__1 = 1;
00037 static integer c__0 = 0;
00038
00039 int sdrvbd_(integer *nsizes, integer *mm, integer *nn,
00040 integer *ntypes, logical *dotype, integer *iseed, real *thresh, real *
00041 a, integer *lda, real *u, integer *ldu, real *vt, integer *ldvt, real
00042 *asav, real *usav, real *vtsav, real *s, real *ssav, real *e, real *
00043 work, integer *lwork, integer *iwork, integer *nout, integer *info)
00044 {
00045
00046
00047 static char cjob[1*4] = "N" "O" "S" "A";
00048
00049
00050 static char fmt_9996[] = "(\002 SDRVBD: \002,a,\002 returned INFO=\002,i"
00051 "6,\002.\002,/9x,\002M=\002,i6,\002, N=\002,i6,\002, JTYPE=\002,i"
00052 "6,\002, ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00053 static char fmt_9995[] = "(\002 SDRVBD: \002,a,\002 returned INFO=\002,i"
00054 "6,\002.\002,/9x,\002M=\002,i6,\002, N=\002,i6,\002, JTYPE=\002,i"
00055 "6,\002, LSWORK=\002,i6,/9x,\002ISEED=(\002,3(i5,\002,\002),i5"
00056 ",\002)\002)";
00057 static char fmt_9999[] = "(\002 SVD -- Real Singular Value Decomposition"
00058 " Driver \002,/\002 Matrix types (see SDRVBD for details):\002,/"
00059 "/\002 1 = Zero matrix\002,/\002 2 = Identity matrix\002,/\002 3 "
00060 "= Evenly spaced singular values near 1\002,/\002 4 = Evenly spac"
00061 "ed singular values near underflow\002,/\002 5 = Evenly spaced si"
00062 "ngular values near overflow\002,//\002 Tests performed: ( A is d"
00063 "ense, U and V are orthogonal,\002,/19x,\002 S is an array, and U"
00064 "partial, VTpartial, and\002,/19x,\002 Spartial are partially com"
00065 "puted U, VT and S),\002,/)";
00066 static char fmt_9998[] = "(\002 1 = | A - U diag(S) VT | / ( |A| max(M,N"
00067 ") ulp ) \002,/\002 2 = | I - U**T U | / ( M ulp ) \002,/\002 3 ="
00068 " | I - VT VT**T | / ( N ulp ) \002,/\002 4 = 0 if S contains min"
00069 "(M,N) nonnegative values in\002,\002 decreasing order, else 1/ulp"
00070 "\002,/\002 5 = | U - Upartial | / ( M ulp )\002,/\002 6 = | VT -"
00071 " VTpartial | / ( N ulp )\002,/\002 7 = | S - Spartial | / ( min("
00072 "M,N) ulp |S| )\002,/\002 8 = | A - U diag(S) VT | / ( |A| max(M,"
00073 "N) ulp ) \002,/\002 9 = | I - U**T U | / ( M ulp ) \002,/\00210 "
00074 "= | I - VT VT**T | / ( N ulp ) \002,/\00211 = 0 if S contains mi"
00075 "n(M,N) nonnegative values in\002,\002 decreasing order, else 1/u"
00076 "lp\002,/\00212 = | U - Upartial | / ( M ulp )\002,/\00213 = | VT"
00077 " - VTpartial | / ( N ulp )\002,/\00214 = | S - Spartial | / ( mi"
00078 "n(M,N) ulp |S| )\002,/\00215 = | A - U diag(S) VT | / ( |A| max("
00079 "M,N) ulp ) \002,/\00216 = | I - U**T U | / ( M ulp ) \002,/\0021"
00080 "7 = | I - VT VT**T | / ( N ulp ) \002,/\00218 = 0 if S contains "
00081 "min(M,N) nonnegative values in\002,\002 decreasing order, else 1"
00082 "/ulp\002,/\00219 = | U - Upartial | / ( M ulp )\002,/\00220 = | "
00083 "VT - VTpartial | / ( N ulp )\002,/\00221 = | S - Spartial | / ( "
00084 "min(M,N) ulp |S| )\002,//)";
00085 static char fmt_9997[] = "(\002 M=\002,i5,\002, N=\002,i5,\002, type "
00086 "\002,i1,\002, IWS=\002,i1,\002, seed=\002,4(i4,\002,\002),\002 t"
00087 "est(\002,i2,\002)=\002,g11.4)";
00088
00089
00090 integer a_dim1, a_offset, asav_dim1, asav_offset, u_dim1, u_offset,
00091 usav_dim1, usav_offset, vt_dim1, vt_offset, vtsav_dim1,
00092 vtsav_offset, i__1, i__2, i__3, i__4, i__5, i__6, i__7, i__8,
00093 i__9, i__10, i__11, i__12, i__13, i__14;
00094 real r__1, r__2, r__3;
00095
00096
00097 int s_copy(char *, char *, ftnlen, ftnlen);
00098 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00099
00100
00101 integer i__, j, m, n;
00102 real dif, div;
00103 integer ijq, iju;
00104 real ulp;
00105 integer iws;
00106 char jobq[1], path[3], jobu[1];
00107 integer mmax, nmax;
00108 real unfl, ovfl;
00109 integer ijvt;
00110 logical badmm, badnn;
00111 integer nfail;
00112 extern int sbdt01_(integer *, integer *, integer *, real
00113 *, integer *, real *, integer *, real *, real *, real *, integer *
00114 , real *, real *);
00115 integer iinfo;
00116 real anorm;
00117 integer mnmin, mnmax;
00118 char jobvt[1];
00119 integer jsize;
00120 extern int sort01_(char *, integer *, integer *, real *,
00121 integer *, real *, integer *, real *), sort03_(char *,
00122 integer *, integer *, integer *, integer *, real *, integer *,
00123 real *, integer *, real *, integer *, real *, integer *);
00124 integer jtype, ntest, iwtmp;
00125 extern int slabad_(real *, real *);
00126 extern doublereal slamch_(char *);
00127 extern int sgesdd_(char *, integer *, integer *, real *,
00128 integer *, real *, real *, integer *, real *, integer *, real *,
00129 integer *, integer *, integer *), xerbla_(char *, integer
00130 *);
00131 integer ioldsd[4];
00132 extern int alasvm_(char *, integer *, integer *, integer
00133 *, integer *), sgesvd_(char *, char *, integer *, integer
00134 *, real *, integer *, real *, real *, integer *, real *, integer *
00135 , real *, integer *, integer *), slacpy_(char *,
00136 integer *, integer *, real *, integer *, real *, integer *), slaset_(char *, integer *, integer *, real *, real *,
00137 real *, integer *), sgesvj_(char *, char *, char *,
00138 integer *, integer *, real *, integer *, real *, integer *, real *
00139 , integer *, real *, integer *, integer *)
00140 , sgejsv_(char *, char *, char *, char *, char *, char *, integer
00141 *, integer *, real *, integer *, real *, real *, integer *, real *
00142 , integer *, real *, integer *, integer *, integer *), slatms_(integer *,
00143 integer *, char *, integer *, char *, real *, integer *, real *,
00144 real *, integer *, integer *, char *, real *, integer *, real *,
00145 integer *);
00146 integer minwrk;
00147 real ulpinv, result[22];
00148 integer lswork, mtypes;
00149
00150
00151 static cilist io___25 = { 0, 0, 0, fmt_9996, 0 };
00152 static cilist io___30 = { 0, 0, 0, fmt_9995, 0 };
00153 static cilist io___38 = { 0, 0, 0, fmt_9995, 0 };
00154 static cilist io___41 = { 0, 0, 0, fmt_9995, 0 };
00155 static cilist io___42 = { 0, 0, 0, fmt_9995, 0 };
00156 static cilist io___43 = { 0, 0, 0, fmt_9999, 0 };
00157 static cilist io___44 = { 0, 0, 0, fmt_9998, 0 };
00158 static cilist io___45 = { 0, 0, 0, fmt_9997, 0 };
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
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392 --mm;
00393 --nn;
00394 --dotype;
00395 --iseed;
00396 asav_dim1 = *lda;
00397 asav_offset = 1 + asav_dim1;
00398 asav -= asav_offset;
00399 a_dim1 = *lda;
00400 a_offset = 1 + a_dim1;
00401 a -= a_offset;
00402 usav_dim1 = *ldu;
00403 usav_offset = 1 + usav_dim1;
00404 usav -= usav_offset;
00405 u_dim1 = *ldu;
00406 u_offset = 1 + u_dim1;
00407 u -= u_offset;
00408 vtsav_dim1 = *ldvt;
00409 vtsav_offset = 1 + vtsav_dim1;
00410 vtsav -= vtsav_offset;
00411 vt_dim1 = *ldvt;
00412 vt_offset = 1 + vt_dim1;
00413 vt -= vt_offset;
00414 --s;
00415 --ssav;
00416 --e;
00417 --work;
00418 --iwork;
00419
00420
00421
00422
00423
00424
00425
00426 *info = 0;
00427 badmm = FALSE_;
00428 badnn = FALSE_;
00429 mmax = 1;
00430 nmax = 1;
00431 mnmax = 1;
00432 minwrk = 1;
00433 i__1 = *nsizes;
00434 for (j = 1; j <= i__1; ++j) {
00435
00436 i__2 = mmax, i__3 = mm[j];
00437 mmax = max(i__2,i__3);
00438 if (mm[j] < 0) {
00439 badmm = TRUE_;
00440 }
00441
00442 i__2 = nmax, i__3 = nn[j];
00443 nmax = max(i__2,i__3);
00444 if (nn[j] < 0) {
00445 badnn = TRUE_;
00446 }
00447
00448
00449 i__4 = mm[j], i__5 = nn[j];
00450 i__2 = mnmax, i__3 = min(i__4,i__5);
00451 mnmax = max(i__2,i__3);
00452
00453
00454
00455 i__6 = mm[j], i__7 = nn[j];
00456
00457 i__8 = mm[j], i__9 = nn[j];
00458
00459 i__10 = mm[j], i__11 = nn[j] - 4;
00460 i__4 = min(i__6,i__7) * 3 + max(i__8,i__9), i__5 = min(i__10,i__11) *
00461 5;
00462
00463 i__13 = mm[j], i__14 = nn[j];
00464
00465 i__12 = min(i__13,i__14);
00466 i__2 = minwrk, i__3 = max(i__4,i__5) + (i__12 * i__12 << 1);
00467 minwrk = max(i__2,i__3);
00468
00469 }
00470
00471
00472
00473 if (*nsizes < 0) {
00474 *info = -1;
00475 } else if (badmm) {
00476 *info = -2;
00477 } else if (badnn) {
00478 *info = -3;
00479 } else if (*ntypes < 0) {
00480 *info = -4;
00481 } else if (*lda < max(1,mmax)) {
00482 *info = -10;
00483 } else if (*ldu < max(1,mmax)) {
00484 *info = -12;
00485 } else if (*ldvt < max(1,nmax)) {
00486 *info = -14;
00487 } else if (minwrk > *lwork) {
00488 *info = -21;
00489 }
00490
00491 if (*info != 0) {
00492 i__1 = -(*info);
00493 xerbla_("SDRVBD", &i__1);
00494 return 0;
00495 }
00496
00497
00498
00499 s_copy(path, "Single precision", (ftnlen)1, (ftnlen)16);
00500 s_copy(path + 1, "BD", (ftnlen)2, (ftnlen)2);
00501 nfail = 0;
00502 ntest = 0;
00503 unfl = slamch_("Safe minimum");
00504 ovfl = 1.f / unfl;
00505 slabad_(&unfl, &ovfl);
00506 ulp = slamch_("Precision");
00507 ulpinv = 1.f / ulp;
00508 infoc_1.infot = 0;
00509
00510
00511
00512 i__1 = *nsizes;
00513 for (jsize = 1; jsize <= i__1; ++jsize) {
00514 m = mm[jsize];
00515 n = nn[jsize];
00516 mnmin = min(m,n);
00517
00518 if (*nsizes != 1) {
00519 mtypes = min(5,*ntypes);
00520 } else {
00521 mtypes = min(6,*ntypes);
00522 }
00523
00524 i__2 = mtypes;
00525 for (jtype = 1; jtype <= i__2; ++jtype) {
00526 if (! dotype[jtype]) {
00527 goto L140;
00528 }
00529
00530 for (j = 1; j <= 4; ++j) {
00531 ioldsd[j - 1] = iseed[j];
00532
00533 }
00534
00535
00536
00537 if (mtypes > 5) {
00538 goto L30;
00539 }
00540
00541 if (jtype == 1) {
00542
00543
00544
00545 slaset_("Full", &m, &n, &c_b13, &c_b13, &a[a_offset], lda);
00546
00547 } else if (jtype == 2) {
00548
00549
00550
00551 slaset_("Full", &m, &n, &c_b13, &c_b17, &a[a_offset], lda);
00552
00553 } else {
00554
00555
00556
00557 if (jtype == 3) {
00558 anorm = 1.f;
00559 }
00560 if (jtype == 4) {
00561 anorm = unfl / ulp;
00562 }
00563 if (jtype == 5) {
00564 anorm = ovfl * ulp;
00565 }
00566 r__1 = (real) mnmin;
00567 i__3 = m - 1;
00568 i__4 = n - 1;
00569 slatms_(&m, &n, "U", &iseed[1], "N", &s[1], &c__4, &r__1, &
00570 anorm, &i__3, &i__4, "N", &a[a_offset], lda, &work[1],
00571 &iinfo);
00572 if (iinfo != 0) {
00573 io___25.ciunit = *nout;
00574 s_wsfe(&io___25);
00575 do_fio(&c__1, "Generator", (ftnlen)9);
00576 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00577 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00578 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00579 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00580 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00581 ;
00582 e_wsfe();
00583 *info = abs(iinfo);
00584 return 0;
00585 }
00586 }
00587
00588 L30:
00589 slacpy_("F", &m, &n, &a[a_offset], lda, &asav[asav_offset], lda);
00590
00591
00592
00593 for (iws = 1; iws <= 4; ++iws) {
00594
00595 for (j = 1; j <= 14; ++j) {
00596 result[j - 1] = -1.f;
00597
00598 }
00599
00600
00601
00602
00603 i__3 = min(m,n) * 3 + max(m,n), i__4 = min(m,n) * 5;
00604 iwtmp = max(i__3,i__4);
00605 lswork = iwtmp + (iws - 1) * (*lwork - iwtmp) / 3;
00606 lswork = min(lswork,*lwork);
00607 lswork = max(lswork,1);
00608 if (iws == 4) {
00609 lswork = *lwork;
00610 }
00611
00612 if (iws > 1) {
00613 slacpy_("F", &m, &n, &asav[asav_offset], lda, &a[a_offset]
00614 , lda);
00615 }
00616 s_copy(srnamc_1.srnamt, "SGESVD", (ftnlen)32, (ftnlen)6);
00617 sgesvd_("A", "A", &m, &n, &a[a_offset], lda, &ssav[1], &usav[
00618 usav_offset], ldu, &vtsav[vtsav_offset], ldvt, &work[
00619 1], &lswork, &iinfo);
00620 if (iinfo != 0) {
00621 io___30.ciunit = *nout;
00622 s_wsfe(&io___30);
00623 do_fio(&c__1, "GESVD", (ftnlen)5);
00624 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00625 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00626 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00627 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00628 do_fio(&c__1, (char *)&lswork, (ftnlen)sizeof(integer));
00629 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00630 ;
00631 e_wsfe();
00632 *info = abs(iinfo);
00633 return 0;
00634 }
00635
00636
00637
00638 sbdt01_(&m, &n, &c__0, &asav[asav_offset], lda, &usav[
00639 usav_offset], ldu, &ssav[1], &e[1], &vtsav[
00640 vtsav_offset], ldvt, &work[1], result);
00641 if (m != 0 && n != 0) {
00642 sort01_("Columns", &m, &m, &usav[usav_offset], ldu, &work[
00643 1], lwork, &result[1]);
00644 sort01_("Rows", &n, &n, &vtsav[vtsav_offset], ldvt, &work[
00645 1], lwork, &result[2]);
00646 }
00647 result[3] = 0.f;
00648 i__3 = mnmin - 1;
00649 for (i__ = 1; i__ <= i__3; ++i__) {
00650 if (ssav[i__] < ssav[i__ + 1]) {
00651 result[3] = ulpinv;
00652 }
00653 if (ssav[i__] < 0.f) {
00654 result[3] = ulpinv;
00655 }
00656
00657 }
00658 if (mnmin >= 1) {
00659 if (ssav[mnmin] < 0.f) {
00660 result[3] = ulpinv;
00661 }
00662 }
00663
00664
00665
00666 result[4] = 0.f;
00667 result[5] = 0.f;
00668 result[6] = 0.f;
00669 for (iju = 0; iju <= 3; ++iju) {
00670 for (ijvt = 0; ijvt <= 3; ++ijvt) {
00671 if (iju == 3 && ijvt == 3 || iju == 1 && ijvt == 1) {
00672 goto L70;
00673 }
00674 *(unsigned char *)jobu = *(unsigned char *)&cjob[iju];
00675 *(unsigned char *)jobvt = *(unsigned char *)&cjob[
00676 ijvt];
00677 slacpy_("F", &m, &n, &asav[asav_offset], lda, &a[
00678 a_offset], lda);
00679 s_copy(srnamc_1.srnamt, "SGESVD", (ftnlen)32, (ftnlen)
00680 6);
00681 sgesvd_(jobu, jobvt, &m, &n, &a[a_offset], lda, &s[1],
00682 &u[u_offset], ldu, &vt[vt_offset], ldvt, &
00683 work[1], &lswork, &iinfo);
00684
00685
00686
00687 dif = 0.f;
00688 if (m > 0 && n > 0) {
00689 if (iju == 1) {
00690 sort03_("C", &m, &mnmin, &m, &mnmin, &usav[
00691 usav_offset], ldu, &a[a_offset], lda,
00692 &work[1], lwork, &dif, &iinfo);
00693 } else if (iju == 2) {
00694 sort03_("C", &m, &mnmin, &m, &mnmin, &usav[
00695 usav_offset], ldu, &u[u_offset], ldu,
00696 &work[1], lwork, &dif, &iinfo);
00697 } else if (iju == 3) {
00698 sort03_("C", &m, &m, &m, &mnmin, &usav[
00699 usav_offset], ldu, &u[u_offset], ldu,
00700 &work[1], lwork, &dif, &iinfo);
00701 }
00702 }
00703 result[4] = dmax(result[4],dif);
00704
00705
00706
00707 dif = 0.f;
00708 if (m > 0 && n > 0) {
00709 if (ijvt == 1) {
00710 sort03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00711 vtsav_offset], ldvt, &a[a_offset],
00712 lda, &work[1], lwork, &dif, &iinfo);
00713 } else if (ijvt == 2) {
00714 sort03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00715 vtsav_offset], ldvt, &vt[vt_offset],
00716 ldvt, &work[1], lwork, &dif, &iinfo);
00717 } else if (ijvt == 3) {
00718 sort03_("R", &n, &n, &n, &mnmin, &vtsav[
00719 vtsav_offset], ldvt, &vt[vt_offset],
00720 ldvt, &work[1], lwork, &dif, &iinfo);
00721 }
00722 }
00723 result[5] = dmax(result[5],dif);
00724
00725
00726
00727 dif = 0.f;
00728
00729 r__1 = (real) mnmin * ulp * s[1];
00730 div = dmax(r__1,unfl);
00731 i__3 = mnmin - 1;
00732 for (i__ = 1; i__ <= i__3; ++i__) {
00733 if (ssav[i__] < ssav[i__ + 1]) {
00734 dif = ulpinv;
00735 }
00736 if (ssav[i__] < 0.f) {
00737 dif = ulpinv;
00738 }
00739
00740 r__2 = dif, r__3 = (r__1 = ssav[i__] - s[i__],
00741 dabs(r__1)) / div;
00742 dif = dmax(r__2,r__3);
00743
00744 }
00745 result[6] = dmax(result[6],dif);
00746 L70:
00747 ;
00748 }
00749
00750 }
00751
00752
00753
00754 iwtmp = mnmin * 5 * mnmin + mnmin * 9 + max(m,n);
00755 lswork = iwtmp + (iws - 1) * (*lwork - iwtmp) / 3;
00756 lswork = min(lswork,*lwork);
00757 lswork = max(lswork,1);
00758 if (iws == 4) {
00759 lswork = *lwork;
00760 }
00761
00762 slacpy_("F", &m, &n, &asav[asav_offset], lda, &a[a_offset],
00763 lda);
00764 s_copy(srnamc_1.srnamt, "SGESDD", (ftnlen)32, (ftnlen)6);
00765 sgesdd_("A", &m, &n, &a[a_offset], lda, &ssav[1], &usav[
00766 usav_offset], ldu, &vtsav[vtsav_offset], ldvt, &work[
00767 1], &lswork, &iwork[1], &iinfo);
00768 if (iinfo != 0) {
00769 io___38.ciunit = *nout;
00770 s_wsfe(&io___38);
00771 do_fio(&c__1, "GESDD", (ftnlen)5);
00772 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00773 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00774 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00775 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00776 do_fio(&c__1, (char *)&lswork, (ftnlen)sizeof(integer));
00777 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00778 ;
00779 e_wsfe();
00780 *info = abs(iinfo);
00781 return 0;
00782 }
00783
00784
00785
00786 sbdt01_(&m, &n, &c__0, &asav[asav_offset], lda, &usav[
00787 usav_offset], ldu, &ssav[1], &e[1], &vtsav[
00788 vtsav_offset], ldvt, &work[1], &result[7]);
00789 if (m != 0 && n != 0) {
00790 sort01_("Columns", &m, &m, &usav[usav_offset], ldu, &work[
00791 1], lwork, &result[8]);
00792 sort01_("Rows", &n, &n, &vtsav[vtsav_offset], ldvt, &work[
00793 1], lwork, &result[9]);
00794 }
00795 result[10] = 0.f;
00796 i__3 = mnmin - 1;
00797 for (i__ = 1; i__ <= i__3; ++i__) {
00798 if (ssav[i__] < ssav[i__ + 1]) {
00799 result[10] = ulpinv;
00800 }
00801 if (ssav[i__] < 0.f) {
00802 result[10] = ulpinv;
00803 }
00804
00805 }
00806 if (mnmin >= 1) {
00807 if (ssav[mnmin] < 0.f) {
00808 result[10] = ulpinv;
00809 }
00810 }
00811
00812
00813
00814 result[11] = 0.f;
00815 result[12] = 0.f;
00816 result[13] = 0.f;
00817 for (ijq = 0; ijq <= 2; ++ijq) {
00818 *(unsigned char *)jobq = *(unsigned char *)&cjob[ijq];
00819 slacpy_("F", &m, &n, &asav[asav_offset], lda, &a[a_offset]
00820 , lda);
00821 s_copy(srnamc_1.srnamt, "SGESDD", (ftnlen)32, (ftnlen)6);
00822 sgesdd_(jobq, &m, &n, &a[a_offset], lda, &s[1], &u[
00823 u_offset], ldu, &vt[vt_offset], ldvt, &work[1], &
00824 lswork, &iwork[1], &iinfo);
00825
00826
00827
00828 dif = 0.f;
00829 if (m > 0 && n > 0) {
00830 if (ijq == 1) {
00831 if (m >= n) {
00832 sort03_("C", &m, &mnmin, &m, &mnmin, &usav[
00833 usav_offset], ldu, &a[a_offset], lda,
00834 &work[1], lwork, &dif, info);
00835 } else {
00836 sort03_("C", &m, &mnmin, &m, &mnmin, &usav[
00837 usav_offset], ldu, &u[u_offset], ldu,
00838 &work[1], lwork, &dif, info);
00839 }
00840 } else if (ijq == 2) {
00841 sort03_("C", &m, &mnmin, &m, &mnmin, &usav[
00842 usav_offset], ldu, &u[u_offset], ldu, &
00843 work[1], lwork, &dif, info);
00844 }
00845 }
00846 result[11] = dmax(result[11],dif);
00847
00848
00849
00850 dif = 0.f;
00851 if (m > 0 && n > 0) {
00852 if (ijq == 1) {
00853 if (m >= n) {
00854 sort03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00855 vtsav_offset], ldvt, &vt[vt_offset],
00856 ldvt, &work[1], lwork, &dif, info);
00857 } else {
00858 sort03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00859 vtsav_offset], ldvt, &a[a_offset],
00860 lda, &work[1], lwork, &dif, info);
00861 }
00862 } else if (ijq == 2) {
00863 sort03_("R", &n, &mnmin, &n, &mnmin, &vtsav[
00864 vtsav_offset], ldvt, &vt[vt_offset], ldvt,
00865 &work[1], lwork, &dif, info);
00866 }
00867 }
00868 result[12] = dmax(result[12],dif);
00869
00870
00871
00872 dif = 0.f;
00873
00874 r__1 = (real) mnmin * ulp * s[1];
00875 div = dmax(r__1,unfl);
00876 i__3 = mnmin - 1;
00877 for (i__ = 1; i__ <= i__3; ++i__) {
00878 if (ssav[i__] < ssav[i__ + 1]) {
00879 dif = ulpinv;
00880 }
00881 if (ssav[i__] < 0.f) {
00882 dif = ulpinv;
00883 }
00884
00885 r__2 = dif, r__3 = (r__1 = ssav[i__] - s[i__], dabs(
00886 r__1)) / div;
00887 dif = dmax(r__2,r__3);
00888
00889 }
00890 result[13] = dmax(result[13],dif);
00891
00892 }
00893
00894
00895
00896
00897 result[14] = 0.f;
00898 result[15] = 0.f;
00899 result[16] = 0.f;
00900 result[17] = 0.f;
00901
00902 if (m >= n) {
00903 iwtmp = mnmin * 5 * mnmin + mnmin * 9 + max(m,n);
00904 lswork = iwtmp + (iws - 1) * (*lwork - iwtmp) / 3;
00905 lswork = min(lswork,*lwork);
00906 lswork = max(lswork,1);
00907 if (iws == 4) {
00908 lswork = *lwork;
00909 }
00910
00911 slacpy_("F", &m, &n, &asav[asav_offset], lda, &usav[
00912 usav_offset], lda);
00913 s_copy(srnamc_1.srnamt, "SGESVJ", (ftnlen)32, (ftnlen)6);
00914 sgesvj_("G", "U", "V", &m, &n, &usav[usav_offset], lda, &
00915 ssav[1], &c__0, &a[a_offset], ldvt, &work[1],
00916 lwork, info);
00917
00918
00919
00920
00921 i__3 = n;
00922 for (j = 1; j <= i__3; ++j) {
00923 i__4 = n;
00924 for (i__ = 1; i__ <= i__4; ++i__) {
00925 vtsav[j + i__ * vtsav_dim1] = a[i__ + j * a_dim1];
00926 }
00927 }
00928
00929 if (iinfo != 0) {
00930 io___41.ciunit = *nout;
00931 s_wsfe(&io___41);
00932 do_fio(&c__1, "GESVJ", (ftnlen)5);
00933 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer))
00934 ;
00935 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00936 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00937 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
00938 ;
00939 do_fio(&c__1, (char *)&lswork, (ftnlen)sizeof(integer)
00940 );
00941 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
00942 integer));
00943 e_wsfe();
00944 *info = abs(iinfo);
00945 return 0;
00946 }
00947
00948
00949
00950 sbdt01_(&m, &n, &c__0, &asav[asav_offset], lda, &usav[
00951 usav_offset], ldu, &ssav[1], &e[1], &vtsav[
00952 vtsav_offset], ldvt, &work[1], &result[14]);
00953 if (m != 0 && n != 0) {
00954 sort01_("Columns", &m, &m, &usav[usav_offset], ldu, &
00955 work[1], lwork, &result[15]);
00956 sort01_("Rows", &n, &n, &vtsav[vtsav_offset], ldvt, &
00957 work[1], lwork, &result[16]);
00958 }
00959 result[17] = 0.f;
00960 i__3 = mnmin - 1;
00961 for (i__ = 1; i__ <= i__3; ++i__) {
00962 if (ssav[i__] < ssav[i__ + 1]) {
00963 result[17] = ulpinv;
00964 }
00965 if (ssav[i__] < 0.f) {
00966 result[17] = ulpinv;
00967 }
00968
00969 }
00970 if (mnmin >= 1) {
00971 if (ssav[mnmin] < 0.f) {
00972 result[17] = ulpinv;
00973 }
00974 }
00975 }
00976
00977
00978
00979
00980 result[18] = 0.f;
00981 result[19] = 0.f;
00982 result[20] = 0.f;
00983 result[21] = 0.f;
00984 if (m >= n) {
00985 iwtmp = mnmin * 5 * mnmin + mnmin * 9 + max(m,n);
00986 lswork = iwtmp + (iws - 1) * (*lwork - iwtmp) / 3;
00987 lswork = min(lswork,*lwork);
00988 lswork = max(lswork,1);
00989 if (iws == 4) {
00990 lswork = *lwork;
00991 }
00992
00993 slacpy_("F", &m, &n, &asav[asav_offset], lda, &vtsav[
00994 vtsav_offset], lda);
00995 s_copy(srnamc_1.srnamt, "SGEJSV", (ftnlen)32, (ftnlen)6);
00996 sgejsv_("G", "U", "V", "R", "N", "N", &m, &n, &vtsav[
00997 vtsav_offset], lda, &ssav[1], &usav[usav_offset],
00998 ldu, &a[a_offset], ldvt, &work[1], lwork, &iwork[
00999 1], info);
01000
01001
01002
01003
01004 i__3 = n;
01005 for (j = 1; j <= i__3; ++j) {
01006 i__4 = n;
01007 for (i__ = 1; i__ <= i__4; ++i__) {
01008 vtsav[j + i__ * vtsav_dim1] = a[i__ + j * a_dim1];
01009 }
01010 }
01011
01012 if (iinfo != 0) {
01013 io___42.ciunit = *nout;
01014 s_wsfe(&io___42);
01015 do_fio(&c__1, "GESVJ", (ftnlen)5);
01016 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer))
01017 ;
01018 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
01019 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01020 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01021 ;
01022 do_fio(&c__1, (char *)&lswork, (ftnlen)sizeof(integer)
01023 );
01024 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01025 integer));
01026 e_wsfe();
01027 *info = abs(iinfo);
01028 return 0;
01029 }
01030
01031
01032
01033 sbdt01_(&m, &n, &c__0, &asav[asav_offset], lda, &usav[
01034 usav_offset], ldu, &ssav[1], &e[1], &vtsav[
01035 vtsav_offset], ldvt, &work[1], &result[18]);
01036 if (m != 0 && n != 0) {
01037 sort01_("Columns", &m, &m, &usav[usav_offset], ldu, &
01038 work[1], lwork, &result[19]);
01039 sort01_("Rows", &n, &n, &vtsav[vtsav_offset], ldvt, &
01040 work[1], lwork, &result[20]);
01041 }
01042 result[21] = 0.f;
01043 i__3 = mnmin - 1;
01044 for (i__ = 1; i__ <= i__3; ++i__) {
01045 if (ssav[i__] < ssav[i__ + 1]) {
01046 result[21] = ulpinv;
01047 }
01048 if (ssav[i__] < 0.f) {
01049 result[21] = ulpinv;
01050 }
01051
01052 }
01053 if (mnmin >= 1) {
01054 if (ssav[mnmin] < 0.f) {
01055 result[21] = ulpinv;
01056 }
01057 }
01058 }
01059
01060
01061
01062 for (j = 1; j <= 22; ++j) {
01063 if (result[j - 1] >= *thresh) {
01064 if (nfail == 0) {
01065 io___43.ciunit = *nout;
01066 s_wsfe(&io___43);
01067 e_wsfe();
01068 io___44.ciunit = *nout;
01069 s_wsfe(&io___44);
01070 e_wsfe();
01071 }
01072 io___45.ciunit = *nout;
01073 s_wsfe(&io___45);
01074 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
01075 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01076 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01077 ;
01078 do_fio(&c__1, (char *)&iws, (ftnlen)sizeof(integer));
01079 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01080 integer));
01081 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
01082 do_fio(&c__1, (char *)&result[j - 1], (ftnlen)sizeof(
01083 real));
01084 e_wsfe();
01085 ++nfail;
01086 }
01087
01088 }
01089 ntest += 22;
01090
01091
01092 }
01093 L140:
01094 ;
01095 }
01096
01097 }
01098
01099
01100
01101 alasvm_(path, nout, &nfail, &ntest, &c__0);
01102
01103
01104 return 0;
01105
01106
01107
01108 }