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