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