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 integer c__1 = 1;
00020 static integer c_n1 = -1;
00021 static integer c__2 = 2;
00022 static real c_b29 = 1.f;
00023 static integer c__3 = 3;
00024 static integer c__4 = 4;
00025 static integer c__0 = 0;
00026
00027 int cdrges_(integer *nsizes, integer *nn, integer *ntypes,
00028 logical *dotype, integer *iseed, real *thresh, integer *nounit,
00029 complex *a, integer *lda, complex *b, complex *s, complex *t, complex
00030 *q, integer *ldq, complex *z__, complex *alpha, complex *beta,
00031 complex *work, integer *lwork, real *rwork, real *result, logical *
00032 bwork, integer *info)
00033 {
00034
00035
00036 static integer kclass[26] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
00037 2,2,2,3 };
00038 static integer kbmagn[26] = { 1,1,1,1,1,1,1,1,3,2,3,2,2,3,1,1,1,1,1,1,1,3,
00039 2,3,2,1 };
00040 static integer ktrian[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,
00041 1,1,1,1 };
00042 static logical lasign[26] = { FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00043 TRUE_,FALSE_,TRUE_,TRUE_,FALSE_,FALSE_,TRUE_,TRUE_,TRUE_,FALSE_,
00044 TRUE_,FALSE_,FALSE_,FALSE_,TRUE_,TRUE_,TRUE_,TRUE_,TRUE_,FALSE_ };
00045 static logical lbsign[26] = { FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00046 FALSE_,TRUE_,FALSE_,FALSE_,TRUE_,TRUE_,FALSE_,FALSE_,TRUE_,FALSE_,
00047 TRUE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00048 FALSE_ };
00049 static integer kz1[6] = { 0,1,2,1,3,3 };
00050 static integer kz2[6] = { 0,0,1,2,1,1 };
00051 static integer kadd[6] = { 0,0,0,0,3,2 };
00052 static integer katype[26] = { 0,1,0,1,2,3,4,1,4,4,1,1,4,4,4,2,4,5,8,7,9,4,
00053 4,4,4,0 };
00054 static integer kbtype[26] = { 0,0,1,1,2,-3,1,4,1,1,4,4,1,1,-4,2,-4,8,8,8,
00055 8,8,8,8,8,0 };
00056 static integer kazero[26] = { 1,1,1,1,1,1,2,1,2,2,1,1,2,2,3,1,3,5,5,5,5,3,
00057 3,3,3,1 };
00058 static integer kbzero[26] = { 1,1,1,1,1,1,1,2,1,1,2,2,1,1,4,1,4,6,6,6,6,4,
00059 4,4,4,1 };
00060 static integer kamagn[26] = { 1,1,1,1,1,1,1,1,2,3,2,3,2,3,1,1,1,1,1,1,1,2,
00061 3,3,2,1 };
00062
00063
00064 static char fmt_9999[] = "(\002 CDRGES: \002,a,\002 returned INFO=\002,i"
00065 "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, ISEED="
00066 "(\002,4(i4,\002,\002),i5,\002)\002)";
00067 static char fmt_9998[] = "(\002 CDRGES: S not in Schur form at eigenvalu"
00068 "e \002,i6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, "
00069 "ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00070 static char fmt_9997[] = "(/1x,a3,\002 -- Complex Generalized Schur from"
00071 " problem \002,\002driver\002)";
00072 static char fmt_9996[] = "(\002 Matrix types (see CDRGES for details):"
00073 " \002)";
00074 static char fmt_9995[] = "(\002 Special Matrices:\002,23x,\002(J'=transp"
00075 "osed Jordan block)\002,/\002 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I"
00076 ") 5=(J',J') \002,\0026=(diag(J',I), diag(I,J'))\002,/\002 Diag"
00077 "onal Matrices: ( \002,\002D=diag(0,1,2,...) )\002,/\002 7=(D,"
00078 "I) 9=(large*D, small*I\002,\002) 11=(large*I, small*D) 13=(l"
00079 "arge*D, large*I)\002,/\002 8=(I,D) 10=(small*D, large*I) 12="
00080 "(small*I, large*D) \002,\002 14=(small*D, small*I)\002,/\002 15"
00081 "=(D, reversed D)\002)";
00082 static char fmt_9994[] = "(\002 Matrices Rotated by Random \002,a,\002 M"
00083 "atrices U, V:\002,/\002 16=Transposed Jordan Blocks "
00084 " 19=geometric \002,\002alpha, beta=0,1\002,/\002 17=arithm. alp"
00085 "ha&beta \002,\002 20=arithmetic alpha, beta=0,"
00086 "1\002,/\002 18=clustered \002,\002alpha, beta=0,1 21"
00087 "=random alpha, beta=0,1\002,/\002 Large & Small Matrices:\002,"
00088 "/\002 22=(large, small) \002,\00223=(small,large) 24=(smal"
00089 "l,small) 25=(large,large)\002,/\002 26=random O(1) matrices"
00090 ".\002)";
00091 static char fmt_9993[] = "(/\002 Tests performed: (S is Schur, T is tri"
00092 "angular, \002,\002Q and Z are \002,a,\002,\002,/19x,\002l and r "
00093 "are the appropriate left and right\002,/19x,\002eigenvectors, re"
00094 "sp., a is alpha, b is beta, and\002,/19x,a,\002 means \002,a,"
00095 "\002.)\002,/\002 Without ordering: \002,/\002 1 = | A - Q S "
00096 "Z\002,a,\002 | / ( |A| n ulp ) 2 = | B - Q T Z\002,a,\002 |"
00097 " / ( |B| n ulp )\002,/\002 3 = | I - QQ\002,a,\002 | / ( n ulp "
00098 ") 4 = | I - ZZ\002,a,\002 | / ( n ulp )\002,/\002 5"
00099 " = A is in Schur form S\002,/\002 6 = difference between (alpha"
00100 ",beta)\002,\002 and diagonals of (S,T)\002,/\002 With ordering:"
00101 " \002,/\002 7 = | (A,B) - Q (S,T) Z\002,a,\002 | / ( |(A,B)| n "
00102 "ulp )\002,/\002 8 = | I - QQ\002,a,\002 | / ( n ulp ) "
00103 " 9 = | I - ZZ\002,a,\002 | / ( n ulp )\002,/\002 10 = A is in "
00104 "Schur form S\002,/\002 11 = difference between (alpha,beta) and "
00105 "diagonals\002,\002 of (S,T)\002,/\002 12 = SDIM is the correct n"
00106 "umber of \002,\002selected eigenvalues\002,/)";
00107 static char fmt_9992[] = "(\002 Matrix order=\002,i5,\002, type=\002,i2"
00108 ",\002, seed=\002,4(i4,\002,\002),\002 result \002,i2,\002 is\002"
00109 ",0p,f8.2)";
00110 static char fmt_9991[] = "(\002 Matrix order=\002,i5,\002, type=\002,i2"
00111 ",\002, seed=\002,4(i4,\002,\002),\002 result \002,i2,\002 is\002"
00112 ",1p,e10.3)";
00113
00114
00115 integer a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, s_dim1,
00116 s_offset, t_dim1, t_offset, z_dim1, z_offset, i__1, i__2, i__3,
00117 i__4, i__5, i__6, i__7, i__8, i__9, i__10, i__11;
00118 real r__1, r__2, r__3, r__4, r__5, r__6, r__7, r__8, r__9, r__10, r__11,
00119 r__12, r__13, r__14, r__15, r__16;
00120 complex q__1, q__2, q__3, q__4;
00121
00122
00123 double r_sign(real *, real *), c_abs(complex *);
00124 void r_cnjg(complex *, complex *);
00125 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00126 double r_imag(complex *);
00127
00128
00129 integer i__, j, n, n1, jc, nb, in, jr;
00130 real ulp;
00131 integer iadd, sdim, nmax, rsub;
00132 char sort[1];
00133 real temp1, temp2;
00134 logical badnn;
00135 extern int cget51_(integer *, integer *, complex *,
00136 integer *, complex *, integer *, complex *, integer *, complex *,
00137 integer *, complex *, real *, real *), cgges_(char *, char *,
00138 char *, L_fp, integer *, complex *, integer *, complex *, integer
00139 *, integer *, complex *, complex *, complex *, integer *, complex
00140 *, integer *, complex *, integer *, real *, logical *, integer *), cget54_(integer *, complex *, integer *,
00141 complex *, integer *, complex *, integer *, complex *, integer *,
00142 complex *, integer *, complex *, integer *, complex *, real *);
00143 integer iinfo;
00144 real rmagn[4];
00145 complex ctemp;
00146 integer nmats, jsize, nerrs, jtype, ntest, isort;
00147 extern int clatm4_(integer *, integer *, integer *,
00148 integer *, logical *, real *, real *, real *, integer *, integer *
00149 , complex *, integer *), cunm2r_(char *, char *, integer *,
00150 integer *, integer *, complex *, integer *, complex *, complex *,
00151 integer *, complex *, integer *);
00152 logical ilabad;
00153 extern int slabad_(real *, real *), clarfg_(integer *,
00154 complex *, complex *, integer *, complex *);
00155 extern VOID clarnd_(complex *, integer *, integer *);
00156 extern doublereal slamch_(char *);
00157 extern int clacpy_(char *, integer *, integer *, complex
00158 *, integer *, complex *, integer *), claset_(char *,
00159 integer *, integer *, complex *, complex *, complex *, integer *);
00160 real safmin, safmax;
00161 integer knteig, ioldsd[4];
00162 extern logical clctes_(complex *, complex *);
00163 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00164 integer *, integer *);
00165 extern int alasvm_(char *, integer *, integer *, integer
00166 *, integer *), xerbla_(char *, integer *);
00167 integer minwrk, maxwrk;
00168 real ulpinv;
00169 integer mtypes, ntestt;
00170
00171
00172 static cilist io___41 = { 0, 0, 0, fmt_9999, 0 };
00173 static cilist io___47 = { 0, 0, 0, fmt_9999, 0 };
00174 static cilist io___51 = { 0, 0, 0, fmt_9998, 0 };
00175 static cilist io___53 = { 0, 0, 0, fmt_9997, 0 };
00176 static cilist io___54 = { 0, 0, 0, fmt_9996, 0 };
00177 static cilist io___55 = { 0, 0, 0, fmt_9995, 0 };
00178 static cilist io___56 = { 0, 0, 0, fmt_9994, 0 };
00179 static cilist io___57 = { 0, 0, 0, fmt_9993, 0 };
00180 static cilist io___58 = { 0, 0, 0, fmt_9992, 0 };
00181 static cilist io___59 = { 0, 0, 0, fmt_9991, 0 };
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
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478 --nn;
00479 --dotype;
00480 --iseed;
00481 t_dim1 = *lda;
00482 t_offset = 1 + t_dim1;
00483 t -= t_offset;
00484 s_dim1 = *lda;
00485 s_offset = 1 + s_dim1;
00486 s -= s_offset;
00487 b_dim1 = *lda;
00488 b_offset = 1 + b_dim1;
00489 b -= b_offset;
00490 a_dim1 = *lda;
00491 a_offset = 1 + a_dim1;
00492 a -= a_offset;
00493 z_dim1 = *ldq;
00494 z_offset = 1 + z_dim1;
00495 z__ -= z_offset;
00496 q_dim1 = *ldq;
00497 q_offset = 1 + q_dim1;
00498 q -= q_offset;
00499 --alpha;
00500 --beta;
00501 --work;
00502 --rwork;
00503 --result;
00504 --bwork;
00505
00506
00507
00508
00509
00510
00511
00512 *info = 0;
00513
00514 badnn = FALSE_;
00515 nmax = 1;
00516 i__1 = *nsizes;
00517 for (j = 1; j <= i__1; ++j) {
00518
00519 i__2 = nmax, i__3 = nn[j];
00520 nmax = max(i__2,i__3);
00521 if (nn[j] < 0) {
00522 badnn = TRUE_;
00523 }
00524
00525 }
00526
00527 if (*nsizes < 0) {
00528 *info = -1;
00529 } else if (badnn) {
00530 *info = -2;
00531 } else if (*ntypes < 0) {
00532 *info = -3;
00533 } else if (*thresh < 0.f) {
00534 *info = -6;
00535 } else if (*lda <= 1 || *lda < nmax) {
00536 *info = -9;
00537 } else if (*ldq <= 1 || *ldq < nmax) {
00538 *info = -14;
00539 }
00540
00541
00542
00543
00544
00545
00546
00547
00548 minwrk = 1;
00549 if (*info == 0 && *lwork >= 1) {
00550 minwrk = nmax * 3 * nmax;
00551
00552 i__1 = 1, i__2 = ilaenv_(&c__1, "CGEQRF", " ", &nmax, &nmax, &c_n1, &
00553 c_n1), i__1 = max(i__1,i__2), i__2 =
00554 ilaenv_(&c__1, "CUNMQR", "LC", &nmax, &nmax, &nmax, &c_n1), i__1 = max(i__1,i__2), i__2 = ilaenv_(&
00555 c__1, "CUNGQR", " ", &nmax, &nmax, &nmax, &c_n1);
00556 nb = max(i__1,i__2);
00557
00558 i__1 = nmax + nmax * nb, i__2 = nmax * 3 * nmax;
00559 maxwrk = max(i__1,i__2);
00560 work[1].r = (real) maxwrk, work[1].i = 0.f;
00561 }
00562
00563 if (*lwork < minwrk) {
00564 *info = -19;
00565 }
00566
00567 if (*info != 0) {
00568 i__1 = -(*info);
00569 xerbla_("CDRGES", &i__1);
00570 return 0;
00571 }
00572
00573
00574
00575 if (*nsizes == 0 || *ntypes == 0) {
00576 return 0;
00577 }
00578
00579 ulp = slamch_("Precision");
00580 safmin = slamch_("Safe minimum");
00581 safmin /= ulp;
00582 safmax = 1.f / safmin;
00583 slabad_(&safmin, &safmax);
00584 ulpinv = 1.f / ulp;
00585
00586
00587
00588 rmagn[0] = 0.f;
00589 rmagn[1] = 1.f;
00590
00591
00592
00593 ntestt = 0;
00594 nerrs = 0;
00595 nmats = 0;
00596
00597 i__1 = *nsizes;
00598 for (jsize = 1; jsize <= i__1; ++jsize) {
00599 n = nn[jsize];
00600 n1 = max(1,n);
00601 rmagn[2] = safmax * ulp / (real) n1;
00602 rmagn[3] = safmin * ulpinv * (real) n1;
00603
00604 if (*nsizes != 1) {
00605 mtypes = min(26,*ntypes);
00606 } else {
00607 mtypes = min(27,*ntypes);
00608 }
00609
00610
00611
00612 i__2 = mtypes;
00613 for (jtype = 1; jtype <= i__2; ++jtype) {
00614 if (! dotype[jtype]) {
00615 goto L180;
00616 }
00617 ++nmats;
00618 ntest = 0;
00619
00620
00621
00622 for (j = 1; j <= 4; ++j) {
00623 ioldsd[j - 1] = iseed[j];
00624
00625 }
00626
00627
00628
00629 for (j = 1; j <= 13; ++j) {
00630 result[j] = 0.f;
00631
00632 }
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655 if (mtypes > 26) {
00656 goto L110;
00657 }
00658 iinfo = 0;
00659 if (kclass[jtype - 1] < 3) {
00660
00661
00662
00663 if ((i__3 = katype[jtype - 1], abs(i__3)) == 3) {
00664 in = ((n - 1) / 2 << 1) + 1;
00665 if (in != n) {
00666 claset_("Full", &n, &n, &c_b1, &c_b1, &a[a_offset],
00667 lda);
00668 }
00669 } else {
00670 in = n;
00671 }
00672 clatm4_(&katype[jtype - 1], &in, &kz1[kazero[jtype - 1] - 1],
00673 &kz2[kazero[jtype - 1] - 1], &lasign[jtype - 1], &
00674 rmagn[kamagn[jtype - 1]], &ulp, &rmagn[ktrian[jtype -
00675 1] * kamagn[jtype - 1]], &c__2, &iseed[1], &a[
00676 a_offset], lda);
00677 iadd = kadd[kazero[jtype - 1] - 1];
00678 if (iadd > 0 && iadd <= n) {
00679 i__3 = iadd + iadd * a_dim1;
00680 i__4 = kamagn[jtype - 1];
00681 a[i__3].r = rmagn[i__4], a[i__3].i = 0.f;
00682 }
00683
00684
00685
00686 if ((i__3 = kbtype[jtype - 1], abs(i__3)) == 3) {
00687 in = ((n - 1) / 2 << 1) + 1;
00688 if (in != n) {
00689 claset_("Full", &n, &n, &c_b1, &c_b1, &b[b_offset],
00690 lda);
00691 }
00692 } else {
00693 in = n;
00694 }
00695 clatm4_(&kbtype[jtype - 1], &in, &kz1[kbzero[jtype - 1] - 1],
00696 &kz2[kbzero[jtype - 1] - 1], &lbsign[jtype - 1], &
00697 rmagn[kbmagn[jtype - 1]], &c_b29, &rmagn[ktrian[jtype
00698 - 1] * kbmagn[jtype - 1]], &c__2, &iseed[1], &b[
00699 b_offset], lda);
00700 iadd = kadd[kbzero[jtype - 1] - 1];
00701 if (iadd != 0 && iadd <= n) {
00702 i__3 = iadd + iadd * b_dim1;
00703 i__4 = kbmagn[jtype - 1];
00704 b[i__3].r = rmagn[i__4], b[i__3].i = 0.f;
00705 }
00706
00707 if (kclass[jtype - 1] == 2 && n > 0) {
00708
00709
00710
00711
00712
00713
00714 i__3 = n - 1;
00715 for (jc = 1; jc <= i__3; ++jc) {
00716 i__4 = n;
00717 for (jr = jc; jr <= i__4; ++jr) {
00718 i__5 = jr + jc * q_dim1;
00719 clarnd_(&q__1, &c__3, &iseed[1]);
00720 q[i__5].r = q__1.r, q[i__5].i = q__1.i;
00721 i__5 = jr + jc * z_dim1;
00722 clarnd_(&q__1, &c__3, &iseed[1]);
00723 z__[i__5].r = q__1.r, z__[i__5].i = q__1.i;
00724
00725 }
00726 i__4 = n + 1 - jc;
00727 clarfg_(&i__4, &q[jc + jc * q_dim1], &q[jc + 1 + jc *
00728 q_dim1], &c__1, &work[jc]);
00729 i__4 = (n << 1) + jc;
00730 i__5 = jc + jc * q_dim1;
00731 r__2 = q[i__5].r;
00732 r__1 = r_sign(&c_b29, &r__2);
00733 work[i__4].r = r__1, work[i__4].i = 0.f;
00734 i__4 = jc + jc * q_dim1;
00735 q[i__4].r = 1.f, q[i__4].i = 0.f;
00736 i__4 = n + 1 - jc;
00737 clarfg_(&i__4, &z__[jc + jc * z_dim1], &z__[jc + 1 +
00738 jc * z_dim1], &c__1, &work[n + jc]);
00739 i__4 = n * 3 + jc;
00740 i__5 = jc + jc * z_dim1;
00741 r__2 = z__[i__5].r;
00742 r__1 = r_sign(&c_b29, &r__2);
00743 work[i__4].r = r__1, work[i__4].i = 0.f;
00744 i__4 = jc + jc * z_dim1;
00745 z__[i__4].r = 1.f, z__[i__4].i = 0.f;
00746
00747 }
00748 clarnd_(&q__1, &c__3, &iseed[1]);
00749 ctemp.r = q__1.r, ctemp.i = q__1.i;
00750 i__3 = n + n * q_dim1;
00751 q[i__3].r = 1.f, q[i__3].i = 0.f;
00752 i__3 = n;
00753 work[i__3].r = 0.f, work[i__3].i = 0.f;
00754 i__3 = n * 3;
00755 r__1 = c_abs(&ctemp);
00756 q__1.r = ctemp.r / r__1, q__1.i = ctemp.i / r__1;
00757 work[i__3].r = q__1.r, work[i__3].i = q__1.i;
00758 clarnd_(&q__1, &c__3, &iseed[1]);
00759 ctemp.r = q__1.r, ctemp.i = q__1.i;
00760 i__3 = n + n * z_dim1;
00761 z__[i__3].r = 1.f, z__[i__3].i = 0.f;
00762 i__3 = n << 1;
00763 work[i__3].r = 0.f, work[i__3].i = 0.f;
00764 i__3 = n << 2;
00765 r__1 = c_abs(&ctemp);
00766 q__1.r = ctemp.r / r__1, q__1.i = ctemp.i / r__1;
00767 work[i__3].r = q__1.r, work[i__3].i = q__1.i;
00768
00769
00770
00771 i__3 = n;
00772 for (jc = 1; jc <= i__3; ++jc) {
00773 i__4 = n;
00774 for (jr = 1; jr <= i__4; ++jr) {
00775 i__5 = jr + jc * a_dim1;
00776 i__6 = (n << 1) + jr;
00777 r_cnjg(&q__3, &work[n * 3 + jc]);
00778 q__2.r = work[i__6].r * q__3.r - work[i__6].i *
00779 q__3.i, q__2.i = work[i__6].r * q__3.i +
00780 work[i__6].i * q__3.r;
00781 i__7 = jr + jc * a_dim1;
00782 q__1.r = q__2.r * a[i__7].r - q__2.i * a[i__7].i,
00783 q__1.i = q__2.r * a[i__7].i + q__2.i * a[
00784 i__7].r;
00785 a[i__5].r = q__1.r, a[i__5].i = q__1.i;
00786 i__5 = jr + jc * b_dim1;
00787 i__6 = (n << 1) + jr;
00788 r_cnjg(&q__3, &work[n * 3 + jc]);
00789 q__2.r = work[i__6].r * q__3.r - work[i__6].i *
00790 q__3.i, q__2.i = work[i__6].r * q__3.i +
00791 work[i__6].i * q__3.r;
00792 i__7 = jr + jc * b_dim1;
00793 q__1.r = q__2.r * b[i__7].r - q__2.i * b[i__7].i,
00794 q__1.i = q__2.r * b[i__7].i + q__2.i * b[
00795 i__7].r;
00796 b[i__5].r = q__1.r, b[i__5].i = q__1.i;
00797
00798 }
00799
00800 }
00801 i__3 = n - 1;
00802 cunm2r_("L", "N", &n, &n, &i__3, &q[q_offset], ldq, &work[
00803 1], &a[a_offset], lda, &work[(n << 1) + 1], &
00804 iinfo);
00805 if (iinfo != 0) {
00806 goto L100;
00807 }
00808 i__3 = n - 1;
00809 cunm2r_("R", "C", &n, &n, &i__3, &z__[z_offset], ldq, &
00810 work[n + 1], &a[a_offset], lda, &work[(n << 1) +
00811 1], &iinfo);
00812 if (iinfo != 0) {
00813 goto L100;
00814 }
00815 i__3 = n - 1;
00816 cunm2r_("L", "N", &n, &n, &i__3, &q[q_offset], ldq, &work[
00817 1], &b[b_offset], lda, &work[(n << 1) + 1], &
00818 iinfo);
00819 if (iinfo != 0) {
00820 goto L100;
00821 }
00822 i__3 = n - 1;
00823 cunm2r_("R", "C", &n, &n, &i__3, &z__[z_offset], ldq, &
00824 work[n + 1], &b[b_offset], lda, &work[(n << 1) +
00825 1], &iinfo);
00826 if (iinfo != 0) {
00827 goto L100;
00828 }
00829 }
00830 } else {
00831
00832
00833
00834 i__3 = n;
00835 for (jc = 1; jc <= i__3; ++jc) {
00836 i__4 = n;
00837 for (jr = 1; jr <= i__4; ++jr) {
00838 i__5 = jr + jc * a_dim1;
00839 i__6 = kamagn[jtype - 1];
00840 clarnd_(&q__2, &c__4, &iseed[1]);
00841 q__1.r = rmagn[i__6] * q__2.r, q__1.i = rmagn[i__6] *
00842 q__2.i;
00843 a[i__5].r = q__1.r, a[i__5].i = q__1.i;
00844 i__5 = jr + jc * b_dim1;
00845 i__6 = kbmagn[jtype - 1];
00846 clarnd_(&q__2, &c__4, &iseed[1]);
00847 q__1.r = rmagn[i__6] * q__2.r, q__1.i = rmagn[i__6] *
00848 q__2.i;
00849 b[i__5].r = q__1.r, b[i__5].i = q__1.i;
00850
00851 }
00852
00853 }
00854 }
00855
00856 L100:
00857
00858 if (iinfo != 0) {
00859 io___41.ciunit = *nounit;
00860 s_wsfe(&io___41);
00861 do_fio(&c__1, "Generator", (ftnlen)9);
00862 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00863 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00864 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00865 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00866 e_wsfe();
00867 *info = abs(iinfo);
00868 return 0;
00869 }
00870
00871 L110:
00872
00873 for (i__ = 1; i__ <= 13; ++i__) {
00874 result[i__] = -1.f;
00875
00876 }
00877
00878
00879
00880 for (isort = 0; isort <= 1; ++isort) {
00881 if (isort == 0) {
00882 *(unsigned char *)sort = 'N';
00883 rsub = 0;
00884 } else {
00885 *(unsigned char *)sort = 'S';
00886 rsub = 5;
00887 }
00888
00889
00890
00891 clacpy_("Full", &n, &n, &a[a_offset], lda, &s[s_offset], lda);
00892 clacpy_("Full", &n, &n, &b[b_offset], lda, &t[t_offset], lda);
00893 ntest = rsub + 1 + isort;
00894 result[rsub + 1 + isort] = ulpinv;
00895 cgges_("V", "V", sort, (L_fp)clctes_, &n, &s[s_offset], lda, &
00896 t[t_offset], lda, &sdim, &alpha[1], &beta[1], &q[
00897 q_offset], ldq, &z__[z_offset], ldq, &work[1], lwork,
00898 &rwork[1], &bwork[1], &iinfo);
00899 if (iinfo != 0 && iinfo != n + 2) {
00900 result[rsub + 1 + isort] = ulpinv;
00901 io___47.ciunit = *nounit;
00902 s_wsfe(&io___47);
00903 do_fio(&c__1, "CGGES", (ftnlen)5);
00904 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00905 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00906 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00907 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00908 ;
00909 e_wsfe();
00910 *info = abs(iinfo);
00911 goto L160;
00912 }
00913
00914 ntest = rsub + 4;
00915
00916
00917
00918 if (isort == 0) {
00919 cget51_(&c__1, &n, &a[a_offset], lda, &s[s_offset], lda, &
00920 q[q_offset], ldq, &z__[z_offset], ldq, &work[1], &
00921 rwork[1], &result[1]);
00922 cget51_(&c__1, &n, &b[b_offset], lda, &t[t_offset], lda, &
00923 q[q_offset], ldq, &z__[z_offset], ldq, &work[1], &
00924 rwork[1], &result[2]);
00925 } else {
00926 cget54_(&n, &a[a_offset], lda, &b[b_offset], lda, &s[
00927 s_offset], lda, &t[t_offset], lda, &q[q_offset],
00928 ldq, &z__[z_offset], ldq, &work[1], &result[rsub
00929 + 2]);
00930 }
00931
00932 cget51_(&c__3, &n, &b[b_offset], lda, &t[t_offset], lda, &q[
00933 q_offset], ldq, &q[q_offset], ldq, &work[1], &rwork[1]
00934 , &result[rsub + 3]);
00935 cget51_(&c__3, &n, &b[b_offset], lda, &t[t_offset], lda, &z__[
00936 z_offset], ldq, &z__[z_offset], ldq, &work[1], &rwork[
00937 1], &result[rsub + 4]);
00938
00939
00940
00941
00942
00943 ntest = rsub + 6;
00944 temp1 = 0.f;
00945
00946 i__3 = n;
00947 for (j = 1; j <= i__3; ++j) {
00948 ilabad = FALSE_;
00949 i__4 = j;
00950 i__5 = j + j * s_dim1;
00951 q__2.r = alpha[i__4].r - s[i__5].r, q__2.i = alpha[i__4]
00952 .i - s[i__5].i;
00953 q__1.r = q__2.r, q__1.i = q__2.i;
00954 i__6 = j;
00955 i__7 = j + j * t_dim1;
00956 q__4.r = beta[i__6].r - t[i__7].r, q__4.i = beta[i__6].i
00957 - t[i__7].i;
00958 q__3.r = q__4.r, q__3.i = q__4.i;
00959
00960 i__8 = j;
00961 i__9 = j + j * s_dim1;
00962 r__13 = safmin, r__14 = (r__1 = alpha[i__8].r, dabs(r__1))
00963 + (r__2 = r_imag(&alpha[j]), dabs(r__2)), r__13 =
00964 max(r__13,r__14), r__14 = (r__3 = s[i__9].r,
00965 dabs(r__3)) + (r__4 = r_imag(&s[j + j * s_dim1]),
00966 dabs(r__4));
00967
00968 i__10 = j;
00969 i__11 = j + j * t_dim1;
00970 r__15 = safmin, r__16 = (r__5 = beta[i__10].r, dabs(r__5))
00971 + (r__6 = r_imag(&beta[j]), dabs(r__6)), r__15 =
00972 max(r__15,r__16), r__16 = (r__7 = t[i__11].r,
00973 dabs(r__7)) + (r__8 = r_imag(&t[j + j * t_dim1]),
00974 dabs(r__8));
00975 temp2 = (((r__9 = q__1.r, dabs(r__9)) + (r__10 = r_imag(&
00976 q__1), dabs(r__10))) / dmax(r__13,r__14) + ((
00977 r__11 = q__3.r, dabs(r__11)) + (r__12 = r_imag(&
00978 q__3), dabs(r__12))) / dmax(r__15,r__16)) / ulp;
00979
00980 if (j < n) {
00981 i__4 = j + 1 + j * s_dim1;
00982 if (s[i__4].r != 0.f || s[i__4].i != 0.f) {
00983 ilabad = TRUE_;
00984 result[rsub + 5] = ulpinv;
00985 }
00986 }
00987 if (j > 1) {
00988 i__4 = j + (j - 1) * s_dim1;
00989 if (s[i__4].r != 0.f || s[i__4].i != 0.f) {
00990 ilabad = TRUE_;
00991 result[rsub + 5] = ulpinv;
00992 }
00993 }
00994 temp1 = dmax(temp1,temp2);
00995 if (ilabad) {
00996 io___51.ciunit = *nounit;
00997 s_wsfe(&io___51);
00998 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
00999 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01000 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01001 ;
01002 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01003 integer));
01004 e_wsfe();
01005 }
01006
01007 }
01008 result[rsub + 6] = temp1;
01009
01010 if (isort >= 1) {
01011
01012
01013
01014 ntest = 12;
01015 result[12] = 0.f;
01016 knteig = 0;
01017 i__3 = n;
01018 for (i__ = 1; i__ <= i__3; ++i__) {
01019 if (clctes_(&alpha[i__], &beta[i__])) {
01020 ++knteig;
01021 }
01022
01023 }
01024 if (sdim != knteig) {
01025 result[13] = ulpinv;
01026 }
01027 }
01028
01029
01030 }
01031
01032
01033
01034 L160:
01035
01036 ntestt += ntest;
01037
01038
01039
01040 i__3 = ntest;
01041 for (jr = 1; jr <= i__3; ++jr) {
01042 if (result[jr] >= *thresh) {
01043
01044
01045
01046
01047 if (nerrs == 0) {
01048 io___53.ciunit = *nounit;
01049 s_wsfe(&io___53);
01050 do_fio(&c__1, "CGS", (ftnlen)3);
01051 e_wsfe();
01052
01053
01054
01055 io___54.ciunit = *nounit;
01056 s_wsfe(&io___54);
01057 e_wsfe();
01058 io___55.ciunit = *nounit;
01059 s_wsfe(&io___55);
01060 e_wsfe();
01061 io___56.ciunit = *nounit;
01062 s_wsfe(&io___56);
01063 do_fio(&c__1, "Unitary", (ftnlen)7);
01064 e_wsfe();
01065
01066
01067
01068 io___57.ciunit = *nounit;
01069 s_wsfe(&io___57);
01070 do_fio(&c__1, "unitary", (ftnlen)7);
01071 do_fio(&c__1, "'", (ftnlen)1);
01072 do_fio(&c__1, "transpose", (ftnlen)9);
01073 for (j = 1; j <= 8; ++j) {
01074 do_fio(&c__1, "'", (ftnlen)1);
01075 }
01076 e_wsfe();
01077
01078 }
01079 ++nerrs;
01080 if (result[jr] < 1e4f) {
01081 io___58.ciunit = *nounit;
01082 s_wsfe(&io___58);
01083 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01084 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01085 ;
01086 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01087 integer));
01088 do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01089 do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01090 real));
01091 e_wsfe();
01092 } else {
01093 io___59.ciunit = *nounit;
01094 s_wsfe(&io___59);
01095 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01096 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01097 ;
01098 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01099 integer));
01100 do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01101 do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01102 real));
01103 e_wsfe();
01104 }
01105 }
01106
01107 }
01108
01109 L180:
01110 ;
01111 }
01112
01113 }
01114
01115
01116
01117 alasvm_("CGS", nounit, &nerrs, &ntestt, &c__0);
01118
01119 work[1].r = (real) maxwrk, work[1].i = 0.f;
01120
01121 return 0;
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131 }