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 m, n, mplusn, k;
00020 logical fs;
00021 } mn_;
00022
00023 #define mn_1 mn_
00024
00025
00026
00027 static complex c_b1 = {0.f,0.f};
00028 static integer c__1 = 1;
00029 static integer c__0 = 0;
00030 static integer c_n1 = -1;
00031 static integer c__3 = 3;
00032 static integer c__6 = 6;
00033 static integer c__4 = 4;
00034
00035 int cdrgsx_(integer *nsize, integer *ncmax, real *thresh,
00036 integer *nin, integer *nout, complex *a, integer *lda, complex *b,
00037 complex *ai, complex *bi, complex *z__, complex *q, complex *alpha,
00038 complex *beta, complex *c__, integer *ldc, real *s, complex *work,
00039 integer *lwork, real *rwork, integer *iwork, integer *liwork, logical
00040 *bwork, integer *info)
00041 {
00042
00043 static char fmt_9999[] = "(\002 CDRGSX: \002,a,\002 returned INFO=\002,i"
00044 "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002)\002)";
00045 static char fmt_9997[] = "(\002 CDRGSX: S not in Schur form at eigenvalu"
00046 "e \002,i6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002"
00047 ")\002)";
00048 static char fmt_9996[] = "(/1x,a3,\002 -- Complex Expert Generalized Sch"
00049 "ur form\002,\002 problem driver\002)";
00050 static char fmt_9994[] = "(\002 Matrix types: \002,/\002 1: A is a blo"
00051 "ck diagonal matrix of Jordan blocks \002,\002and B is the identi"
00052 "ty \002,/\002 matrix, \002,/\002 2: A and B are upper tri"
00053 "angular matrices, \002,/\002 3: A and B are as type 2, but eac"
00054 "h second diagonal \002,\002block in A_11 and \002,/\002 eac"
00055 "h third diaongal block in A_22 are 2x2 blocks,\002,/\002 4: A "
00056 "and B are block diagonal matrices, \002,/\002 5: (A,B) has pot"
00057 "entially close or common \002,\002eigenvalues.\002,/)";
00058 static char fmt_9993[] = "(/\002 Tests performed: (S is Schur, T is tri"
00059 "angular, \002,\002Q and Z are \002,a,\002,\002,/19x,\002 a is al"
00060 "pha, b is beta, and \002,a,\002 means \002,a,\002.)\002,/\002 1"
00061 " = | A - Q S Z\002,a,\002 | / ( |A| n ulp ) 2 = | B - Q T "
00062 "Z\002,a,\002 | / ( |B| n ulp )\002,/\002 3 = | I - QQ\002,a,"
00063 "\002 | / ( n ulp ) 4 = | I - ZZ\002,a,\002 | / ( n u"
00064 "lp )\002,/\002 5 = 1/ULP if A is not in \002,\002Schur form "
00065 "S\002,/\002 6 = difference between (alpha,beta)\002,\002 and di"
00066 "agonals of (S,T)\002,/\002 7 = 1/ULP if SDIM is not the correc"
00067 "t number of \002,\002selected eigenvalues\002,/\002 8 = 1/ULP "
00068 "if DIFEST/DIFTRU > 10*THRESH or \002,\002DIFTRU/DIFEST > 10*THRE"
00069 "SH\002,/\002 9 = 1/ULP if DIFEST <> 0 or DIFTRU > ULP*norm(A,B"
00070 ") \002,\002when reordering fails\002,/\002 10 = 1/ULP if PLEST/"
00071 "PLTRU > THRESH or \002,\002PLTRU/PLEST > THRESH\002,/\002 ( T"
00072 "est 10 is only for input examples )\002,/)";
00073 static char fmt_9992[] = "(\002 Matrix order=\002,i2,\002, type=\002,i2"
00074 ",\002, a=\002,e10.4,\002, order(A_11)=\002,i2,\002, result \002,"
00075 "i2,\002 is \002,0p,f8.2)";
00076 static char fmt_9991[] = "(\002 Matrix order=\002,i2,\002, type=\002,i2"
00077 ",\002, a=\002,e10.4,\002, order(A_11)=\002,i2,\002, result \002,"
00078 "i2,\002 is \002,0p,e10.4)";
00079 static char fmt_9998[] = "(\002 CDRGSX: \002,a,\002 returned INFO=\002,i"
00080 "6,\002.\002,/9x,\002N=\002,i6,\002, Input Example #\002,i2,\002"
00081 ")\002)";
00082 static char fmt_9995[] = "(\002Input Example\002)";
00083 static char fmt_9990[] = "(\002 Input example #\002,i2,\002, matrix orde"
00084 "r=\002,i4,\002,\002,\002 result \002,i2,\002 is\002,0p,f8.2)";
00085 static char fmt_9989[] = "(\002 Input example #\002,i2,\002, matrix orde"
00086 "r=\002,i4,\002,\002,\002 result \002,i2,\002 is\002,1p,e10.3)";
00087
00088
00089 integer a_dim1, a_offset, ai_dim1, ai_offset, b_dim1, b_offset, bi_dim1,
00090 bi_offset, c_dim1, c_offset, q_dim1, q_offset, z_dim1, z_offset,
00091 i__1, i__2, i__3, i__4, i__5, i__6, i__7, i__8, i__9, i__10,
00092 i__11;
00093 real r__1, r__2, r__3, r__4, r__5, r__6, r__7, r__8, r__9, r__10, r__11,
00094 r__12, r__13, r__14, r__15, r__16;
00095 complex q__1, q__2, q__3, q__4;
00096
00097
00098 double sqrt(doublereal);
00099 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00100 double r_imag(complex *);
00101 integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
00102 e_rsle(void);
00103
00104
00105 integer i__, j, mm;
00106 real pl[2];
00107 integer mn2, qba, qbb;
00108 real ulp, temp1, temp2;
00109 extern int cget51_(integer *, integer *, complex *,
00110 integer *, complex *, integer *, complex *, integer *, complex *,
00111 integer *, complex *, real *, real *);
00112 real abnrm;
00113 integer ifunc, linfo;
00114 char sense[1];
00115 integer nerrs, ntest;
00116 extern int clakf2_(integer *, integer *, complex *,
00117 integer *, complex *, complex *, complex *, complex *, integer *);
00118 real pltru;
00119 extern int clatm5_(integer *, integer *, integer *,
00120 complex *, integer *, complex *, integer *, complex *, integer *,
00121 complex *, integer *, complex *, integer *, complex *, integer *,
00122 complex *, integer *, complex *, integer *, real *, integer *,
00123 integer *);
00124 real thrsh2;
00125 logical ilabad;
00126 extern int slabad_(real *, real *);
00127 extern doublereal clange_(char *, integer *, integer *, complex *,
00128 integer *, real *);
00129 integer bdspac;
00130 extern doublereal slamch_(char *);
00131 extern int cgesvd_(char *, char *, integer *, integer *,
00132 complex *, integer *, real *, complex *, integer *, complex *,
00133 integer *, complex *, integer *, real *, integer *), clacpy_(char *, integer *, integer *, complex *, integer
00134 *, complex *, integer *), claset_(char *, integer *,
00135 integer *, complex *, complex *, complex *, integer *);
00136 real difest[2];
00137 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00138 integer *, integer *);
00139 extern int cggesx_(char *, char *, char *, L_fp, char *,
00140 integer *, complex *, integer *, complex *, integer *, integer *,
00141 complex *, complex *, complex *, integer *, complex *, integer *,
00142 real *, real *, complex *, integer *, real *, integer *, integer *
00143 , logical *, integer *);
00144 real bignum;
00145 extern int xerbla_(char *, integer *), alasvm_(
00146 char *, integer *, integer *, integer *, integer *);
00147 real weight, diftru;
00148 extern logical clctsx_();
00149 integer minwrk, maxwrk;
00150 real smlnum, ulpinv;
00151 integer nptknt;
00152 real result[10];
00153 integer ntestt, prtype;
00154
00155
00156 static cilist io___22 = { 0, 0, 0, fmt_9999, 0 };
00157 static cilist io___29 = { 0, 0, 0, fmt_9997, 0 };
00158 static cilist io___32 = { 0, 0, 0, fmt_9996, 0 };
00159 static cilist io___33 = { 0, 0, 0, fmt_9994, 0 };
00160 static cilist io___34 = { 0, 0, 0, fmt_9993, 0 };
00161 static cilist io___36 = { 0, 0, 0, fmt_9992, 0 };
00162 static cilist io___37 = { 0, 0, 0, fmt_9991, 0 };
00163 static cilist io___39 = { 0, 0, 1, 0, 0 };
00164 static cilist io___40 = { 0, 0, 1, 0, 0 };
00165 static cilist io___41 = { 0, 0, 0, 0, 0 };
00166 static cilist io___42 = { 0, 0, 0, 0, 0 };
00167 static cilist io___43 = { 0, 0, 0, 0, 0 };
00168 static cilist io___45 = { 0, 0, 0, fmt_9998, 0 };
00169 static cilist io___46 = { 0, 0, 0, fmt_9997, 0 };
00170 static cilist io___47 = { 0, 0, 0, fmt_9996, 0 };
00171 static cilist io___48 = { 0, 0, 0, fmt_9995, 0 };
00172 static cilist io___49 = { 0, 0, 0, fmt_9993, 0 };
00173 static cilist io___50 = { 0, 0, 0, fmt_9990, 0 };
00174 static cilist io___51 = { 0, 0, 0, fmt_9989, 0 };
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
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 q_dim1 = *lda;
00442 q_offset = 1 + q_dim1;
00443 q -= q_offset;
00444 z_dim1 = *lda;
00445 z_offset = 1 + z_dim1;
00446 z__ -= z_offset;
00447 bi_dim1 = *lda;
00448 bi_offset = 1 + bi_dim1;
00449 bi -= bi_offset;
00450 ai_dim1 = *lda;
00451 ai_offset = 1 + ai_dim1;
00452 ai -= ai_offset;
00453 b_dim1 = *lda;
00454 b_offset = 1 + b_dim1;
00455 b -= b_offset;
00456 a_dim1 = *lda;
00457 a_offset = 1 + a_dim1;
00458 a -= a_offset;
00459 --alpha;
00460 --beta;
00461 c_dim1 = *ldc;
00462 c_offset = 1 + c_dim1;
00463 c__ -= c_offset;
00464 --s;
00465 --work;
00466 --rwork;
00467 --iwork;
00468 --bwork;
00469
00470
00471 if (*nsize < 0) {
00472 *info = -1;
00473 } else if (*thresh < 0.f) {
00474 *info = -2;
00475 } else if (*nin <= 0) {
00476 *info = -3;
00477 } else if (*nout <= 0) {
00478 *info = -4;
00479 } else if (*lda < 1 || *lda < *nsize) {
00480 *info = -6;
00481 } else if (*ldc < 1 || *ldc < *nsize * *nsize / 2) {
00482 *info = -15;
00483 } else if (*liwork < *nsize + 2) {
00484 *info = -21;
00485 }
00486
00487
00488
00489
00490
00491
00492
00493
00494 minwrk = 1;
00495 if (*info == 0 && *lwork >= 1) {
00496 minwrk = *nsize * 3 * *nsize / 2;
00497
00498
00499
00500 maxwrk = *nsize * (ilaenv_(&c__1, "CGEQRF", " ", nsize, &c__1, nsize,
00501 &c__0) + 1);
00502
00503 i__1 = maxwrk, i__2 = *nsize * (ilaenv_(&c__1, "CUNGQR", " ", nsize, &
00504 c__1, nsize, &c_n1) + 1);
00505 maxwrk = max(i__1,i__2);
00506
00507
00508
00509 bdspac = *nsize * 3 * *nsize / 2;
00510
00511 i__3 = *nsize * *nsize / 2;
00512 i__4 = *nsize * *nsize / 2;
00513 i__1 = maxwrk, i__2 = *nsize * *nsize * (ilaenv_(&c__1, "CGEBRD",
00514 " ", &i__3, &i__4, &c_n1, &c_n1) + 1);
00515 maxwrk = max(i__1,i__2);
00516 maxwrk = max(maxwrk,bdspac);
00517
00518 maxwrk = max(maxwrk,minwrk);
00519
00520 work[1].r = (real) maxwrk, work[1].i = 0.f;
00521 }
00522
00523 if (*lwork < minwrk) {
00524 *info = -18;
00525 }
00526
00527 if (*info != 0) {
00528 i__1 = -(*info);
00529 xerbla_("CDRGSX", &i__1);
00530 return 0;
00531 }
00532
00533
00534
00535 ulp = slamch_("P");
00536 ulpinv = 1.f / ulp;
00537 smlnum = slamch_("S") / ulp;
00538 bignum = 1.f / smlnum;
00539 slabad_(&smlnum, &bignum);
00540 thrsh2 = *thresh * 10.f;
00541 ntestt = 0;
00542 nerrs = 0;
00543
00544
00545
00546 ifunc = 0;
00547 if (*nsize == 0) {
00548 goto L70;
00549 }
00550
00551
00552
00553
00554
00555 prtype = 0;
00556 qba = 3;
00557 qbb = 4;
00558 weight = sqrt(ulp);
00559
00560 for (ifunc = 0; ifunc <= 3; ++ifunc) {
00561 for (prtype = 1; prtype <= 5; ++prtype) {
00562 i__1 = *nsize - 1;
00563 for (mn_1.m = 1; mn_1.m <= i__1; ++mn_1.m) {
00564 i__2 = *nsize - mn_1.m;
00565 for (mn_1.n = 1; mn_1.n <= i__2; ++mn_1.n) {
00566
00567 weight = 1.f / weight;
00568 mn_1.mplusn = mn_1.m + mn_1.n;
00569
00570
00571
00572 mn_1.fs = TRUE_;
00573 mn_1.k = 0;
00574
00575 claset_("Full", &mn_1.mplusn, &mn_1.mplusn, &c_b1, &c_b1,
00576 &ai[ai_offset], lda);
00577 claset_("Full", &mn_1.mplusn, &mn_1.mplusn, &c_b1, &c_b1,
00578 &bi[bi_offset], lda);
00579
00580 clatm5_(&prtype, &mn_1.m, &mn_1.n, &ai[ai_offset], lda, &
00581 ai[mn_1.m + 1 + (mn_1.m + 1) * ai_dim1], lda, &ai[
00582 (mn_1.m + 1) * ai_dim1 + 1], lda, &bi[bi_offset],
00583 lda, &bi[mn_1.m + 1 + (mn_1.m + 1) * bi_dim1],
00584 lda, &bi[(mn_1.m + 1) * bi_dim1 + 1], lda, &q[
00585 q_offset], lda, &z__[z_offset], lda, &weight, &
00586 qba, &qbb);
00587
00588
00589
00590
00591
00592
00593 if (ifunc == 0) {
00594 *(unsigned char *)sense = 'N';
00595 } else if (ifunc == 1) {
00596 *(unsigned char *)sense = 'E';
00597 } else if (ifunc == 2) {
00598 *(unsigned char *)sense = 'V';
00599 } else if (ifunc == 3) {
00600 *(unsigned char *)sense = 'B';
00601 }
00602
00603 clacpy_("Full", &mn_1.mplusn, &mn_1.mplusn, &ai[ai_offset]
00604 , lda, &a[a_offset], lda);
00605 clacpy_("Full", &mn_1.mplusn, &mn_1.mplusn, &bi[bi_offset]
00606 , lda, &b[b_offset], lda);
00607
00608 cggesx_("V", "V", "S", (L_fp)clctsx_, sense, &mn_1.mplusn,
00609 &ai[ai_offset], lda, &bi[bi_offset], lda, &mm, &
00610 alpha[1], &beta[1], &q[q_offset], lda, &z__[
00611 z_offset], lda, pl, difest, &work[1], lwork, &
00612 rwork[1], &iwork[1], liwork, &bwork[1], &linfo);
00613
00614 if (linfo != 0 && linfo != mn_1.mplusn + 2) {
00615 result[0] = ulpinv;
00616 io___22.ciunit = *nout;
00617 s_wsfe(&io___22);
00618 do_fio(&c__1, "CGGESX", (ftnlen)6);
00619 do_fio(&c__1, (char *)&linfo, (ftnlen)sizeof(integer))
00620 ;
00621 do_fio(&c__1, (char *)&mn_1.mplusn, (ftnlen)sizeof(
00622 integer));
00623 do_fio(&c__1, (char *)&prtype, (ftnlen)sizeof(integer)
00624 );
00625 e_wsfe();
00626 *info = linfo;
00627 goto L30;
00628 }
00629
00630
00631
00632 clacpy_("Full", &mn_1.mplusn, &mn_1.mplusn, &ai[ai_offset]
00633 , lda, &work[1], &mn_1.mplusn);
00634 clacpy_("Full", &mn_1.mplusn, &mn_1.mplusn, &bi[bi_offset]
00635 , lda, &work[mn_1.mplusn * mn_1.mplusn + 1], &
00636 mn_1.mplusn);
00637 i__3 = mn_1.mplusn << 1;
00638 abnrm = clange_("Fro", &mn_1.mplusn, &i__3, &work[1], &
00639 mn_1.mplusn, &rwork[1]);
00640
00641
00642
00643 result[1] = 0.f;
00644 cget51_(&c__1, &mn_1.mplusn, &a[a_offset], lda, &ai[
00645 ai_offset], lda, &q[q_offset], lda, &z__[z_offset]
00646 , lda, &work[1], &rwork[1], result);
00647 cget51_(&c__1, &mn_1.mplusn, &b[b_offset], lda, &bi[
00648 bi_offset], lda, &q[q_offset], lda, &z__[z_offset]
00649 , lda, &work[1], &rwork[1], &result[1]);
00650 cget51_(&c__3, &mn_1.mplusn, &b[b_offset], lda, &bi[
00651 bi_offset], lda, &q[q_offset], lda, &q[q_offset],
00652 lda, &work[1], &rwork[1], &result[2]);
00653 cget51_(&c__3, &mn_1.mplusn, &b[b_offset], lda, &bi[
00654 bi_offset], lda, &z__[z_offset], lda, &z__[
00655 z_offset], lda, &work[1], &rwork[1], &result[3]);
00656 ntest = 4;
00657
00658
00659
00660
00661 temp1 = 0.f;
00662 result[4] = 0.f;
00663 result[5] = 0.f;
00664
00665 i__3 = mn_1.mplusn;
00666 for (j = 1; j <= i__3; ++j) {
00667 ilabad = FALSE_;
00668 i__4 = j;
00669 i__5 = j + j * ai_dim1;
00670 q__2.r = alpha[i__4].r - ai[i__5].r, q__2.i = alpha[
00671 i__4].i - ai[i__5].i;
00672 q__1.r = q__2.r, q__1.i = q__2.i;
00673 i__6 = j;
00674 i__7 = j + j * bi_dim1;
00675 q__4.r = beta[i__6].r - bi[i__7].r, q__4.i = beta[
00676 i__6].i - bi[i__7].i;
00677 q__3.r = q__4.r, q__3.i = q__4.i;
00678
00679 i__8 = j;
00680 i__9 = j + j * ai_dim1;
00681 r__13 = smlnum, r__14 = (r__1 = alpha[i__8].r, dabs(
00682 r__1)) + (r__2 = r_imag(&alpha[j]), dabs(r__2)
00683 ), r__13 = max(r__13,r__14), r__14 = (r__3 =
00684 ai[i__9].r, dabs(r__3)) + (r__4 = r_imag(&ai[
00685 j + j * ai_dim1]), dabs(r__4));
00686
00687 i__10 = j;
00688 i__11 = j + j * bi_dim1;
00689 r__15 = smlnum, r__16 = (r__5 = beta[i__10].r, dabs(
00690 r__5)) + (r__6 = r_imag(&beta[j]), dabs(r__6))
00691 , r__15 = max(r__15,r__16), r__16 = (r__7 =
00692 bi[i__11].r, dabs(r__7)) + (r__8 = r_imag(&bi[
00693 j + j * bi_dim1]), dabs(r__8));
00694 temp2 = (((r__9 = q__1.r, dabs(r__9)) + (r__10 =
00695 r_imag(&q__1), dabs(r__10))) / dmax(r__13,
00696 r__14) + ((r__11 = q__3.r, dabs(r__11)) + (
00697 r__12 = r_imag(&q__3), dabs(r__12))) / dmax(
00698 r__15,r__16)) / ulp;
00699 if (j < mn_1.mplusn) {
00700 i__4 = j + 1 + j * ai_dim1;
00701 if (ai[i__4].r != 0.f || ai[i__4].i != 0.f) {
00702 ilabad = TRUE_;
00703 result[4] = ulpinv;
00704 }
00705 }
00706 if (j > 1) {
00707 i__4 = j + (j - 1) * ai_dim1;
00708 if (ai[i__4].r != 0.f || ai[i__4].i != 0.f) {
00709 ilabad = TRUE_;
00710 result[4] = ulpinv;
00711 }
00712 }
00713 temp1 = dmax(temp1,temp2);
00714 if (ilabad) {
00715 io___29.ciunit = *nout;
00716 s_wsfe(&io___29);
00717 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer))
00718 ;
00719 do_fio(&c__1, (char *)&mn_1.mplusn, (ftnlen)
00720 sizeof(integer));
00721 do_fio(&c__1, (char *)&prtype, (ftnlen)sizeof(
00722 integer));
00723 e_wsfe();
00724 }
00725
00726 }
00727 result[5] = temp1;
00728 ntest += 2;
00729
00730
00731
00732 result[6] = 0.f;
00733 if (linfo == mn_1.mplusn + 3) {
00734 result[6] = ulpinv;
00735 } else if (mm != mn_1.n) {
00736 result[6] = ulpinv;
00737 }
00738 ++ntest;
00739
00740
00741
00742
00743 result[7] = 0.f;
00744 mn2 = mm * (mn_1.mplusn - mm) << 1;
00745 if (ifunc >= 2 && mn2 <= *ncmax * *ncmax) {
00746
00747
00748
00749
00750 i__3 = mn_1.mplusn - mm;
00751 clakf2_(&mm, &i__3, &ai[ai_offset], lda, &ai[mm + 1 +
00752 (mm + 1) * ai_dim1], &bi[bi_offset], &bi[mm +
00753 1 + (mm + 1) * bi_dim1], &c__[c_offset], ldc);
00754
00755 i__3 = *lwork - 2;
00756 cgesvd_("N", "N", &mn2, &mn2, &c__[c_offset], ldc, &s[
00757 1], &work[1], &c__1, &work[2], &c__1, &work[3]
00758 , &i__3, &rwork[1], info);
00759 diftru = s[mn2];
00760
00761 if (difest[1] == 0.f) {
00762 if (diftru > abnrm * ulp) {
00763 result[7] = ulpinv;
00764 }
00765 } else if (diftru == 0.f) {
00766 if (difest[1] > abnrm * ulp) {
00767 result[7] = ulpinv;
00768 }
00769 } else if (diftru > thrsh2 * difest[1] || diftru *
00770 thrsh2 < difest[1]) {
00771
00772 r__1 = diftru / difest[1], r__2 = difest[1] /
00773 diftru;
00774 result[7] = dmax(r__1,r__2);
00775 }
00776 ++ntest;
00777 }
00778
00779
00780
00781 result[8] = 0.f;
00782 if (linfo == mn_1.mplusn + 2) {
00783 if (diftru > abnrm * ulp) {
00784 result[8] = ulpinv;
00785 }
00786 if (ifunc > 1 && difest[1] != 0.f) {
00787 result[8] = ulpinv;
00788 }
00789 if (ifunc == 1 && pl[0] != 0.f) {
00790 result[8] = ulpinv;
00791 }
00792 ++ntest;
00793 }
00794
00795 ntestt += ntest;
00796
00797
00798
00799 for (j = 1; j <= 9; ++j) {
00800 if (result[j - 1] >= *thresh) {
00801
00802
00803
00804
00805 if (nerrs == 0) {
00806 io___32.ciunit = *nout;
00807 s_wsfe(&io___32);
00808 do_fio(&c__1, "CGX", (ftnlen)3);
00809 e_wsfe();
00810
00811
00812
00813 io___33.ciunit = *nout;
00814 s_wsfe(&io___33);
00815 e_wsfe();
00816
00817
00818
00819 io___34.ciunit = *nout;
00820 s_wsfe(&io___34);
00821 do_fio(&c__1, "unitary", (ftnlen)7);
00822 do_fio(&c__1, "'", (ftnlen)1);
00823 do_fio(&c__1, "transpose", (ftnlen)9);
00824 for (i__ = 1; i__ <= 4; ++i__) {
00825 do_fio(&c__1, "'", (ftnlen)1);
00826 }
00827 e_wsfe();
00828
00829 }
00830 ++nerrs;
00831 if (result[j - 1] < 1e4f) {
00832 io___36.ciunit = *nout;
00833 s_wsfe(&io___36);
00834 do_fio(&c__1, (char *)&mn_1.mplusn, (ftnlen)
00835 sizeof(integer));
00836 do_fio(&c__1, (char *)&prtype, (ftnlen)sizeof(
00837 integer));
00838 do_fio(&c__1, (char *)&weight, (ftnlen)sizeof(
00839 real));
00840 do_fio(&c__1, (char *)&mn_1.m, (ftnlen)sizeof(
00841 integer));
00842 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(
00843 integer));
00844 do_fio(&c__1, (char *)&result[j - 1], (ftnlen)
00845 sizeof(real));
00846 e_wsfe();
00847 } else {
00848 io___37.ciunit = *nout;
00849 s_wsfe(&io___37);
00850 do_fio(&c__1, (char *)&mn_1.mplusn, (ftnlen)
00851 sizeof(integer));
00852 do_fio(&c__1, (char *)&prtype, (ftnlen)sizeof(
00853 integer));
00854 do_fio(&c__1, (char *)&weight, (ftnlen)sizeof(
00855 real));
00856 do_fio(&c__1, (char *)&mn_1.m, (ftnlen)sizeof(
00857 integer));
00858 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(
00859 integer));
00860 do_fio(&c__1, (char *)&result[j - 1], (ftnlen)
00861 sizeof(real));
00862 e_wsfe();
00863 }
00864 }
00865
00866 }
00867
00868 L30:
00869 ;
00870 }
00871
00872 }
00873
00874 }
00875
00876 }
00877
00878 goto L150;
00879
00880 L70:
00881
00882
00883
00884
00885 nptknt = 0;
00886
00887 L80:
00888 io___39.ciunit = *nin;
00889 i__1 = s_rsle(&io___39);
00890 if (i__1 != 0) {
00891 goto L140;
00892 }
00893 i__1 = do_lio(&c__3, &c__1, (char *)&mn_1.mplusn, (ftnlen)sizeof(integer))
00894 ;
00895 if (i__1 != 0) {
00896 goto L140;
00897 }
00898 i__1 = e_rsle();
00899 if (i__1 != 0) {
00900 goto L140;
00901 }
00902 if (mn_1.mplusn == 0) {
00903 goto L140;
00904 }
00905 io___40.ciunit = *nin;
00906 i__1 = s_rsle(&io___40);
00907 if (i__1 != 0) {
00908 goto L140;
00909 }
00910 i__1 = do_lio(&c__3, &c__1, (char *)&mn_1.n, (ftnlen)sizeof(integer));
00911 if (i__1 != 0) {
00912 goto L140;
00913 }
00914 i__1 = e_rsle();
00915 if (i__1 != 0) {
00916 goto L140;
00917 }
00918 i__1 = mn_1.mplusn;
00919 for (i__ = 1; i__ <= i__1; ++i__) {
00920 io___41.ciunit = *nin;
00921 s_rsle(&io___41);
00922 i__2 = mn_1.mplusn;
00923 for (j = 1; j <= i__2; ++j) {
00924 do_lio(&c__6, &c__1, (char *)&ai[i__ + j * ai_dim1], (ftnlen)
00925 sizeof(complex));
00926 }
00927 e_rsle();
00928
00929 }
00930 i__1 = mn_1.mplusn;
00931 for (i__ = 1; i__ <= i__1; ++i__) {
00932 io___42.ciunit = *nin;
00933 s_rsle(&io___42);
00934 i__2 = mn_1.mplusn;
00935 for (j = 1; j <= i__2; ++j) {
00936 do_lio(&c__6, &c__1, (char *)&bi[i__ + j * bi_dim1], (ftnlen)
00937 sizeof(complex));
00938 }
00939 e_rsle();
00940
00941 }
00942 io___43.ciunit = *nin;
00943 s_rsle(&io___43);
00944 do_lio(&c__4, &c__1, (char *)&pltru, (ftnlen)sizeof(real));
00945 do_lio(&c__4, &c__1, (char *)&diftru, (ftnlen)sizeof(real));
00946 e_rsle();
00947
00948 ++nptknt;
00949 mn_1.fs = TRUE_;
00950 mn_1.k = 0;
00951 mn_1.m = mn_1.mplusn - mn_1.n;
00952
00953 clacpy_("Full", &mn_1.mplusn, &mn_1.mplusn, &ai[ai_offset], lda, &a[
00954 a_offset], lda);
00955 clacpy_("Full", &mn_1.mplusn, &mn_1.mplusn, &bi[bi_offset], lda, &b[
00956 b_offset], lda);
00957
00958
00959
00960
00961 cggesx_("V", "V", "S", (L_fp)clctsx_, "B", &mn_1.mplusn, &ai[ai_offset],
00962 lda, &bi[bi_offset], lda, &mm, &alpha[1], &beta[1], &q[q_offset],
00963 lda, &z__[z_offset], lda, pl, difest, &work[1], lwork, &rwork[1],
00964 &iwork[1], liwork, &bwork[1], &linfo);
00965
00966 if (linfo != 0 && linfo != mn_1.mplusn + 2) {
00967 result[0] = ulpinv;
00968 io___45.ciunit = *nout;
00969 s_wsfe(&io___45);
00970 do_fio(&c__1, "CGGESX", (ftnlen)6);
00971 do_fio(&c__1, (char *)&linfo, (ftnlen)sizeof(integer));
00972 do_fio(&c__1, (char *)&mn_1.mplusn, (ftnlen)sizeof(integer));
00973 do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
00974 e_wsfe();
00975 goto L130;
00976 }
00977
00978
00979
00980
00981 clacpy_("Full", &mn_1.mplusn, &mn_1.mplusn, &ai[ai_offset], lda, &work[1],
00982 &mn_1.mplusn);
00983 clacpy_("Full", &mn_1.mplusn, &mn_1.mplusn, &bi[bi_offset], lda, &work[
00984 mn_1.mplusn * mn_1.mplusn + 1], &mn_1.mplusn);
00985 i__1 = mn_1.mplusn << 1;
00986 abnrm = clange_("Fro", &mn_1.mplusn, &i__1, &work[1], &mn_1.mplusn, &
00987 rwork[1]);
00988
00989
00990
00991 cget51_(&c__1, &mn_1.mplusn, &a[a_offset], lda, &ai[ai_offset], lda, &q[
00992 q_offset], lda, &z__[z_offset], lda, &work[1], &rwork[1], result);
00993 cget51_(&c__1, &mn_1.mplusn, &b[b_offset], lda, &bi[bi_offset], lda, &q[
00994 q_offset], lda, &z__[z_offset], lda, &work[1], &rwork[1], &result[
00995 1]);
00996 cget51_(&c__3, &mn_1.mplusn, &b[b_offset], lda, &bi[bi_offset], lda, &q[
00997 q_offset], lda, &q[q_offset], lda, &work[1], &rwork[1], &result[2]
00998 );
00999 cget51_(&c__3, &mn_1.mplusn, &b[b_offset], lda, &bi[bi_offset], lda, &z__[
01000 z_offset], lda, &z__[z_offset], lda, &work[1], &rwork[1], &result[
01001 3]);
01002
01003
01004
01005
01006 ntest = 6;
01007 temp1 = 0.f;
01008 result[4] = 0.f;
01009 result[5] = 0.f;
01010
01011 i__1 = mn_1.mplusn;
01012 for (j = 1; j <= i__1; ++j) {
01013 ilabad = FALSE_;
01014 i__2 = j;
01015 i__3 = j + j * ai_dim1;
01016 q__2.r = alpha[i__2].r - ai[i__3].r, q__2.i = alpha[i__2].i - ai[i__3]
01017 .i;
01018 q__1.r = q__2.r, q__1.i = q__2.i;
01019 i__4 = j;
01020 i__5 = j + j * bi_dim1;
01021 q__4.r = beta[i__4].r - bi[i__5].r, q__4.i = beta[i__4].i - bi[i__5]
01022 .i;
01023 q__3.r = q__4.r, q__3.i = q__4.i;
01024
01025 i__6 = j;
01026 i__7 = j + j * ai_dim1;
01027 r__13 = smlnum, r__14 = (r__1 = alpha[i__6].r, dabs(r__1)) + (r__2 =
01028 r_imag(&alpha[j]), dabs(r__2)), r__13 = max(r__13,r__14),
01029 r__14 = (r__3 = ai[i__7].r, dabs(r__3)) + (r__4 = r_imag(&ai[
01030 j + j * ai_dim1]), dabs(r__4));
01031
01032 i__8 = j;
01033 i__9 = j + j * bi_dim1;
01034 r__15 = smlnum, r__16 = (r__5 = beta[i__8].r, dabs(r__5)) + (r__6 =
01035 r_imag(&beta[j]), dabs(r__6)), r__15 = max(r__15,r__16),
01036 r__16 = (r__7 = bi[i__9].r, dabs(r__7)) + (r__8 = r_imag(&bi[
01037 j + j * bi_dim1]), dabs(r__8));
01038 temp2 = (((r__9 = q__1.r, dabs(r__9)) + (r__10 = r_imag(&q__1), dabs(
01039 r__10))) / dmax(r__13,r__14) + ((r__11 = q__3.r, dabs(r__11))
01040 + (r__12 = r_imag(&q__3), dabs(r__12))) / dmax(r__15,r__16)) /
01041 ulp;
01042 if (j < mn_1.mplusn) {
01043 i__2 = j + 1 + j * ai_dim1;
01044 if (ai[i__2].r != 0.f || ai[i__2].i != 0.f) {
01045 ilabad = TRUE_;
01046 result[4] = ulpinv;
01047 }
01048 }
01049 if (j > 1) {
01050 i__2 = j + (j - 1) * ai_dim1;
01051 if (ai[i__2].r != 0.f || ai[i__2].i != 0.f) {
01052 ilabad = TRUE_;
01053 result[4] = ulpinv;
01054 }
01055 }
01056 temp1 = dmax(temp1,temp2);
01057 if (ilabad) {
01058 io___46.ciunit = *nout;
01059 s_wsfe(&io___46);
01060 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
01061 do_fio(&c__1, (char *)&mn_1.mplusn, (ftnlen)sizeof(integer));
01062 do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
01063 e_wsfe();
01064 }
01065
01066 }
01067 result[5] = temp1;
01068
01069
01070
01071 ntest = 7;
01072 result[6] = 0.f;
01073 if (linfo == mn_1.mplusn + 3) {
01074 result[6] = ulpinv;
01075 }
01076
01077
01078
01079 ntest = 8;
01080 result[7] = 0.f;
01081 if (difest[1] == 0.f) {
01082 if (diftru > abnrm * ulp) {
01083 result[7] = ulpinv;
01084 }
01085 } else if (diftru == 0.f) {
01086 if (difest[1] > abnrm * ulp) {
01087 result[7] = ulpinv;
01088 }
01089 } else if (diftru > thrsh2 * difest[1] || diftru * thrsh2 < difest[1]) {
01090
01091 r__1 = diftru / difest[1], r__2 = difest[1] / diftru;
01092 result[7] = dmax(r__1,r__2);
01093 }
01094
01095
01096
01097 ntest = 9;
01098 result[8] = 0.f;
01099 if (linfo == mn_1.mplusn + 2) {
01100 if (diftru > abnrm * ulp) {
01101 result[8] = ulpinv;
01102 }
01103 if (ifunc > 1 && difest[1] != 0.f) {
01104 result[8] = ulpinv;
01105 }
01106 if (ifunc == 1 && pl[0] != 0.f) {
01107 result[8] = ulpinv;
01108 }
01109 }
01110
01111
01112
01113 ntest = 10;
01114 result[9] = 0.f;
01115 if (pl[0] == 0.f) {
01116 if (pltru > abnrm * ulp) {
01117 result[9] = ulpinv;
01118 }
01119 } else if (pltru == 0.f) {
01120 if (pl[0] > abnrm * ulp) {
01121 result[9] = ulpinv;
01122 }
01123 } else if (pltru > *thresh * pl[0] || pltru * *thresh < pl[0]) {
01124 result[9] = ulpinv;
01125 }
01126
01127 ntestt += ntest;
01128
01129
01130
01131 i__1 = ntest;
01132 for (j = 1; j <= i__1; ++j) {
01133 if (result[j - 1] >= *thresh) {
01134
01135
01136
01137
01138 if (nerrs == 0) {
01139 io___47.ciunit = *nout;
01140 s_wsfe(&io___47);
01141 do_fio(&c__1, "CGX", (ftnlen)3);
01142 e_wsfe();
01143
01144
01145
01146 io___48.ciunit = *nout;
01147 s_wsfe(&io___48);
01148 e_wsfe();
01149
01150
01151
01152 io___49.ciunit = *nout;
01153 s_wsfe(&io___49);
01154 do_fio(&c__1, "unitary", (ftnlen)7);
01155 do_fio(&c__1, "'", (ftnlen)1);
01156 do_fio(&c__1, "transpose", (ftnlen)9);
01157 for (i__ = 1; i__ <= 4; ++i__) {
01158 do_fio(&c__1, "'", (ftnlen)1);
01159 }
01160 e_wsfe();
01161
01162 }
01163 ++nerrs;
01164 if (result[j - 1] < 1e4f) {
01165 io___50.ciunit = *nout;
01166 s_wsfe(&io___50);
01167 do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
01168 do_fio(&c__1, (char *)&mn_1.mplusn, (ftnlen)sizeof(integer));
01169 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
01170 do_fio(&c__1, (char *)&result[j - 1], (ftnlen)sizeof(real));
01171 e_wsfe();
01172 } else {
01173 io___51.ciunit = *nout;
01174 s_wsfe(&io___51);
01175 do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
01176 do_fio(&c__1, (char *)&mn_1.mplusn, (ftnlen)sizeof(integer));
01177 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
01178 do_fio(&c__1, (char *)&result[j - 1], (ftnlen)sizeof(real));
01179 e_wsfe();
01180 }
01181 }
01182
01183
01184 }
01185
01186 L130:
01187 goto L80;
01188 L140:
01189
01190 L150:
01191
01192
01193
01194 alasvm_("CGX", nout, &nerrs, &ntestt, &c__0);
01195
01196 work[1].r = (real) maxwrk, work[1].i = 0.f;
01197
01198 return 0;
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209 }