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 integer c__1 = 1;
00019 static integer c_n1 = -1;
00020 static doublereal c_b26 = 0.;
00021 static integer c__2 = 2;
00022 static doublereal c_b32 = 1.;
00023 static integer c__3 = 3;
00024 static integer c__4 = 4;
00025 static integer c__0 = 0;
00026
00027 int ddrges_(integer *nsizes, integer *nn, integer *ntypes,
00028 logical *dotype, integer *iseed, doublereal *thresh, integer *nounit,
00029 doublereal *a, integer *lda, doublereal *b, doublereal *s, doublereal
00030 *t, doublereal *q, integer *ldq, doublereal *z__, doublereal *alphar,
00031 doublereal *alphai, doublereal *beta, doublereal *work, integer *
00032 lwork, doublereal *result, logical *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 integer iasign[26] = { 0,0,0,0,0,0,2,0,2,2,0,0,2,2,2,0,2,0,0,0,2,2,
00043 2,2,2,0 };
00044 static integer ibsign[26] = { 0,0,0,0,0,0,0,2,0,0,2,2,0,0,2,0,2,0,0,0,0,0,
00045 0,0,0,0 };
00046 static integer kz1[6] = { 0,1,2,1,3,3 };
00047 static integer kz2[6] = { 0,0,1,2,1,1 };
00048 static integer kadd[6] = { 0,0,0,0,3,2 };
00049 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,
00050 4,4,4,0 };
00051 static integer kbtype[26] = { 0,0,1,1,2,-3,1,4,1,1,4,4,1,1,-4,2,-4,8,8,8,
00052 8,8,8,8,8,0 };
00053 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,
00054 3,3,3,1 };
00055 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,
00056 4,4,4,1 };
00057 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,
00058 3,3,2,1 };
00059
00060
00061 static char fmt_9999[] = "(\002 DDRGES: \002,a,\002 returned INFO=\002,i"
00062 "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, ISEED="
00063 "(\002,4(i4,\002,\002),i5,\002)\002)";
00064 static char fmt_9998[] = "(\002 DDRGES: DGET53 returned INFO=\002,i1,"
00065 "\002 for eigenvalue \002,i6,\002.\002,/9x,\002N=\002,i6,\002, JT"
00066 "YPE=\002,i6,\002, ISEED=(\002,4(i4,\002,\002),i5,\002)\002)";
00067 static char fmt_9997[] = "(\002 DDRGES: 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_9996[] = "(/1x,a3,\002 -- Real Generalized Schur form dr"
00071 "iver\002)";
00072 static char fmt_9995[] = "(\002 Matrix types (see DDRGES for details):"
00073 " \002)";
00074 static char fmt_9994[] = "(\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_9993[] = "(\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_9992[] = "(/\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 "
00106 "number of \002,\002selected eigenvalues\002,/)";
00107 static char fmt_9991[] = "(\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_9990[] = "(\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,d10.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;
00118 doublereal d__1, d__2, d__3, d__4, d__5, d__6, d__7, d__8, d__9, d__10;
00119
00120
00121 double d_sign(doublereal *, doublereal *);
00122 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00123
00124
00125 integer i__, j, n, i1, n1, jc, nb, in, jr;
00126 doublereal ulp;
00127 integer iadd, sdim, ierr, nmax, rsub;
00128 char sort[1];
00129 doublereal temp1, temp2;
00130 logical badnn;
00131 extern int dget51_(integer *, integer *, doublereal *,
00132 integer *, doublereal *, integer *, doublereal *, integer *,
00133 doublereal *, integer *, doublereal *, doublereal *), dget53_(
00134 doublereal *, integer *, doublereal *, integer *, doublereal *,
00135 doublereal *, doublereal *, doublereal *, integer *), dget54_(
00136 integer *, doublereal *, integer *, doublereal *, integer *,
00137 doublereal *, integer *, doublereal *, integer *, doublereal *,
00138 integer *, doublereal *, integer *, doublereal *, doublereal *),
00139 dgges_(char *, char *, char *, L_fp, integer *, doublereal *,
00140 integer *, doublereal *, integer *, integer *, doublereal *,
00141 doublereal *, doublereal *, doublereal *, integer *, doublereal *,
00142 integer *, doublereal *, integer *, logical *, integer *);
00143 integer iinfo;
00144 doublereal rmagn[4];
00145 integer nmats, jsize, nerrs, jtype, ntest, isort;
00146 extern int dlatm4_(integer *, integer *, integer *,
00147 integer *, integer *, doublereal *, doublereal *, doublereal *,
00148 integer *, integer *, doublereal *, integer *), dorm2r_(char *,
00149 char *, integer *, integer *, integer *, doublereal *, integer *,
00150 doublereal *, doublereal *, integer *, doublereal *, integer *), dlabad_(doublereal *, doublereal *);
00151 logical ilabad;
00152 extern doublereal dlamch_(char *);
00153 extern int dlarfg_(integer *, doublereal *, doublereal *,
00154 integer *, doublereal *);
00155 extern doublereal dlarnd_(integer *, integer *);
00156 extern int dlacpy_(char *, integer *, integer *,
00157 doublereal *, integer *, doublereal *, integer *);
00158 doublereal safmin;
00159 integer ioldsd[4];
00160 doublereal safmax;
00161 integer knteig;
00162 extern logical dlctes_(doublereal *, doublereal *, doublereal *);
00163 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00164 integer *, integer *);
00165 extern int alasvm_(char *, integer *, integer *, integer
00166 *, integer *), dlaset_(char *, integer *, integer *,
00167 doublereal *, doublereal *, doublereal *, integer *),
00168 xerbla_(char *, integer *);
00169 integer minwrk, maxwrk;
00170 doublereal ulpinv;
00171 integer mtypes, ntestt;
00172
00173
00174 static cilist io___40 = { 0, 0, 0, fmt_9999, 0 };
00175 static cilist io___46 = { 0, 0, 0, fmt_9999, 0 };
00176 static cilist io___52 = { 0, 0, 0, fmt_9998, 0 };
00177 static cilist io___53 = { 0, 0, 0, fmt_9997, 0 };
00178 static cilist io___55 = { 0, 0, 0, fmt_9996, 0 };
00179 static cilist io___56 = { 0, 0, 0, fmt_9995, 0 };
00180 static cilist io___57 = { 0, 0, 0, fmt_9994, 0 };
00181 static cilist io___58 = { 0, 0, 0, fmt_9993, 0 };
00182 static cilist io___59 = { 0, 0, 0, fmt_9992, 0 };
00183 static cilist io___60 = { 0, 0, 0, fmt_9991, 0 };
00184 static cilist io___61 = { 0, 0, 0, fmt_9990, 0 };
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
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496 --nn;
00497 --dotype;
00498 --iseed;
00499 t_dim1 = *lda;
00500 t_offset = 1 + t_dim1;
00501 t -= t_offset;
00502 s_dim1 = *lda;
00503 s_offset = 1 + s_dim1;
00504 s -= s_offset;
00505 b_dim1 = *lda;
00506 b_offset = 1 + b_dim1;
00507 b -= b_offset;
00508 a_dim1 = *lda;
00509 a_offset = 1 + a_dim1;
00510 a -= a_offset;
00511 z_dim1 = *ldq;
00512 z_offset = 1 + z_dim1;
00513 z__ -= z_offset;
00514 q_dim1 = *ldq;
00515 q_offset = 1 + q_dim1;
00516 q -= q_offset;
00517 --alphar;
00518 --alphai;
00519 --beta;
00520 --work;
00521 --result;
00522 --bwork;
00523
00524
00525
00526
00527
00528
00529
00530 *info = 0;
00531
00532 badnn = FALSE_;
00533 nmax = 1;
00534 i__1 = *nsizes;
00535 for (j = 1; j <= i__1; ++j) {
00536
00537 i__2 = nmax, i__3 = nn[j];
00538 nmax = max(i__2,i__3);
00539 if (nn[j] < 0) {
00540 badnn = TRUE_;
00541 }
00542
00543 }
00544
00545 if (*nsizes < 0) {
00546 *info = -1;
00547 } else if (badnn) {
00548 *info = -2;
00549 } else if (*ntypes < 0) {
00550 *info = -3;
00551 } else if (*thresh < 0.) {
00552 *info = -6;
00553 } else if (*lda <= 1 || *lda < nmax) {
00554 *info = -9;
00555 } else if (*ldq <= 1 || *ldq < nmax) {
00556 *info = -14;
00557 }
00558
00559
00560
00561
00562
00563
00564
00565
00566 minwrk = 1;
00567 if (*info == 0 && *lwork >= 1) {
00568
00569 i__1 = (nmax + 1) * 10, i__2 = nmax * 3 * nmax;
00570 minwrk = max(i__1,i__2);
00571
00572 i__1 = 1, i__2 = ilaenv_(&c__1, "DGEQRF", " ", &nmax, &nmax, &c_n1, &
00573 c_n1), i__1 = max(i__1,i__2), i__2 =
00574 ilaenv_(&c__1, "DORMQR", "LT", &nmax, &nmax, &nmax, &c_n1), i__1 = max(i__1,i__2), i__2 = ilaenv_(&
00575 c__1, "DORGQR", " ", &nmax, &nmax, &nmax, &c_n1);
00576 nb = max(i__1,i__2);
00577
00578 i__1 = (nmax + 1) * 10, i__2 = (nmax << 1) + nmax * nb, i__1 = max(
00579 i__1,i__2), i__2 = nmax * 3 * nmax;
00580 maxwrk = max(i__1,i__2);
00581 work[1] = (doublereal) maxwrk;
00582 }
00583
00584 if (*lwork < minwrk) {
00585 *info = -20;
00586 }
00587
00588 if (*info != 0) {
00589 i__1 = -(*info);
00590 xerbla_("DDRGES", &i__1);
00591 return 0;
00592 }
00593
00594
00595
00596 if (*nsizes == 0 || *ntypes == 0) {
00597 return 0;
00598 }
00599
00600 safmin = dlamch_("Safe minimum");
00601 ulp = dlamch_("Epsilon") * dlamch_("Base");
00602 safmin /= ulp;
00603 safmax = 1. / safmin;
00604 dlabad_(&safmin, &safmax);
00605 ulpinv = 1. / ulp;
00606
00607
00608
00609 rmagn[0] = 0.;
00610 rmagn[1] = 1.;
00611
00612
00613
00614 ntestt = 0;
00615 nerrs = 0;
00616 nmats = 0;
00617
00618 i__1 = *nsizes;
00619 for (jsize = 1; jsize <= i__1; ++jsize) {
00620 n = nn[jsize];
00621 n1 = max(1,n);
00622 rmagn[2] = safmax * ulp / (doublereal) n1;
00623 rmagn[3] = safmin * ulpinv * (doublereal) n1;
00624
00625 if (*nsizes != 1) {
00626 mtypes = min(26,*ntypes);
00627 } else {
00628 mtypes = min(27,*ntypes);
00629 }
00630
00631
00632
00633 i__2 = mtypes;
00634 for (jtype = 1; jtype <= i__2; ++jtype) {
00635 if (! dotype[jtype]) {
00636 goto L180;
00637 }
00638 ++nmats;
00639 ntest = 0;
00640
00641
00642
00643 for (j = 1; j <= 4; ++j) {
00644 ioldsd[j - 1] = iseed[j];
00645
00646 }
00647
00648
00649
00650 for (j = 1; j <= 13; ++j) {
00651 result[j] = 0.;
00652
00653 }
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678 if (mtypes > 26) {
00679 goto L110;
00680 }
00681 iinfo = 0;
00682 if (kclass[jtype - 1] < 3) {
00683
00684
00685
00686 if ((i__3 = katype[jtype - 1], abs(i__3)) == 3) {
00687 in = ((n - 1) / 2 << 1) + 1;
00688 if (in != n) {
00689 dlaset_("Full", &n, &n, &c_b26, &c_b26, &a[a_offset],
00690 lda);
00691 }
00692 } else {
00693 in = n;
00694 }
00695 dlatm4_(&katype[jtype - 1], &in, &kz1[kazero[jtype - 1] - 1],
00696 &kz2[kazero[jtype - 1] - 1], &iasign[jtype - 1], &
00697 rmagn[kamagn[jtype - 1]], &ulp, &rmagn[ktrian[jtype -
00698 1] * kamagn[jtype - 1]], &c__2, &iseed[1], &a[
00699 a_offset], lda);
00700 iadd = kadd[kazero[jtype - 1] - 1];
00701 if (iadd > 0 && iadd <= n) {
00702 a[iadd + iadd * a_dim1] = 1.;
00703 }
00704
00705
00706
00707 if ((i__3 = kbtype[jtype - 1], abs(i__3)) == 3) {
00708 in = ((n - 1) / 2 << 1) + 1;
00709 if (in != n) {
00710 dlaset_("Full", &n, &n, &c_b26, &c_b26, &b[b_offset],
00711 lda);
00712 }
00713 } else {
00714 in = n;
00715 }
00716 dlatm4_(&kbtype[jtype - 1], &in, &kz1[kbzero[jtype - 1] - 1],
00717 &kz2[kbzero[jtype - 1] - 1], &ibsign[jtype - 1], &
00718 rmagn[kbmagn[jtype - 1]], &c_b32, &rmagn[ktrian[jtype
00719 - 1] * kbmagn[jtype - 1]], &c__2, &iseed[1], &b[
00720 b_offset], lda);
00721 iadd = kadd[kbzero[jtype - 1] - 1];
00722 if (iadd != 0 && iadd <= n) {
00723 b[iadd + iadd * b_dim1] = 1.;
00724 }
00725
00726 if (kclass[jtype - 1] == 2 && n > 0) {
00727
00728
00729
00730
00731
00732
00733 i__3 = n - 1;
00734 for (jc = 1; jc <= i__3; ++jc) {
00735 i__4 = n;
00736 for (jr = jc; jr <= i__4; ++jr) {
00737 q[jr + jc * q_dim1] = dlarnd_(&c__3, &iseed[1]);
00738 z__[jr + jc * z_dim1] = dlarnd_(&c__3, &iseed[1]);
00739
00740 }
00741 i__4 = n + 1 - jc;
00742 dlarfg_(&i__4, &q[jc + jc * q_dim1], &q[jc + 1 + jc *
00743 q_dim1], &c__1, &work[jc]);
00744 work[(n << 1) + jc] = d_sign(&c_b32, &q[jc + jc *
00745 q_dim1]);
00746 q[jc + jc * q_dim1] = 1.;
00747 i__4 = n + 1 - jc;
00748 dlarfg_(&i__4, &z__[jc + jc * z_dim1], &z__[jc + 1 +
00749 jc * z_dim1], &c__1, &work[n + jc]);
00750 work[n * 3 + jc] = d_sign(&c_b32, &z__[jc + jc *
00751 z_dim1]);
00752 z__[jc + jc * z_dim1] = 1.;
00753
00754 }
00755 q[n + n * q_dim1] = 1.;
00756 work[n] = 0.;
00757 d__1 = dlarnd_(&c__2, &iseed[1]);
00758 work[n * 3] = d_sign(&c_b32, &d__1);
00759 z__[n + n * z_dim1] = 1.;
00760 work[n * 2] = 0.;
00761 d__1 = dlarnd_(&c__2, &iseed[1]);
00762 work[n * 4] = d_sign(&c_b32, &d__1);
00763
00764
00765
00766 i__3 = n;
00767 for (jc = 1; jc <= i__3; ++jc) {
00768 i__4 = n;
00769 for (jr = 1; jr <= i__4; ++jr) {
00770 a[jr + jc * a_dim1] = work[(n << 1) + jr] * work[
00771 n * 3 + jc] * a[jr + jc * a_dim1];
00772 b[jr + jc * b_dim1] = work[(n << 1) + jr] * work[
00773 n * 3 + jc] * b[jr + jc * b_dim1];
00774
00775 }
00776
00777 }
00778 i__3 = n - 1;
00779 dorm2r_("L", "N", &n, &n, &i__3, &q[q_offset], ldq, &work[
00780 1], &a[a_offset], lda, &work[(n << 1) + 1], &
00781 iinfo);
00782 if (iinfo != 0) {
00783 goto L100;
00784 }
00785 i__3 = n - 1;
00786 dorm2r_("R", "T", &n, &n, &i__3, &z__[z_offset], ldq, &
00787 work[n + 1], &a[a_offset], lda, &work[(n << 1) +
00788 1], &iinfo);
00789 if (iinfo != 0) {
00790 goto L100;
00791 }
00792 i__3 = n - 1;
00793 dorm2r_("L", "N", &n, &n, &i__3, &q[q_offset], ldq, &work[
00794 1], &b[b_offset], lda, &work[(n << 1) + 1], &
00795 iinfo);
00796 if (iinfo != 0) {
00797 goto L100;
00798 }
00799 i__3 = n - 1;
00800 dorm2r_("R", "T", &n, &n, &i__3, &z__[z_offset], ldq, &
00801 work[n + 1], &b[b_offset], lda, &work[(n << 1) +
00802 1], &iinfo);
00803 if (iinfo != 0) {
00804 goto L100;
00805 }
00806 }
00807 } else {
00808
00809
00810
00811 i__3 = n;
00812 for (jc = 1; jc <= i__3; ++jc) {
00813 i__4 = n;
00814 for (jr = 1; jr <= i__4; ++jr) {
00815 a[jr + jc * a_dim1] = rmagn[kamagn[jtype - 1]] *
00816 dlarnd_(&c__2, &iseed[1]);
00817 b[jr + jc * b_dim1] = rmagn[kbmagn[jtype - 1]] *
00818 dlarnd_(&c__2, &iseed[1]);
00819
00820 }
00821
00822 }
00823 }
00824
00825 L100:
00826
00827 if (iinfo != 0) {
00828 io___40.ciunit = *nounit;
00829 s_wsfe(&io___40);
00830 do_fio(&c__1, "Generator", (ftnlen)9);
00831 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00832 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00833 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00834 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00835 e_wsfe();
00836 *info = abs(iinfo);
00837 return 0;
00838 }
00839
00840 L110:
00841
00842 for (i__ = 1; i__ <= 13; ++i__) {
00843 result[i__] = -1.;
00844
00845 }
00846
00847
00848
00849 for (isort = 0; isort <= 1; ++isort) {
00850 if (isort == 0) {
00851 *(unsigned char *)sort = 'N';
00852 rsub = 0;
00853 } else {
00854 *(unsigned char *)sort = 'S';
00855 rsub = 5;
00856 }
00857
00858
00859
00860 dlacpy_("Full", &n, &n, &a[a_offset], lda, &s[s_offset], lda);
00861 dlacpy_("Full", &n, &n, &b[b_offset], lda, &t[t_offset], lda);
00862 ntest = rsub + 1 + isort;
00863 result[rsub + 1 + isort] = ulpinv;
00864 dgges_("V", "V", sort, (L_fp)dlctes_, &n, &s[s_offset], lda, &
00865 t[t_offset], lda, &sdim, &alphar[1], &alphai[1], &
00866 beta[1], &q[q_offset], ldq, &z__[z_offset], ldq, &
00867 work[1], lwork, &bwork[1], &iinfo);
00868 if (iinfo != 0 && iinfo != n + 2) {
00869 result[rsub + 1 + isort] = ulpinv;
00870 io___46.ciunit = *nounit;
00871 s_wsfe(&io___46);
00872 do_fio(&c__1, "DGGES", (ftnlen)5);
00873 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00874 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00875 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00876 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00877 ;
00878 e_wsfe();
00879 *info = abs(iinfo);
00880 goto L160;
00881 }
00882
00883 ntest = rsub + 4;
00884
00885
00886
00887 if (isort == 0) {
00888 dget51_(&c__1, &n, &a[a_offset], lda, &s[s_offset], lda, &
00889 q[q_offset], ldq, &z__[z_offset], ldq, &work[1], &
00890 result[1]);
00891 dget51_(&c__1, &n, &b[b_offset], lda, &t[t_offset], lda, &
00892 q[q_offset], ldq, &z__[z_offset], ldq, &work[1], &
00893 result[2]);
00894 } else {
00895 dget54_(&n, &a[a_offset], lda, &b[b_offset], lda, &s[
00896 s_offset], lda, &t[t_offset], lda, &q[q_offset],
00897 ldq, &z__[z_offset], ldq, &work[1], &result[7]);
00898 }
00899 dget51_(&c__3, &n, &a[a_offset], lda, &t[t_offset], lda, &q[
00900 q_offset], ldq, &q[q_offset], ldq, &work[1], &result[
00901 rsub + 3]);
00902 dget51_(&c__3, &n, &b[b_offset], lda, &t[t_offset], lda, &z__[
00903 z_offset], ldq, &z__[z_offset], ldq, &work[1], &
00904 result[rsub + 4]);
00905
00906
00907
00908
00909
00910 ntest = rsub + 6;
00911 temp1 = 0.;
00912
00913 i__3 = n;
00914 for (j = 1; j <= i__3; ++j) {
00915 ilabad = FALSE_;
00916 if (alphai[j] == 0.) {
00917
00918 d__7 = safmin, d__8 = (d__2 = alphar[j], abs(d__2)),
00919 d__7 = max(d__7,d__8), d__8 = (d__3 = s[j + j
00920 * s_dim1], abs(d__3));
00921
00922 d__9 = safmin, d__10 = (d__5 = beta[j], abs(d__5)),
00923 d__9 = max(d__9,d__10), d__10 = (d__6 = t[j +
00924 j * t_dim1], abs(d__6));
00925 temp2 = ((d__1 = alphar[j] - s[j + j * s_dim1], abs(
00926 d__1)) / max(d__7,d__8) + (d__4 = beta[j] - t[
00927 j + j * t_dim1], abs(d__4)) / max(d__9,d__10))
00928 / ulp;
00929
00930 if (j < n) {
00931 if (s[j + 1 + j * s_dim1] != 0.) {
00932 ilabad = TRUE_;
00933 result[rsub + 5] = ulpinv;
00934 }
00935 }
00936 if (j > 1) {
00937 if (s[j + (j - 1) * s_dim1] != 0.) {
00938 ilabad = TRUE_;
00939 result[rsub + 5] = ulpinv;
00940 }
00941 }
00942
00943 } else {
00944 if (alphai[j] > 0.) {
00945 i1 = j;
00946 } else {
00947 i1 = j - 1;
00948 }
00949 if (i1 <= 0 || i1 >= n) {
00950 ilabad = TRUE_;
00951 } else if (i1 < n - 1) {
00952 if (s[i1 + 2 + (i1 + 1) * s_dim1] != 0.) {
00953 ilabad = TRUE_;
00954 result[rsub + 5] = ulpinv;
00955 }
00956 } else if (i1 > 1) {
00957 if (s[i1 + (i1 - 1) * s_dim1] != 0.) {
00958 ilabad = TRUE_;
00959 result[rsub + 5] = ulpinv;
00960 }
00961 }
00962 if (! ilabad) {
00963 dget53_(&s[i1 + i1 * s_dim1], lda, &t[i1 + i1 *
00964 t_dim1], lda, &beta[j], &alphar[j], &
00965 alphai[j], &temp2, &ierr);
00966 if (ierr >= 3) {
00967 io___52.ciunit = *nounit;
00968 s_wsfe(&io___52);
00969 do_fio(&c__1, (char *)&ierr, (ftnlen)sizeof(
00970 integer));
00971 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(
00972 integer));
00973 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00974 integer));
00975 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(
00976 integer));
00977 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)
00978 sizeof(integer));
00979 e_wsfe();
00980 *info = abs(ierr);
00981 }
00982 } else {
00983 temp2 = ulpinv;
00984 }
00985
00986 }
00987 temp1 = max(temp1,temp2);
00988 if (ilabad) {
00989 io___53.ciunit = *nounit;
00990 s_wsfe(&io___53);
00991 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
00992 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00993 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
00994 ;
00995 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
00996 integer));
00997 e_wsfe();
00998 }
00999
01000 }
01001 result[rsub + 6] = temp1;
01002
01003 if (isort >= 1) {
01004
01005
01006
01007 ntest = 12;
01008 result[12] = 0.;
01009 knteig = 0;
01010 i__3 = n;
01011 for (i__ = 1; i__ <= i__3; ++i__) {
01012 d__1 = -alphai[i__];
01013 if (dlctes_(&alphar[i__], &alphai[i__], &beta[i__]) ||
01014 dlctes_(&alphar[i__], &d__1, &beta[i__])) {
01015 ++knteig;
01016 }
01017 if (i__ < n) {
01018 d__1 = -alphai[i__ + 1];
01019 d__2 = -alphai[i__];
01020 if ((dlctes_(&alphar[i__ + 1], &alphai[i__ + 1], &
01021 beta[i__ + 1]) || dlctes_(&alphar[i__ + 1]
01022 , &d__1, &beta[i__ + 1])) && ! (dlctes_(&
01023 alphar[i__], &alphai[i__], &beta[i__]) ||
01024 dlctes_(&alphar[i__], &d__2, &beta[i__]))
01025 && iinfo != n + 2) {
01026 result[12] = ulpinv;
01027 }
01028 }
01029
01030 }
01031 if (sdim != knteig) {
01032 result[12] = ulpinv;
01033 }
01034 }
01035
01036
01037 }
01038
01039
01040
01041 L160:
01042
01043 ntestt += ntest;
01044
01045
01046
01047 i__3 = ntest;
01048 for (jr = 1; jr <= i__3; ++jr) {
01049 if (result[jr] >= *thresh) {
01050
01051
01052
01053
01054 if (nerrs == 0) {
01055 io___55.ciunit = *nounit;
01056 s_wsfe(&io___55);
01057 do_fio(&c__1, "DGS", (ftnlen)3);
01058 e_wsfe();
01059
01060
01061
01062 io___56.ciunit = *nounit;
01063 s_wsfe(&io___56);
01064 e_wsfe();
01065 io___57.ciunit = *nounit;
01066 s_wsfe(&io___57);
01067 e_wsfe();
01068 io___58.ciunit = *nounit;
01069 s_wsfe(&io___58);
01070 do_fio(&c__1, "Orthogonal", (ftnlen)10);
01071 e_wsfe();
01072
01073
01074
01075 io___59.ciunit = *nounit;
01076 s_wsfe(&io___59);
01077 do_fio(&c__1, "orthogonal", (ftnlen)10);
01078 do_fio(&c__1, "'", (ftnlen)1);
01079 do_fio(&c__1, "transpose", (ftnlen)9);
01080 for (j = 1; j <= 8; ++j) {
01081 do_fio(&c__1, "'", (ftnlen)1);
01082 }
01083 e_wsfe();
01084
01085 }
01086 ++nerrs;
01087 if (result[jr] < 1e4) {
01088 io___60.ciunit = *nounit;
01089 s_wsfe(&io___60);
01090 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01091 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01092 ;
01093 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01094 integer));
01095 do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01096 do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01097 doublereal));
01098 e_wsfe();
01099 } else {
01100 io___61.ciunit = *nounit;
01101 s_wsfe(&io___61);
01102 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01103 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01104 ;
01105 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01106 integer));
01107 do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01108 do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01109 doublereal));
01110 e_wsfe();
01111 }
01112 }
01113
01114 }
01115
01116 L180:
01117 ;
01118 }
01119
01120 }
01121
01122
01123
01124 alasvm_("DGS", nounit, &nerrs, &ntestt, &c__0);
01125
01126 work[1] = (doublereal) maxwrk;
01127
01128 return 0;
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139 }