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 real c_b18 = 0.f;
00019 static integer c__0 = 0;
00020 static integer c__6 = 6;
00021 static real c_b35 = 1.f;
00022 static integer c__1 = 1;
00023 static integer c__4 = 4;
00024 static integer c_n1 = -1;
00025
00026 int schkbb_(integer *nsizes, integer *mval, integer *nval,
00027 integer *nwdths, integer *kk, integer *ntypes, logical *dotype,
00028 integer *nrhs, integer *iseed, real *thresh, integer *nounit, real *a,
00029 integer *lda, real *ab, integer *ldab, real *bd, real *be, real *q,
00030 integer *ldq, real *p, integer *ldp, real *c__, integer *ldc, real *
00031 cc, real *work, integer *lwork, real *result, integer *info)
00032 {
00033
00034
00035 static integer ktype[15] = { 1,2,4,4,4,4,4,6,6,6,6,6,9,9,9 };
00036 static integer kmagn[15] = { 1,1,1,1,1,2,3,1,1,1,2,3,1,2,3 };
00037 static integer kmode[15] = { 0,0,4,3,1,4,4,4,3,1,4,4,0,0,0 };
00038
00039
00040 static char fmt_9999[] = "(\002 SCHKBB: \002,a,\002 returned INFO=\002,i"
00041 "5,\002.\002,/9x,\002M=\002,i5,\002 N=\002,i5,\002 K=\002,i5,\002"
00042 ", JTYPE=\002,i5,\002, ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00043 static char fmt_9998[] = "(\002 M =\002,i4,\002 N=\002,i4,\002, K=\002,i"
00044 "3,\002, seed=\002,4(i4,\002,\002),\002 type \002,i2,\002, test"
00045 "(\002,i2,\002)=\002,g10.3)";
00046
00047
00048 integer a_dim1, a_offset, ab_dim1, ab_offset, c_dim1, c_offset, cc_dim1,
00049 cc_offset, p_dim1, p_offset, q_dim1, q_offset, i__1, i__2, i__3,
00050 i__4, i__5, i__6, i__7, i__8, i__9;
00051
00052
00053 double sqrt(doublereal);
00054 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00055
00056
00057 integer i__, j, k, m, n, kl, jr, ku;
00058 real ulp, cond;
00059 integer jcol, kmax, mmax, nmax;
00060 real unfl, ovfl;
00061 logical badmm, badnn;
00062 integer imode;
00063 extern int sbdt01_(integer *, integer *, integer *, real
00064 *, integer *, real *, integer *, real *, real *, real *, integer *
00065 , real *, real *), sbdt02_(integer *, integer *, real *, integer *
00066 , real *, integer *, real *, integer *, real *, real *);
00067 integer iinfo;
00068 real anorm;
00069 integer mnmin, mnmax, nmats, jsize;
00070 extern int sort01_(char *, integer *, integer *, real *,
00071 integer *, real *, integer *, real *);
00072 integer nerrs, itype, jtype, ntest;
00073 extern int slahd2_(integer *, char *);
00074 logical badnnb;
00075 extern int sgbbrd_(char *, integer *, integer *, integer
00076 *, integer *, integer *, real *, integer *, real *, real *, real *
00077 , integer *, real *, integer *, real *, integer *, real *,
00078 integer *);
00079 extern doublereal slamch_(char *);
00080 integer idumma[1];
00081 extern int xerbla_(char *, integer *);
00082 integer ioldsd[4];
00083 real amninv;
00084 integer jwidth;
00085 extern int slacpy_(char *, integer *, integer *, real *,
00086 integer *, real *, integer *), slaset_(char *, integer *,
00087 integer *, real *, real *, real *, integer *), slatmr_(
00088 integer *, integer *, char *, integer *, char *, real *, integer *
00089 , real *, real *, char *, char *, real *, integer *, real *, real
00090 *, integer *, real *, char *, integer *, integer *, integer *,
00091 real *, real *, char *, real *, integer *, integer *, integer *), slatms_(integer *
00092 , integer *, char *, integer *, char *, real *, integer *, real *,
00093 real *, integer *, integer *, char *, real *, integer *, real *,
00094 integer *), slasum_(char *, integer *,
00095 integer *, integer *);
00096 real rtunfl, rtovfl, ulpinv;
00097 integer mtypes, ntestt;
00098
00099
00100 static cilist io___41 = { 0, 0, 0, fmt_9999, 0 };
00101 static cilist io___43 = { 0, 0, 0, fmt_9999, 0 };
00102 static cilist io___45 = { 0, 0, 0, fmt_9998, 0 };
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
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 --mval;
00355 --nval;
00356 --kk;
00357 --dotype;
00358 --iseed;
00359 a_dim1 = *lda;
00360 a_offset = 1 + a_dim1;
00361 a -= a_offset;
00362 ab_dim1 = *ldab;
00363 ab_offset = 1 + ab_dim1;
00364 ab -= ab_offset;
00365 --bd;
00366 --be;
00367 q_dim1 = *ldq;
00368 q_offset = 1 + q_dim1;
00369 q -= q_offset;
00370 p_dim1 = *ldp;
00371 p_offset = 1 + p_dim1;
00372 p -= p_offset;
00373 cc_dim1 = *ldc;
00374 cc_offset = 1 + cc_dim1;
00375 cc -= cc_offset;
00376 c_dim1 = *ldc;
00377 c_offset = 1 + c_dim1;
00378 c__ -= c_offset;
00379 --work;
00380 --result;
00381
00382
00383
00384
00385
00386
00387
00388 ntestt = 0;
00389 *info = 0;
00390
00391
00392
00393 badmm = FALSE_;
00394 badnn = FALSE_;
00395 mmax = 1;
00396 nmax = 1;
00397 mnmax = 1;
00398 i__1 = *nsizes;
00399 for (j = 1; j <= i__1; ++j) {
00400
00401 i__2 = mmax, i__3 = mval[j];
00402 mmax = max(i__2,i__3);
00403 if (mval[j] < 0) {
00404 badmm = TRUE_;
00405 }
00406
00407 i__2 = nmax, i__3 = nval[j];
00408 nmax = max(i__2,i__3);
00409 if (nval[j] < 0) {
00410 badnn = TRUE_;
00411 }
00412
00413
00414 i__4 = mval[j], i__5 = nval[j];
00415 i__2 = mnmax, i__3 = min(i__4,i__5);
00416 mnmax = max(i__2,i__3);
00417
00418 }
00419
00420 badnnb = FALSE_;
00421 kmax = 0;
00422 i__1 = *nwdths;
00423 for (j = 1; j <= i__1; ++j) {
00424
00425 i__2 = kmax, i__3 = kk[j];
00426 kmax = max(i__2,i__3);
00427 if (kk[j] < 0) {
00428 badnnb = TRUE_;
00429 }
00430
00431 }
00432
00433
00434
00435 if (*nsizes < 0) {
00436 *info = -1;
00437 } else if (badmm) {
00438 *info = -2;
00439 } else if (badnn) {
00440 *info = -3;
00441 } else if (*nwdths < 0) {
00442 *info = -4;
00443 } else if (badnnb) {
00444 *info = -5;
00445 } else if (*ntypes < 0) {
00446 *info = -6;
00447 } else if (*nrhs < 0) {
00448 *info = -8;
00449 } else if (*lda < nmax) {
00450 *info = -13;
00451 } else if (*ldab < (kmax << 1) + 1) {
00452 *info = -15;
00453 } else if (*ldq < nmax) {
00454 *info = -19;
00455 } else if (*ldp < nmax) {
00456 *info = -21;
00457 } else if (*ldc < nmax) {
00458 *info = -23;
00459 } else if ((max(*lda,nmax) + 1) * nmax > *lwork) {
00460 *info = -26;
00461 }
00462
00463 if (*info != 0) {
00464 i__1 = -(*info);
00465 xerbla_("SCHKBB", &i__1);
00466 return 0;
00467 }
00468
00469
00470
00471 if (*nsizes == 0 || *ntypes == 0 || *nwdths == 0) {
00472 return 0;
00473 }
00474
00475
00476
00477 unfl = slamch_("Safe minimum");
00478 ovfl = 1.f / unfl;
00479 ulp = slamch_("Epsilon") * slamch_("Base");
00480 ulpinv = 1.f / ulp;
00481 rtunfl = sqrt(unfl);
00482 rtovfl = sqrt(ovfl);
00483
00484
00485
00486 nerrs = 0;
00487 nmats = 0;
00488
00489 i__1 = *nsizes;
00490 for (jsize = 1; jsize <= i__1; ++jsize) {
00491 m = mval[jsize];
00492 n = nval[jsize];
00493 mnmin = min(m,n);
00494
00495 i__2 = max(1,m);
00496 amninv = 1.f / (real) max(i__2,n);
00497
00498 i__2 = *nwdths;
00499 for (jwidth = 1; jwidth <= i__2; ++jwidth) {
00500 k = kk[jwidth];
00501 if (k >= m && k >= n) {
00502 goto L150;
00503 }
00504
00505
00506 i__5 = m - 1;
00507 i__3 = 0, i__4 = min(i__5,k);
00508 kl = max(i__3,i__4);
00509
00510
00511 i__5 = n - 1;
00512 i__3 = 0, i__4 = min(i__5,k);
00513 ku = max(i__3,i__4);
00514
00515 if (*nsizes != 1) {
00516 mtypes = min(15,*ntypes);
00517 } else {
00518 mtypes = min(16,*ntypes);
00519 }
00520
00521 i__3 = mtypes;
00522 for (jtype = 1; jtype <= i__3; ++jtype) {
00523 if (! dotype[jtype]) {
00524 goto L140;
00525 }
00526 ++nmats;
00527 ntest = 0;
00528
00529 for (j = 1; j <= 4; ++j) {
00530 ioldsd[j - 1] = iseed[j];
00531
00532 }
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549 if (mtypes > 15) {
00550 goto L90;
00551 }
00552
00553 itype = ktype[jtype - 1];
00554 imode = kmode[jtype - 1];
00555
00556
00557
00558 switch (kmagn[jtype - 1]) {
00559 case 1: goto L40;
00560 case 2: goto L50;
00561 case 3: goto L60;
00562 }
00563
00564 L40:
00565 anorm = 1.f;
00566 goto L70;
00567
00568 L50:
00569 anorm = rtovfl * ulp * amninv;
00570 goto L70;
00571
00572 L60:
00573 anorm = rtunfl * max(m,n) * ulpinv;
00574 goto L70;
00575
00576 L70:
00577
00578 slaset_("Full", lda, &n, &c_b18, &c_b18, &a[a_offset], lda);
00579 slaset_("Full", ldab, &n, &c_b18, &c_b18, &ab[ab_offset],
00580 ldab);
00581 iinfo = 0;
00582 cond = ulpinv;
00583
00584
00585
00586
00587
00588 if (itype == 1) {
00589 iinfo = 0;
00590
00591 } else if (itype == 2) {
00592
00593
00594
00595 i__4 = n;
00596 for (jcol = 1; jcol <= i__4; ++jcol) {
00597 a[jcol + jcol * a_dim1] = anorm;
00598
00599 }
00600
00601 } else if (itype == 4) {
00602
00603
00604
00605 slatms_(&m, &n, "S", &iseed[1], "N", &work[1], &imode, &
00606 cond, &anorm, &c__0, &c__0, "N", &a[a_offset],
00607 lda, &work[m + 1], &iinfo);
00608
00609 } else if (itype == 6) {
00610
00611
00612
00613 slatms_(&m, &n, "S", &iseed[1], "N", &work[1], &imode, &
00614 cond, &anorm, &kl, &ku, "N", &a[a_offset], lda, &
00615 work[m + 1], &iinfo);
00616
00617 } else if (itype == 9) {
00618
00619
00620
00621 slatmr_(&m, &n, "S", &iseed[1], "N", &work[1], &c__6, &
00622 c_b35, &c_b35, "T", "N", &work[n + 1], &c__1, &
00623 c_b35, &work[(n << 1) + 1], &c__1, &c_b35, "N",
00624 idumma, &kl, &ku, &c_b18, &anorm, "N", &a[
00625 a_offset], lda, idumma, &iinfo);
00626
00627 } else {
00628
00629 iinfo = 1;
00630 }
00631
00632
00633
00634 slatmr_(&m, nrhs, "S", &iseed[1], "N", &work[1], &c__6, &
00635 c_b35, &c_b35, "T", "N", &work[m + 1], &c__1, &c_b35,
00636 &work[(m << 1) + 1], &c__1, &c_b35, "N", idumma, &m,
00637 nrhs, &c_b18, &c_b35, "NO", &c__[c_offset], ldc,
00638 idumma, &iinfo);
00639
00640 if (iinfo != 0) {
00641 io___41.ciunit = *nounit;
00642 s_wsfe(&io___41);
00643 do_fio(&c__1, "Generator", (ftnlen)9);
00644 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00645 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00646 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00647 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00648 ;
00649 e_wsfe();
00650 *info = abs(iinfo);
00651 return 0;
00652 }
00653
00654 L90:
00655
00656
00657
00658 i__4 = n;
00659 for (j = 1; j <= i__4; ++j) {
00660
00661 i__5 = 1, i__6 = j - ku;
00662
00663 i__8 = m, i__9 = j + kl;
00664 i__7 = min(i__8,i__9);
00665 for (i__ = max(i__5,i__6); i__ <= i__7; ++i__) {
00666 ab[ku + 1 + i__ - j + j * ab_dim1] = a[i__ + j *
00667 a_dim1];
00668
00669 }
00670
00671 }
00672
00673
00674
00675 slacpy_("Full", &m, nrhs, &c__[c_offset], ldc, &cc[cc_offset],
00676 ldc);
00677
00678
00679
00680 sgbbrd_("B", &m, &n, nrhs, &kl, &ku, &ab[ab_offset], ldab, &
00681 bd[1], &be[1], &q[q_offset], ldq, &p[p_offset], ldp, &
00682 cc[cc_offset], ldc, &work[1], &iinfo);
00683
00684 if (iinfo != 0) {
00685 io___43.ciunit = *nounit;
00686 s_wsfe(&io___43);
00687 do_fio(&c__1, "SGBBRD", (ftnlen)6);
00688 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00689 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00690 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00691 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00692 ;
00693 e_wsfe();
00694 *info = abs(iinfo);
00695 if (iinfo < 0) {
00696 return 0;
00697 } else {
00698 result[1] = ulpinv;
00699 goto L120;
00700 }
00701 }
00702
00703
00704
00705
00706
00707
00708 sbdt01_(&m, &n, &c_n1, &a[a_offset], lda, &q[q_offset], ldq, &
00709 bd[1], &be[1], &p[p_offset], ldp, &work[1], &result[1]
00710 );
00711 sort01_("Columns", &m, &m, &q[q_offset], ldq, &work[1], lwork,
00712 &result[2]);
00713 sort01_("Rows", &n, &n, &p[p_offset], ldp, &work[1], lwork, &
00714 result[3]);
00715 sbdt02_(&m, nrhs, &c__[c_offset], ldc, &cc[cc_offset], ldc, &
00716 q[q_offset], ldq, &work[1], &result[4]);
00717
00718
00719
00720 ntest = 4;
00721 L120:
00722 ntestt += ntest;
00723
00724
00725
00726 i__4 = ntest;
00727 for (jr = 1; jr <= i__4; ++jr) {
00728 if (result[jr] >= *thresh) {
00729 if (nerrs == 0) {
00730 slahd2_(nounit, "SBB");
00731 }
00732 ++nerrs;
00733 io___45.ciunit = *nounit;
00734 s_wsfe(&io___45);
00735 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00736 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00737 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
00738 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
00739 integer));
00740 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
00741 ;
00742 do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
00743 do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
00744 real));
00745 e_wsfe();
00746 }
00747
00748 }
00749
00750 L140:
00751 ;
00752 }
00753 L150:
00754 ;
00755 }
00756
00757 }
00758
00759
00760
00761 slasum_("SBB", nounit, &nerrs, &ntestt);
00762 return 0;
00763
00764
00765
00766
00767 }