ddrges.c
Go to the documentation of this file.
00001 /* ddrges.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Table of constant values */
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 /* Subroutine */ 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     /* Initialized data */
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     /* Format strings */
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     /* System generated locals */
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     /* Builtin functions */
00121     double d_sign(doublereal *, doublereal *);
00122     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00123 
00124     /* Local variables */
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 /* Subroutine */ 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 /* Subroutine */ 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 /* Subroutine */ int dlarfg_(integer *, doublereal *, doublereal *, 
00154              integer *, doublereal *);
00155     extern doublereal dlarnd_(integer *, integer *);
00156     extern /* Subroutine */ 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 /* Subroutine */ 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     /* Fortran I/O blocks */
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 /*  -- LAPACK test routine (version 3.1) -- */
00189 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00190 /*     November 2006 */
00191 
00192 /*     .. Scalar Arguments .. */
00193 /*     .. */
00194 /*     .. Array Arguments .. */
00195 /*     .. */
00196 
00197 /*  Purpose */
00198 /*  ======= */
00199 
00200 /*  DDRGES checks the nonsymmetric generalized eigenvalue (Schur form) */
00201 /*  problem driver DGGES. */
00202 
00203 /*  DGGES factors A and B as Q S Z'  and Q T Z' , where ' means */
00204 /*  transpose, T is upper triangular, S is in generalized Schur form */
00205 /*  (block upper triangular, with 1x1 and 2x2 blocks on the diagonal, */
00206 /*  the 2x2 blocks corresponding to complex conjugate pairs of */
00207 /*  generalized eigenvalues), and Q and Z are orthogonal. It also */
00208 /*  computes the generalized eigenvalues (alpha(j),beta(j)), j=1,...,n, */
00209 /*  Thus, w(j) = alpha(j)/beta(j) is a root of the characteristic */
00210 /*  equation */
00211 /*                  det( A - w(j) B ) = 0 */
00212 /*  Optionally it also reorder the eigenvalues so that a selected */
00213 /*  cluster of eigenvalues appears in the leading diagonal block of the */
00214 /*  Schur forms. */
00215 
00216 /*  When DDRGES is called, a number of matrix "sizes" ("N's") and a */
00217 /*  number of matrix "TYPES" are specified.  For each size ("N") */
00218 /*  and each TYPE of matrix, a pair of matrices (A, B) will be generated */
00219 /*  and used for testing. For each matrix pair, the following 13 tests */
00220 /*  will be performed and compared with the threshhold THRESH except */
00221 /*  the tests (5), (11) and (13). */
00222 
00223 
00224 /*  (1)   | A - Q S Z' | / ( |A| n ulp ) (no sorting of eigenvalues) */
00225 
00226 
00227 /*  (2)   | B - Q T Z' | / ( |B| n ulp ) (no sorting of eigenvalues) */
00228 
00229 
00230 /*  (3)   | I - QQ' | / ( n ulp ) (no sorting of eigenvalues) */
00231 
00232 
00233 /*  (4)   | I - ZZ' | / ( n ulp ) (no sorting of eigenvalues) */
00234 
00235 /*  (5)   if A is in Schur form (i.e. quasi-triangular form) */
00236 /*        (no sorting of eigenvalues) */
00237 
00238 /*  (6)   if eigenvalues = diagonal blocks of the Schur form (S, T), */
00239 /*        i.e., test the maximum over j of D(j)  where: */
00240 
00241 /*        if alpha(j) is real: */
00242 /*                      |alpha(j) - S(j,j)|        |beta(j) - T(j,j)| */
00243 /*            D(j) = ------------------------ + ----------------------- */
00244 /*                   max(|alpha(j)|,|S(j,j)|)   max(|beta(j)|,|T(j,j)|) */
00245 
00246 /*        if alpha(j) is complex: */
00247 /*                                  | det( s S - w T ) | */
00248 /*            D(j) = --------------------------------------------------- */
00249 /*                   ulp max( s norm(S), |w| norm(T) )*norm( s S - w T ) */
00250 
00251 /*        and S and T are here the 2 x 2 diagonal blocks of S and T */
00252 /*        corresponding to the j-th and j+1-th eigenvalues. */
00253 /*        (no sorting of eigenvalues) */
00254 
00255 /*  (7)   | (A,B) - Q (S,T) Z' | / ( | (A,B) | n ulp ) */
00256 /*             (with sorting of eigenvalues). */
00257 
00258 /*  (8)   | I - QQ' | / ( n ulp ) (with sorting of eigenvalues). */
00259 
00260 /*  (9)   | I - ZZ' | / ( n ulp ) (with sorting of eigenvalues). */
00261 
00262 /*  (10)  if A is in Schur form (i.e. quasi-triangular form) */
00263 /*        (with sorting of eigenvalues). */
00264 
00265 /*  (11)  if eigenvalues = diagonal blocks of the Schur form (S, T), */
00266 /*        i.e. test the maximum over j of D(j)  where: */
00267 
00268 /*        if alpha(j) is real: */
00269 /*                      |alpha(j) - S(j,j)|        |beta(j) - T(j,j)| */
00270 /*            D(j) = ------------------------ + ----------------------- */
00271 /*                   max(|alpha(j)|,|S(j,j)|)   max(|beta(j)|,|T(j,j)|) */
00272 
00273 /*        if alpha(j) is complex: */
00274 /*                                  | det( s S - w T ) | */
00275 /*            D(j) = --------------------------------------------------- */
00276 /*                   ulp max( s norm(S), |w| norm(T) )*norm( s S - w T ) */
00277 
00278 /*        and S and T are here the 2 x 2 diagonal blocks of S and T */
00279 /*        corresponding to the j-th and j+1-th eigenvalues. */
00280 /*        (with sorting of eigenvalues). */
00281 
00282 /*  (12)  if sorting worked and SDIM is the number of eigenvalues */
00283 /*        which were SELECTed. */
00284 
00285 /*  Test Matrices */
00286 /*  ============= */
00287 
00288 /*  The sizes of the test matrices are specified by an array */
00289 /*  NN(1:NSIZES); the value of each element NN(j) specifies one size. */
00290 /*  The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if */
00291 /*  DOTYPE(j) is .TRUE., then matrix type "j" will be generated. */
00292 /*  Currently, the list of possible types is: */
00293 
00294 /*  (1)  ( 0, 0 )         (a pair of zero matrices) */
00295 
00296 /*  (2)  ( I, 0 )         (an identity and a zero matrix) */
00297 
00298 /*  (3)  ( 0, I )         (an identity and a zero matrix) */
00299 
00300 /*  (4)  ( I, I )         (a pair of identity matrices) */
00301 
00302 /*          t   t */
00303 /*  (5)  ( J , J  )       (a pair of transposed Jordan blocks) */
00304 
00305 /*                                      t                ( I   0  ) */
00306 /*  (6)  ( X, Y )         where  X = ( J   0  )  and Y = (      t ) */
00307 /*                                   ( 0   I  )          ( 0   J  ) */
00308 /*                        and I is a k x k identity and J a (k+1)x(k+1) */
00309 /*                        Jordan block; k=(N-1)/2 */
00310 
00311 /*  (7)  ( D, I )         where D is diag( 0, 1,..., N-1 ) (a diagonal */
00312 /*                        matrix with those diagonal entries.) */
00313 /*  (8)  ( I, D ) */
00314 
00315 /*  (9)  ( big*D, small*I ) where "big" is near overflow and small=1/big */
00316 
00317 /*  (10) ( small*D, big*I ) */
00318 
00319 /*  (11) ( big*I, small*D ) */
00320 
00321 /*  (12) ( small*I, big*D ) */
00322 
00323 /*  (13) ( big*D, big*I ) */
00324 
00325 /*  (14) ( small*D, small*I ) */
00326 
00327 /*  (15) ( D1, D2 )        where D1 is diag( 0, 0, 1, ..., N-3, 0 ) and */
00328 /*                         D2 is diag( 0, N-3, N-4,..., 1, 0, 0 ) */
00329 /*            t   t */
00330 /*  (16) Q ( J , J ) Z     where Q and Z are random orthogonal matrices. */
00331 
00332 /*  (17) Q ( T1, T2 ) Z    where T1 and T2 are upper triangular matrices */
00333 /*                         with random O(1) entries above the diagonal */
00334 /*                         and diagonal entries diag(T1) = */
00335 /*                         ( 0, 0, 1, ..., N-3, 0 ) and diag(T2) = */
00336 /*                         ( 0, N-3, N-4,..., 1, 0, 0 ) */
00337 
00338 /*  (18) Q ( T1, T2 ) Z    diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 ) */
00339 /*                         diag(T2) = ( 0, 1, 0, 1,..., 1, 0 ) */
00340 /*                         s = machine precision. */
00341 
00342 /*  (19) Q ( T1, T2 ) Z    diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 ) */
00343 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 ) */
00344 
00345 /*                                                         N-5 */
00346 /*  (20) Q ( T1, T2 ) Z    diag(T1)=( 0, 0, 1, 1, a, ..., a   =s, 0 ) */
00347 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) */
00348 
00349 /*  (21) Q ( T1, T2 ) Z    diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 ) */
00350 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) */
00351 /*                         where r1,..., r(N-4) are random. */
00352 
00353 /*  (22) Q ( big*T1, small*T2 ) Z    diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00354 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00355 
00356 /*  (23) Q ( small*T1, big*T2 ) Z    diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00357 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00358 
00359 /*  (24) Q ( small*T1, small*T2 ) Z  diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00360 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00361 
00362 /*  (25) Q ( big*T1, big*T2 ) Z      diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00363 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00364 
00365 /*  (26) Q ( T1, T2 ) Z     where T1 and T2 are random upper-triangular */
00366 /*                          matrices. */
00367 
00368 
00369 /*  Arguments */
00370 /*  ========= */
00371 
00372 /*  NSIZES  (input) INTEGER */
00373 /*          The number of sizes of matrices to use.  If it is zero, */
00374 /*          DDRGES does nothing.  NSIZES >= 0. */
00375 
00376 /*  NN      (input) INTEGER array, dimension (NSIZES) */
00377 /*          An array containing the sizes to be used for the matrices. */
00378 /*          Zero values will be skipped.  NN >= 0. */
00379 
00380 /*  NTYPES  (input) INTEGER */
00381 /*          The number of elements in DOTYPE.   If it is zero, DDRGES */
00382 /*          does nothing.  It must be at least zero.  If it is MAXTYP+1 */
00383 /*          and NSIZES is 1, then an additional type, MAXTYP+1 is */
00384 /*          defined, which is to use whatever matrix is in A on input. */
00385 /*          This is only useful if DOTYPE(1:MAXTYP) is .FALSE. and */
00386 /*          DOTYPE(MAXTYP+1) is .TRUE. . */
00387 
00388 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00389 /*          If DOTYPE(j) is .TRUE., then for each size in NN a */
00390 /*          matrix of that size and of type j will be generated. */
00391 /*          If NTYPES is smaller than the maximum number of types */
00392 /*          defined (PARAMETER MAXTYP), then types NTYPES+1 through */
00393 /*          MAXTYP will not be generated. If NTYPES is larger */
00394 /*          than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) */
00395 /*          will be ignored. */
00396 
00397 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00398 /*          On entry ISEED specifies the seed of the random number */
00399 /*          generator. The array elements should be between 0 and 4095; */
00400 /*          if not they will be reduced mod 4096. Also, ISEED(4) must */
00401 /*          be odd.  The random number generator uses a linear */
00402 /*          congruential sequence limited to small integers, and so */
00403 /*          should produce machine independent random numbers. The */
00404 /*          values of ISEED are changed on exit, and can be used in the */
00405 /*          next call to DDRGES to continue the same random number */
00406 /*          sequence. */
00407 
00408 /*  THRESH  (input) DOUBLE PRECISION */
00409 /*          A test will count as "failed" if the "error", computed as */
00410 /*          described above, exceeds THRESH.  Note that the error is */
00411 /*          scaled to be O(1), so THRESH should be a reasonably small */
00412 /*          multiple of 1, e.g., 10 or 100.  In particular, it should */
00413 /*          not depend on the precision (single vs. double) or the size */
00414 /*          of the matrix.  THRESH >= 0. */
00415 
00416 /*  NOUNIT  (input) INTEGER */
00417 /*          The FORTRAN unit number for printing out error messages */
00418 /*          (e.g., if a routine returns IINFO not equal to 0.) */
00419 
00420 /*  A       (input/workspace) DOUBLE PRECISION array, */
00421 /*                                       dimension(LDA, max(NN)) */
00422 /*          Used to hold the original A matrix.  Used as input only */
00423 /*          if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and */
00424 /*          DOTYPE(MAXTYP+1)=.TRUE. */
00425 
00426 /*  LDA     (input) INTEGER */
00427 /*          The leading dimension of A, B, S, and T. */
00428 /*          It must be at least 1 and at least max( NN ). */
00429 
00430 /*  B       (input/workspace) DOUBLE PRECISION array, */
00431 /*                                       dimension(LDA, max(NN)) */
00432 /*          Used to hold the original B matrix.  Used as input only */
00433 /*          if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and */
00434 /*          DOTYPE(MAXTYP+1)=.TRUE. */
00435 
00436 /*  S       (workspace) DOUBLE PRECISION array, dimension (LDA, max(NN)) */
00437 /*          The Schur form matrix computed from A by DGGES.  On exit, S */
00438 /*          contains the Schur form matrix corresponding to the matrix */
00439 /*          in A. */
00440 
00441 /*  T       (workspace) DOUBLE PRECISION array, dimension (LDA, max(NN)) */
00442 /*          The upper triangular matrix computed from B by DGGES. */
00443 
00444 /*  Q       (workspace) DOUBLE PRECISION array, dimension (LDQ, max(NN)) */
00445 /*          The (left) orthogonal matrix computed by DGGES. */
00446 
00447 /*  LDQ     (input) INTEGER */
00448 /*          The leading dimension of Q and Z. It must */
00449 /*          be at least 1 and at least max( NN ). */
00450 
00451 /*  Z       (workspace) DOUBLE PRECISION array, dimension( LDQ, max(NN) ) */
00452 /*          The (right) orthogonal matrix computed by DGGES. */
00453 
00454 /*  ALPHAR  (workspace) DOUBLE PRECISION array, dimension (max(NN)) */
00455 /*  ALPHAI  (workspace) DOUBLE PRECISION array, dimension (max(NN)) */
00456 /*  BETA    (workspace) DOUBLE PRECISION array, dimension (max(NN)) */
00457 /*          The generalized eigenvalues of (A,B) computed by DGGES. */
00458 /*          ( ALPHAR(k)+ALPHAI(k)*i ) / BETA(k) is the k-th */
00459 /*          generalized eigenvalue of A and B. */
00460 
00461 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (LWORK) */
00462 
00463 /*  LWORK   (input) INTEGER */
00464 /*          The dimension of the array WORK. */
00465 /*          LWORK >= MAX( 10*(N+1), 3*N*N ), where N is the largest */
00466 /*          matrix dimension. */
00467 
00468 /*  RESULT  (output) DOUBLE PRECISION array, dimension (15) */
00469 /*          The values computed by the tests described above. */
00470 /*          The values are currently limited to 1/ulp, to avoid overflow. */
00471 
00472 /*  BWORK   (workspace) LOGICAL array, dimension (N) */
00473 
00474 /*  INFO    (output) INTEGER */
00475 /*          = 0:  successful exit */
00476 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00477 /*          > 0:  A routine returned an error code.  INFO is the */
00478 /*                absolute value of the INFO value returned. */
00479 
00480 /*  ===================================================================== */
00481 
00482 /*     .. Parameters .. */
00483 /*     .. */
00484 /*     .. Local Scalars .. */
00485 /*     .. */
00486 /*     .. Local Arrays .. */
00487 /*     .. */
00488 /*     .. External Functions .. */
00489 /*     .. */
00490 /*     .. External Subroutines .. */
00491 /*     .. */
00492 /*     .. Intrinsic Functions .. */
00493 /*     .. */
00494 /*     .. Data statements .. */
00495     /* Parameter adjustments */
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     /* Function Body */
00525 /*     .. */
00526 /*     .. Executable Statements .. */
00527 
00528 /*     Check for errors */
00529 
00530     *info = 0;
00531 
00532     badnn = FALSE_;
00533     nmax = 1;
00534     i__1 = *nsizes;
00535     for (j = 1; j <= i__1; ++j) {
00536 /* Computing MAX */
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 /* L10: */
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 /*     Compute workspace */
00560 /*      (Note: Comments in the code beginning "Workspace:" describe the */
00561 /*       minimal amount of workspace needed at that point in the code, */
00562 /*       as well as the preferred amount for good performance. */
00563 /*       NB refers to the optimal block size for the immediately */
00564 /*       following subroutine, as returned by ILAENV. */
00565 
00566     minwrk = 1;
00567     if (*info == 0 && *lwork >= 1) {
00568 /* Computing MAX */
00569         i__1 = (nmax + 1) * 10, i__2 = nmax * 3 * nmax;
00570         minwrk = max(i__1,i__2);
00571 /* Computing MAX */
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 /* Computing MAX */
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 /*     Quick return if possible */
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 /*     The values RMAGN(2:3) depend on N, see below. */
00608 
00609     rmagn[0] = 0.;
00610     rmagn[1] = 1.;
00611 
00612 /*     Loop over matrix sizes */
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 /*        Loop over matrix types */
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 /*           Save ISEED in case of an error. */
00642 
00643             for (j = 1; j <= 4; ++j) {
00644                 ioldsd[j - 1] = iseed[j];
00645 /* L20: */
00646             }
00647 
00648 /*           Initialize RESULT */
00649 
00650             for (j = 1; j <= 13; ++j) {
00651                 result[j] = 0.;
00652 /* L30: */
00653             }
00654 
00655 /*           Generate test matrices A and B */
00656 
00657 /*           Description of control parameters: */
00658 
00659 /*           KZLASS: =1 means w/o rotation, =2 means w/ rotation, */
00660 /*                   =3 means random. */
00661 /*           KATYPE: the "type" to be passed to DLATM4 for computing A. */
00662 /*           KAZERO: the pattern of zeros on the diagonal for A: */
00663 /*                   =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ), */
00664 /*                   =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ), */
00665 /*                   =6: ( 0, 1, 0, xxx, 0 ).  (xxx means a string of */
00666 /*                   non-zero entries.) */
00667 /*           KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1), */
00668 /*                   =2: large, =3: small. */
00669 /*           IASIGN: 1 if the diagonal elements of A are to be */
00670 /*                   multiplied by a random magnitude 1 number, =2 if */
00671 /*                   randomly chosen diagonal blocks are to be rotated */
00672 /*                   to form 2x2 blocks. */
00673 /*           KBTYPE, KBZERO, KBMAGN, IBSIGN: the same, but for B. */
00674 /*           KTRIAN: =0: don't fill in the upper triangle, =1: do. */
00675 /*           KZ1, KZ2, KADD: used to implement KAZERO and KBZERO. */
00676 /*           RMAGN: used to implement KAMAGN and KBMAGN. */
00677 
00678             if (mtypes > 26) {
00679                 goto L110;
00680             }
00681             iinfo = 0;
00682             if (kclass[jtype - 1] < 3) {
00683 
00684 /*              Generate A (w/o rotation) */
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 /*              Generate B (w/o rotation) */
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 /*                 Include rotations */
00729 
00730 /*                 Generate Q, Z as Householder transformations times */
00731 /*                 a diagonal matrix. */
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 /* L40: */
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 /* L50: */
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 /*                 Apply the diagonal matrices */
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 /* L60: */
00775                         }
00776 /* L70: */
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 /*              Random matrices */
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 /* L80: */
00820                     }
00821 /* L90: */
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 /* L120: */
00845             }
00846 
00847 /*           Test with and without sorting of eigenvalues */
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 /*              Call DGGES to compute H, T, Q, Z, alpha, and beta. */
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 /*              Do tests 1--4 (or tests 7--9 when reordering ) */
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 /*              Do test 5 and 6 (or Tests 10 and 11 when reordering): */
00907 /*              check Schur form of A and compare eigenvalues with */
00908 /*              diagonals. */
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 /* Computing MAX */
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 /* Computing MAX */
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 /* L130: */
01000                 }
01001                 result[rsub + 6] = temp1;
01002 
01003                 if (isort >= 1) {
01004 
01005 /*                 Do test 12 */
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 /* L140: */
01030                     }
01031                     if (sdim != knteig) {
01032                         result[12] = ulpinv;
01033                     }
01034                 }
01035 
01036 /* L150: */
01037             }
01038 
01039 /*           End of Loop -- Check for RESULT(j) > THRESH */
01040 
01041 L160:
01042 
01043             ntestt += ntest;
01044 
01045 /*           Print out tests which fail. */
01046 
01047             i__3 = ntest;
01048             for (jr = 1; jr <= i__3; ++jr) {
01049                 if (result[jr] >= *thresh) {
01050 
01051 /*                 If this is the first test to fail, */
01052 /*                 print a header to the data file. */
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 /*                    Matrix types */
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 /*                    Tests performed */
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 /* L170: */
01114             }
01115 
01116 L180:
01117             ;
01118         }
01119 /* L190: */
01120     }
01121 
01122 /*     Summary */
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 /*     End of DDRGES */
01138 
01139 } /* ddrges_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:39