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