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 doublereal c_b18 = 0.;
00019 static integer c__0 = 0;
00020 static integer c__6 = 6;
00021 static doublereal c_b35 = 1.;
00022 static integer c__1 = 1;
00023 static integer c__4 = 4;
00024 static integer c_n1 = -1;
00025
00026 int dchkbb_(integer *nsizes, integer *mval, integer *nval,
00027 integer *nwdths, integer *kk, integer *ntypes, logical *dotype,
00028 integer *nrhs, integer *iseed, doublereal *thresh, integer *nounit,
00029 doublereal *a, integer *lda, doublereal *ab, integer *ldab,
00030 doublereal *bd, doublereal *be, doublereal *q, integer *ldq,
00031 doublereal *p, integer *ldp, doublereal *c__, integer *ldc,
00032 doublereal *cc, doublereal *work, integer *lwork, doublereal *result,
00033 integer *info)
00034 {
00035
00036
00037 static integer ktype[15] = { 1,2,4,4,4,4,4,6,6,6,6,6,9,9,9 };
00038 static integer kmagn[15] = { 1,1,1,1,1,2,3,1,1,1,2,3,1,2,3 };
00039 static integer kmode[15] = { 0,0,4,3,1,4,4,4,3,1,4,4,0,0,0 };
00040
00041
00042 static char fmt_9999[] = "(\002 DCHKBB: \002,a,\002 returned INFO=\002,i"
00043 "5,\002.\002,/9x,\002M=\002,i5,\002 N=\002,i5,\002 K=\002,i5,\002"
00044 ", JTYPE=\002,i5,\002, ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00045 static char fmt_9998[] = "(\002 M =\002,i4,\002 N=\002,i4,\002, K=\002,i"
00046 "3,\002, seed=\002,4(i4,\002,\002),\002 type \002,i2,\002, test"
00047 "(\002,i2,\002)=\002,g10.3)";
00048
00049
00050 integer a_dim1, a_offset, ab_dim1, ab_offset, c_dim1, c_offset, cc_dim1,
00051 cc_offset, p_dim1, p_offset, q_dim1, q_offset, i__1, i__2, i__3,
00052 i__4, i__5, i__6, i__7, i__8, i__9;
00053
00054
00055 double sqrt(doublereal);
00056 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00057
00058
00059 integer i__, j, k, m, n, kl, jr, ku;
00060 doublereal ulp, cond;
00061 integer jcol, kmax, mmax, nmax;
00062 doublereal unfl, ovfl;
00063 extern int dbdt01_(integer *, integer *, integer *,
00064 doublereal *, integer *, doublereal *, integer *, doublereal *,
00065 doublereal *, doublereal *, integer *, doublereal *, doublereal *)
00066 , dbdt02_(integer *, integer *, doublereal *, integer *,
00067 doublereal *, integer *, doublereal *, integer *, doublereal *,
00068 doublereal *);
00069 logical badmm, badnn;
00070 integer imode, iinfo;
00071 extern int dort01_(char *, integer *, integer *,
00072 doublereal *, integer *, doublereal *, integer *, doublereal *);
00073 doublereal anorm;
00074 integer mnmin, mnmax, nmats, jsize, nerrs, itype, jtype, ntest;
00075 extern int dlahd2_(integer *, char *);
00076 logical badnnb;
00077 extern int dgbbrd_(char *, integer *, integer *, integer
00078 *, integer *, integer *, doublereal *, integer *, doublereal *,
00079 doublereal *, doublereal *, integer *, doublereal *, integer *,
00080 doublereal *, integer *, doublereal *, integer *);
00081 extern doublereal dlamch_(char *);
00082 integer idumma[1];
00083 extern int dlacpy_(char *, integer *, integer *,
00084 doublereal *, integer *, doublereal *, integer *);
00085 integer ioldsd[4];
00086 extern int dlaset_(char *, integer *, integer *,
00087 doublereal *, doublereal *, doublereal *, integer *),
00088 xerbla_(char *, integer *), dlatmr_(integer *, integer *,
00089 char *, integer *, char *, doublereal *, integer *, doublereal *,
00090 doublereal *, char *, char *, doublereal *, integer *, doublereal
00091 *, doublereal *, integer *, doublereal *, char *, integer *,
00092 integer *, integer *, doublereal *, doublereal *, char *,
00093 doublereal *, integer *, integer *, integer *), dlatms_(integer *, integer *,
00094 char *, integer *, char *, doublereal *, integer *, doublereal *,
00095 doublereal *, integer *, integer *, char *, doublereal *, integer
00096 *, doublereal *, integer *), dlasum_(char
00097 *, integer *, integer *, integer *);
00098 doublereal amninv;
00099 integer jwidth;
00100 doublereal rtunfl, rtovfl, ulpinv;
00101 integer mtypes, ntestt;
00102
00103
00104 static cilist io___41 = { 0, 0, 0, fmt_9999, 0 };
00105 static cilist io___43 = { 0, 0, 0, fmt_9999, 0 };
00106 static cilist io___45 = { 0, 0, 0, fmt_9998, 0 };
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
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 --mval;
00359 --nval;
00360 --kk;
00361 --dotype;
00362 --iseed;
00363 a_dim1 = *lda;
00364 a_offset = 1 + a_dim1;
00365 a -= a_offset;
00366 ab_dim1 = *ldab;
00367 ab_offset = 1 + ab_dim1;
00368 ab -= ab_offset;
00369 --bd;
00370 --be;
00371 q_dim1 = *ldq;
00372 q_offset = 1 + q_dim1;
00373 q -= q_offset;
00374 p_dim1 = *ldp;
00375 p_offset = 1 + p_dim1;
00376 p -= p_offset;
00377 cc_dim1 = *ldc;
00378 cc_offset = 1 + cc_dim1;
00379 cc -= cc_offset;
00380 c_dim1 = *ldc;
00381 c_offset = 1 + c_dim1;
00382 c__ -= c_offset;
00383 --work;
00384 --result;
00385
00386
00387
00388
00389
00390
00391
00392 ntestt = 0;
00393 *info = 0;
00394
00395
00396
00397 badmm = FALSE_;
00398 badnn = FALSE_;
00399 mmax = 1;
00400 nmax = 1;
00401 mnmax = 1;
00402 i__1 = *nsizes;
00403 for (j = 1; j <= i__1; ++j) {
00404
00405 i__2 = mmax, i__3 = mval[j];
00406 mmax = max(i__2,i__3);
00407 if (mval[j] < 0) {
00408 badmm = TRUE_;
00409 }
00410
00411 i__2 = nmax, i__3 = nval[j];
00412 nmax = max(i__2,i__3);
00413 if (nval[j] < 0) {
00414 badnn = TRUE_;
00415 }
00416
00417
00418 i__4 = mval[j], i__5 = nval[j];
00419 i__2 = mnmax, i__3 = min(i__4,i__5);
00420 mnmax = max(i__2,i__3);
00421
00422 }
00423
00424 badnnb = FALSE_;
00425 kmax = 0;
00426 i__1 = *nwdths;
00427 for (j = 1; j <= i__1; ++j) {
00428
00429 i__2 = kmax, i__3 = kk[j];
00430 kmax = max(i__2,i__3);
00431 if (kk[j] < 0) {
00432 badnnb = TRUE_;
00433 }
00434
00435 }
00436
00437
00438
00439 if (*nsizes < 0) {
00440 *info = -1;
00441 } else if (badmm) {
00442 *info = -2;
00443 } else if (badnn) {
00444 *info = -3;
00445 } else if (*nwdths < 0) {
00446 *info = -4;
00447 } else if (badnnb) {
00448 *info = -5;
00449 } else if (*ntypes < 0) {
00450 *info = -6;
00451 } else if (*nrhs < 0) {
00452 *info = -8;
00453 } else if (*lda < nmax) {
00454 *info = -13;
00455 } else if (*ldab < (kmax << 1) + 1) {
00456 *info = -15;
00457 } else if (*ldq < nmax) {
00458 *info = -19;
00459 } else if (*ldp < nmax) {
00460 *info = -21;
00461 } else if (*ldc < nmax) {
00462 *info = -23;
00463 } else if ((max(*lda,nmax) + 1) * nmax > *lwork) {
00464 *info = -26;
00465 }
00466
00467 if (*info != 0) {
00468 i__1 = -(*info);
00469 xerbla_("DCHKBB", &i__1);
00470 return 0;
00471 }
00472
00473
00474
00475 if (*nsizes == 0 || *ntypes == 0 || *nwdths == 0) {
00476 return 0;
00477 }
00478
00479
00480
00481 unfl = dlamch_("Safe minimum");
00482 ovfl = 1. / unfl;
00483 ulp = dlamch_("Epsilon") * dlamch_("Base");
00484 ulpinv = 1. / ulp;
00485 rtunfl = sqrt(unfl);
00486 rtovfl = sqrt(ovfl);
00487
00488
00489
00490 nerrs = 0;
00491 nmats = 0;
00492
00493 i__1 = *nsizes;
00494 for (jsize = 1; jsize <= i__1; ++jsize) {
00495 m = mval[jsize];
00496 n = nval[jsize];
00497 mnmin = min(m,n);
00498
00499 i__2 = max(1,m);
00500 amninv = 1. / (doublereal) max(i__2,n);
00501
00502 i__2 = *nwdths;
00503 for (jwidth = 1; jwidth <= i__2; ++jwidth) {
00504 k = kk[jwidth];
00505 if (k >= m && k >= n) {
00506 goto L150;
00507 }
00508
00509
00510 i__5 = m - 1;
00511 i__3 = 0, i__4 = min(i__5,k);
00512 kl = max(i__3,i__4);
00513
00514
00515 i__5 = n - 1;
00516 i__3 = 0, i__4 = min(i__5,k);
00517 ku = max(i__3,i__4);
00518
00519 if (*nsizes != 1) {
00520 mtypes = min(15,*ntypes);
00521 } else {
00522 mtypes = min(16,*ntypes);
00523 }
00524
00525 i__3 = mtypes;
00526 for (jtype = 1; jtype <= i__3; ++jtype) {
00527 if (! dotype[jtype]) {
00528 goto L140;
00529 }
00530 ++nmats;
00531 ntest = 0;
00532
00533 for (j = 1; j <= 4; ++j) {
00534 ioldsd[j - 1] = iseed[j];
00535
00536 }
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553 if (mtypes > 15) {
00554 goto L90;
00555 }
00556
00557 itype = ktype[jtype - 1];
00558 imode = kmode[jtype - 1];
00559
00560
00561
00562 switch (kmagn[jtype - 1]) {
00563 case 1: goto L40;
00564 case 2: goto L50;
00565 case 3: goto L60;
00566 }
00567
00568 L40:
00569 anorm = 1.;
00570 goto L70;
00571
00572 L50:
00573 anorm = rtovfl * ulp * amninv;
00574 goto L70;
00575
00576 L60:
00577 anorm = rtunfl * max(m,n) * ulpinv;
00578 goto L70;
00579
00580 L70:
00581
00582 dlaset_("Full", lda, &n, &c_b18, &c_b18, &a[a_offset], lda);
00583 dlaset_("Full", ldab, &n, &c_b18, &c_b18, &ab[ab_offset],
00584 ldab);
00585 iinfo = 0;
00586 cond = ulpinv;
00587
00588
00589
00590
00591
00592 if (itype == 1) {
00593 iinfo = 0;
00594
00595 } else if (itype == 2) {
00596
00597
00598
00599 i__4 = n;
00600 for (jcol = 1; jcol <= i__4; ++jcol) {
00601 a[jcol + jcol * a_dim1] = anorm;
00602
00603 }
00604
00605 } else if (itype == 4) {
00606
00607
00608
00609 dlatms_(&m, &n, "S", &iseed[1], "N", &work[1], &imode, &
00610 cond, &anorm, &c__0, &c__0, "N", &a[a_offset],
00611 lda, &work[m + 1], &iinfo);
00612
00613 } else if (itype == 6) {
00614
00615
00616
00617 dlatms_(&m, &n, "S", &iseed[1], "N", &work[1], &imode, &
00618 cond, &anorm, &kl, &ku, "N", &a[a_offset], lda, &
00619 work[m + 1], &iinfo);
00620
00621 } else if (itype == 9) {
00622
00623
00624
00625 dlatmr_(&m, &n, "S", &iseed[1], "N", &work[1], &c__6, &
00626 c_b35, &c_b35, "T", "N", &work[n + 1], &c__1, &
00627 c_b35, &work[(n << 1) + 1], &c__1, &c_b35, "N",
00628 idumma, &kl, &ku, &c_b18, &anorm, "N", &a[
00629 a_offset], lda, idumma, &iinfo);
00630
00631 } else {
00632
00633 iinfo = 1;
00634 }
00635
00636
00637
00638 dlatmr_(&m, nrhs, "S", &iseed[1], "N", &work[1], &c__6, &
00639 c_b35, &c_b35, "T", "N", &work[m + 1], &c__1, &c_b35,
00640 &work[(m << 1) + 1], &c__1, &c_b35, "N", idumma, &m,
00641 nrhs, &c_b18, &c_b35, "NO", &c__[c_offset], ldc,
00642 idumma, &iinfo);
00643
00644 if (iinfo != 0) {
00645 io___41.ciunit = *nounit;
00646 s_wsfe(&io___41);
00647 do_fio(&c__1, "Generator", (ftnlen)9);
00648 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00649 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00650 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00651 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00652 ;
00653 e_wsfe();
00654 *info = abs(iinfo);
00655 return 0;
00656 }
00657
00658 L90:
00659
00660
00661
00662 i__4 = n;
00663 for (j = 1; j <= i__4; ++j) {
00664
00665 i__5 = 1, i__6 = j - ku;
00666
00667 i__8 = m, i__9 = j + kl;
00668 i__7 = min(i__8,i__9);
00669 for (i__ = max(i__5,i__6); i__ <= i__7; ++i__) {
00670 ab[ku + 1 + i__ - j + j * ab_dim1] = a[i__ + j *
00671 a_dim1];
00672
00673 }
00674
00675 }
00676
00677
00678
00679 dlacpy_("Full", &m, nrhs, &c__[c_offset], ldc, &cc[cc_offset],
00680 ldc);
00681
00682
00683
00684 dgbbrd_("B", &m, &n, nrhs, &kl, &ku, &ab[ab_offset], ldab, &
00685 bd[1], &be[1], &q[q_offset], ldq, &p[p_offset], ldp, &
00686 cc[cc_offset], ldc, &work[1], &iinfo);
00687
00688 if (iinfo != 0) {
00689 io___43.ciunit = *nounit;
00690 s_wsfe(&io___43);
00691 do_fio(&c__1, "DGBBRD", (ftnlen)6);
00692 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00693 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00694 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00695 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00696 ;
00697 e_wsfe();
00698 *info = abs(iinfo);
00699 if (iinfo < 0) {
00700 return 0;
00701 } else {
00702 result[1] = ulpinv;
00703 goto L120;
00704 }
00705 }
00706
00707
00708
00709
00710
00711
00712 dbdt01_(&m, &n, &c_n1, &a[a_offset], lda, &q[q_offset], ldq, &
00713 bd[1], &be[1], &p[p_offset], ldp, &work[1], &result[1]
00714 );
00715 dort01_("Columns", &m, &m, &q[q_offset], ldq, &work[1], lwork,
00716 &result[2]);
00717 dort01_("Rows", &n, &n, &p[p_offset], ldp, &work[1], lwork, &
00718 result[3]);
00719 dbdt02_(&m, nrhs, &c__[c_offset], ldc, &cc[cc_offset], ldc, &
00720 q[q_offset], ldq, &work[1], &result[4]);
00721
00722
00723
00724 ntest = 4;
00725 L120:
00726 ntestt += ntest;
00727
00728
00729
00730 i__4 = ntest;
00731 for (jr = 1; jr <= i__4; ++jr) {
00732 if (result[jr] >= *thresh) {
00733 if (nerrs == 0) {
00734 dlahd2_(nounit, "DBB");
00735 }
00736 ++nerrs;
00737 io___45.ciunit = *nounit;
00738 s_wsfe(&io___45);
00739 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00740 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00741 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
00742 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
00743 integer));
00744 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
00745 ;
00746 do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
00747 do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
00748 doublereal));
00749 e_wsfe();
00750 }
00751
00752 }
00753
00754 L140:
00755 ;
00756 }
00757 L150:
00758 ;
00759 }
00760
00761 }
00762
00763
00764
00765 dlasum_("DBB", nounit, &nerrs, &ntestt);
00766 return 0;
00767
00768
00769
00770
00771 }