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