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