cdrges.c
Go to the documentation of this file.
00001 /* cdrges.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 complex c_b1 = {0.f,0.f};
00019 static integer c__1 = 1;
00020 static integer c_n1 = -1;
00021 static integer c__2 = 2;
00022 static real c_b29 = 1.f;
00023 static integer c__3 = 3;
00024 static integer c__4 = 4;
00025 static integer c__0 = 0;
00026 
00027 /* Subroutine */ int cdrges_(integer *nsizes, integer *nn, integer *ntypes, 
00028         logical *dotype, integer *iseed, real *thresh, integer *nounit, 
00029         complex *a, integer *lda, complex *b, complex *s, complex *t, complex 
00030         *q, integer *ldq, complex *z__, complex *alpha, complex *beta, 
00031         complex *work, integer *lwork, real *rwork, real *result, logical *
00032         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 logical lasign[26] = { FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00043             TRUE_,FALSE_,TRUE_,TRUE_,FALSE_,FALSE_,TRUE_,TRUE_,TRUE_,FALSE_,
00044             TRUE_,FALSE_,FALSE_,FALSE_,TRUE_,TRUE_,TRUE_,TRUE_,TRUE_,FALSE_ };
00045     static logical lbsign[26] = { FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00046             FALSE_,TRUE_,FALSE_,FALSE_,TRUE_,TRUE_,FALSE_,FALSE_,TRUE_,FALSE_,
00047             TRUE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00048             FALSE_ };
00049     static integer kz1[6] = { 0,1,2,1,3,3 };
00050     static integer kz2[6] = { 0,0,1,2,1,1 };
00051     static integer kadd[6] = { 0,0,0,0,3,2 };
00052     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,
00053             4,4,4,0 };
00054     static integer kbtype[26] = { 0,0,1,1,2,-3,1,4,1,1,4,4,1,1,-4,2,-4,8,8,8,
00055             8,8,8,8,8,0 };
00056     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,
00057             3,3,3,1 };
00058     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,
00059             4,4,4,1 };
00060     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,
00061             3,3,2,1 };
00062 
00063     /* Format strings */
00064     static char fmt_9999[] = "(\002 CDRGES: \002,a,\002 returned INFO=\002,i"
00065             "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, ISEED="
00066             "(\002,4(i4,\002,\002),i5,\002)\002)";
00067     static char fmt_9998[] = "(\002 CDRGES: 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_9997[] = "(/1x,a3,\002 -- Complex Generalized Schur from"
00071             " problem \002,\002driver\002)";
00072     static char fmt_9996[] = "(\002 Matrix types (see CDRGES for details):"
00073             " \002)";
00074     static char fmt_9995[] = "(\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_9994[] = "(\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_9993[] = "(/\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 n"
00106             "umber of \002,\002selected eigenvalues\002,/)";
00107     static char fmt_9992[] = "(\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_9991[] = "(\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,e10.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, i__5, i__6, i__7, i__8, i__9, i__10, i__11;
00118     real r__1, r__2, r__3, r__4, r__5, r__6, r__7, r__8, r__9, r__10, r__11, 
00119             r__12, r__13, r__14, r__15, r__16;
00120     complex q__1, q__2, q__3, q__4;
00121 
00122     /* Builtin functions */
00123     double r_sign(real *, real *), c_abs(complex *);
00124     void r_cnjg(complex *, complex *);
00125     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00126     double r_imag(complex *);
00127 
00128     /* Local variables */
00129     integer i__, j, n, n1, jc, nb, in, jr;
00130     real ulp;
00131     integer iadd, sdim, nmax, rsub;
00132     char sort[1];
00133     real temp1, temp2;
00134     logical badnn;
00135     extern /* Subroutine */ int cget51_(integer *, integer *, complex *, 
00136             integer *, complex *, integer *, complex *, integer *, complex *, 
00137             integer *, complex *, real *, real *), cgges_(char *, char *, 
00138             char *, L_fp, integer *, complex *, integer *, complex *, integer 
00139             *, integer *, complex *, complex *, complex *, integer *, complex 
00140             *, integer *, complex *, integer *, real *, logical *, integer *), cget54_(integer *, complex *, integer *, 
00141             complex *, integer *, complex *, integer *, complex *, integer *, 
00142             complex *, integer *, complex *, integer *, complex *, real *);
00143     integer iinfo;
00144     real rmagn[4];
00145     complex ctemp;
00146     integer nmats, jsize, nerrs, jtype, ntest, isort;
00147     extern /* Subroutine */ int clatm4_(integer *, integer *, integer *, 
00148             integer *, logical *, real *, real *, real *, integer *, integer *
00149 , complex *, integer *), cunm2r_(char *, char *, integer *, 
00150             integer *, integer *, complex *, integer *, complex *, complex *, 
00151             integer *, complex *, integer *);
00152     logical ilabad;
00153     extern /* Subroutine */ int slabad_(real *, real *), clarfg_(integer *, 
00154             complex *, complex *, integer *, complex *);
00155     extern /* Complex */ VOID clarnd_(complex *, integer *, integer *);
00156     extern doublereal slamch_(char *);
00157     extern /* Subroutine */ int clacpy_(char *, integer *, integer *, complex 
00158             *, integer *, complex *, integer *), claset_(char *, 
00159             integer *, integer *, complex *, complex *, complex *, integer *);
00160     real safmin, safmax;
00161     integer knteig, ioldsd[4];
00162     extern logical clctes_(complex *, complex *);
00163     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00164             integer *, integer *);
00165     extern /* Subroutine */ int alasvm_(char *, integer *, integer *, integer 
00166             *, integer *), xerbla_(char *, integer *);
00167     integer minwrk, maxwrk;
00168     real ulpinv;
00169     integer mtypes, ntestt;
00170 
00171     /* Fortran I/O blocks */
00172     static cilist io___41 = { 0, 0, 0, fmt_9999, 0 };
00173     static cilist io___47 = { 0, 0, 0, fmt_9999, 0 };
00174     static cilist io___51 = { 0, 0, 0, fmt_9998, 0 };
00175     static cilist io___53 = { 0, 0, 0, fmt_9997, 0 };
00176     static cilist io___54 = { 0, 0, 0, fmt_9996, 0 };
00177     static cilist io___55 = { 0, 0, 0, fmt_9995, 0 };
00178     static cilist io___56 = { 0, 0, 0, fmt_9994, 0 };
00179     static cilist io___57 = { 0, 0, 0, fmt_9993, 0 };
00180     static cilist io___58 = { 0, 0, 0, fmt_9992, 0 };
00181     static cilist io___59 = { 0, 0, 0, fmt_9991, 0 };
00182 
00183 
00184 
00185 /*  -- LAPACK test routine (version 3.1.1) -- */
00186 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00187 /*     February 2007 */
00188 
00189 /*     .. Scalar Arguments .. */
00190 /*     .. */
00191 /*     .. Array Arguments .. */
00192 /*     .. */
00193 
00194 /*  Purpose */
00195 /*  ======= */
00196 
00197 /*  CDRGES checks the nonsymmetric generalized eigenvalue (Schur form) */
00198 /*  problem driver CGGES. */
00199 
00200 /*  CGGES factors A and B as Q*S*Z'  and Q*T*Z' , where ' means conjugate */
00201 /*  transpose, S and T are  upper triangular (i.e., in generalized Schur */
00202 /*  form), and Q and Z are unitary. It also computes the generalized */
00203 /*  eigenvalues (alpha(j),beta(j)), j=1,...,n.  Thus, */
00204 /*  w(j) = alpha(j)/beta(j) is a root of the characteristic equation */
00205 
00206 /*                  det( A - w(j) B ) = 0 */
00207 
00208 /*  Optionally it also reorder the eigenvalues so that a selected */
00209 /*  cluster of eigenvalues appears in the leading diagonal block of the */
00210 /*  Schur forms. */
00211 
00212 /*  When CDRGES is called, a number of matrix "sizes" ("N's") and a */
00213 /*  number of matrix "TYPES" are specified.  For each size ("N") */
00214 /*  and each TYPE of matrix, a pair of matrices (A, B) will be generated */
00215 /*  and used for testing. For each matrix pair, the following 13 tests */
00216 /*  will be performed and compared with the threshhold THRESH except */
00217 /*  the tests (5), (11) and (13). */
00218 
00219 
00220 /*  (1)   | A - Q S Z' | / ( |A| n ulp ) (no sorting of eigenvalues) */
00221 
00222 
00223 /*  (2)   | B - Q T Z' | / ( |B| n ulp ) (no sorting of eigenvalues) */
00224 
00225 
00226 /*  (3)   | I - QQ' | / ( n ulp ) (no sorting of eigenvalues) */
00227 
00228 
00229 /*  (4)   | I - ZZ' | / ( n ulp ) (no sorting of eigenvalues) */
00230 
00231 /*  (5)   if A is in Schur form (i.e. triangular form) (no sorting of */
00232 /*        eigenvalues) */
00233 
00234 /*  (6)   if eigenvalues = diagonal elements of the Schur form (S, T), */
00235 /*        i.e., test the maximum over j of D(j)  where: */
00236 
00237 /*                      |alpha(j) - S(j,j)|        |beta(j) - T(j,j)| */
00238 /*            D(j) = ------------------------ + ----------------------- */
00239 /*                   max(|alpha(j)|,|S(j,j)|)   max(|beta(j)|,|T(j,j)|) */
00240 
00241 /*        (no sorting of eigenvalues) */
00242 
00243 /*  (7)   | (A,B) - Q (S,T) Z' | / ( |(A,B)| n ulp ) */
00244 /*        (with sorting of eigenvalues). */
00245 
00246 /*  (8)   | I - QQ' | / ( n ulp ) (with sorting of eigenvalues). */
00247 
00248 /*  (9)   | I - ZZ' | / ( n ulp ) (with sorting of eigenvalues). */
00249 
00250 /*  (10)  if A is in Schur form (i.e. quasi-triangular form) */
00251 /*        (with sorting of eigenvalues). */
00252 
00253 /*  (11)  if eigenvalues = diagonal elements of the Schur form (S, T), */
00254 /*        i.e. test the maximum over j of D(j)  where: */
00255 
00256 /*                      |alpha(j) - S(j,j)|        |beta(j) - T(j,j)| */
00257 /*            D(j) = ------------------------ + ----------------------- */
00258 /*                   max(|alpha(j)|,|S(j,j)|)   max(|beta(j)|,|T(j,j)|) */
00259 
00260 /*        (with sorting of eigenvalues). */
00261 
00262 /*  (12)  if sorting worked and SDIM is the number of eigenvalues */
00263 /*        which were CELECTed. */
00264 
00265 /*  Test Matrices */
00266 /*  ============= */
00267 
00268 /*  The sizes of the test matrices are specified by an array */
00269 /*  NN(1:NSIZES); the value of each element NN(j) specifies one size. */
00270 /*  The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if */
00271 /*  DOTYPE(j) is .TRUE., then matrix type "j" will be generated. */
00272 /*  Currently, the list of possible types is: */
00273 
00274 /*  (1)  ( 0, 0 )         (a pair of zero matrices) */
00275 
00276 /*  (2)  ( I, 0 )         (an identity and a zero matrix) */
00277 
00278 /*  (3)  ( 0, I )         (an identity and a zero matrix) */
00279 
00280 /*  (4)  ( I, I )         (a pair of identity matrices) */
00281 
00282 /*          t   t */
00283 /*  (5)  ( J , J  )       (a pair of transposed Jordan blocks) */
00284 
00285 /*                                      t                ( I   0  ) */
00286 /*  (6)  ( X, Y )         where  X = ( J   0  )  and Y = (      t ) */
00287 /*                                   ( 0   I  )          ( 0   J  ) */
00288 /*                        and I is a k x k identity and J a (k+1)x(k+1) */
00289 /*                        Jordan block; k=(N-1)/2 */
00290 
00291 /*  (7)  ( D, I )         where D is diag( 0, 1,..., N-1 ) (a diagonal */
00292 /*                        matrix with those diagonal entries.) */
00293 /*  (8)  ( I, D ) */
00294 
00295 /*  (9)  ( big*D, small*I ) where "big" is near overflow and small=1/big */
00296 
00297 /*  (10) ( small*D, big*I ) */
00298 
00299 /*  (11) ( big*I, small*D ) */
00300 
00301 /*  (12) ( small*I, big*D ) */
00302 
00303 /*  (13) ( big*D, big*I ) */
00304 
00305 /*  (14) ( small*D, small*I ) */
00306 
00307 /*  (15) ( D1, D2 )        where D1 is diag( 0, 0, 1, ..., N-3, 0 ) and */
00308 /*                         D2 is diag( 0, N-3, N-4,..., 1, 0, 0 ) */
00309 /*            t   t */
00310 /*  (16) Q ( J , J ) Z     where Q and Z are random orthogonal matrices. */
00311 
00312 /*  (17) Q ( T1, T2 ) Z    where T1 and T2 are upper triangular matrices */
00313 /*                         with random O(1) entries above the diagonal */
00314 /*                         and diagonal entries diag(T1) = */
00315 /*                         ( 0, 0, 1, ..., N-3, 0 ) and diag(T2) = */
00316 /*                         ( 0, N-3, N-4,..., 1, 0, 0 ) */
00317 
00318 /*  (18) Q ( T1, T2 ) Z    diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 ) */
00319 /*                         diag(T2) = ( 0, 1, 0, 1,..., 1, 0 ) */
00320 /*                         s = machine precision. */
00321 
00322 /*  (19) Q ( T1, T2 ) Z    diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 ) */
00323 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 ) */
00324 
00325 /*                                                         N-5 */
00326 /*  (20) Q ( T1, T2 ) Z    diag(T1)=( 0, 0, 1, 1, a, ..., a   =s, 0 ) */
00327 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) */
00328 
00329 /*  (21) Q ( T1, T2 ) Z    diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 ) */
00330 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) */
00331 /*                         where r1,..., r(N-4) are random. */
00332 
00333 /*  (22) Q ( big*T1, small*T2 ) Z    diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00334 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00335 
00336 /*  (23) Q ( small*T1, big*T2 ) Z    diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00337 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00338 
00339 /*  (24) Q ( small*T1, small*T2 ) Z  diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00340 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00341 
00342 /*  (25) Q ( big*T1, big*T2 ) Z      diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00343 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00344 
00345 /*  (26) Q ( T1, T2 ) Z     where T1 and T2 are random upper-triangular */
00346 /*                          matrices. */
00347 
00348 
00349 /*  Arguments */
00350 /*  ========= */
00351 
00352 /*  NSIZES  (input) INTEGER */
00353 /*          The number of sizes of matrices to use.  If it is zero, */
00354 /*          SDRGES does nothing.  NSIZES >= 0. */
00355 
00356 /*  NN      (input) INTEGER array, dimension (NSIZES) */
00357 /*          An array containing the sizes to be used for the matrices. */
00358 /*          Zero values will be skipped.  NN >= 0. */
00359 
00360 /*  NTYPES  (input) INTEGER */
00361 /*          The number of elements in DOTYPE.   If it is zero, SDRGES */
00362 /*          does nothing.  It must be at least zero.  If it is MAXTYP+1 */
00363 /*          and NSIZES is 1, then an additional type, MAXTYP+1 is */
00364 /*          defined, which is to use whatever matrix is in A on input. */
00365 /*          This is only useful if DOTYPE(1:MAXTYP) is .FALSE. and */
00366 /*          DOTYPE(MAXTYP+1) is .TRUE. . */
00367 
00368 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00369 /*          If DOTYPE(j) is .TRUE., then for each size in NN a */
00370 /*          matrix of that size and of type j will be generated. */
00371 /*          If NTYPES is smaller than the maximum number of types */
00372 /*          defined (PARAMETER MAXTYP), then types NTYPES+1 through */
00373 /*          MAXTYP will not be generated. If NTYPES is larger */
00374 /*          than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) */
00375 /*          will be ignored. */
00376 
00377 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00378 /*          On entry ISEED specifies the seed of the random number */
00379 /*          generator. The array elements should be between 0 and 4095; */
00380 /*          if not they will be reduced mod 4096. Also, ISEED(4) must */
00381 /*          be odd.  The random number generator uses a linear */
00382 /*          congruential sequence limited to small integers, and so */
00383 /*          should produce machine independent random numbers. The */
00384 /*          values of ISEED are changed on exit, and can be used in the */
00385 /*          next call to SDRGES to continue the same random number */
00386 /*          sequence. */
00387 
00388 /*  THRESH  (input) REAL */
00389 /*          A test will count as "failed" if the "error", computed as */
00390 /*          described above, exceeds THRESH.  Note that the error is */
00391 /*          scaled to be O(1), so THRESH should be a reasonably small */
00392 /*          multiple of 1, e.g., 10 or 100.  In particular, it should */
00393 /*          not depend on the precision (single vs. double) or the size */
00394 /*          of the matrix.  THRESH >= 0. */
00395 
00396 /*  NOUNIT  (input) INTEGER */
00397 /*          The FORTRAN unit number for printing out error messages */
00398 /*          (e.g., if a routine returns IINFO not equal to 0.) */
00399 
00400 /*  A       (input/workspace) COMPLEX array, dimension(LDA, max(NN)) */
00401 /*          Used to hold the original A matrix.  Used as input only */
00402 /*          if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and */
00403 /*          DOTYPE(MAXTYP+1)=.TRUE. */
00404 
00405 /*  LDA     (input) INTEGER */
00406 /*          The leading dimension of A, B, S, and T. */
00407 /*          It must be at least 1 and at least max( NN ). */
00408 
00409 /*  B       (input/workspace) COMPLEX array, dimension(LDA, max(NN)) */
00410 /*          Used to hold the original B matrix.  Used as input only */
00411 /*          if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and */
00412 /*          DOTYPE(MAXTYP+1)=.TRUE. */
00413 
00414 /*  S       (workspace) COMPLEX array, dimension (LDA, max(NN)) */
00415 /*          The Schur form matrix computed from A by CGGES.  On exit, S */
00416 /*          contains the Schur form matrix corresponding to the matrix */
00417 /*          in A. */
00418 
00419 /*  T       (workspace) COMPLEX array, dimension (LDA, max(NN)) */
00420 /*          The upper triangular matrix computed from B by CGGES. */
00421 
00422 /*  Q       (workspace) COMPLEX array, dimension (LDQ, max(NN)) */
00423 /*          The (left) orthogonal matrix computed by CGGES. */
00424 
00425 /*  LDQ     (input) INTEGER */
00426 /*          The leading dimension of Q and Z. It must */
00427 /*          be at least 1 and at least max( NN ). */
00428 
00429 /*  Z       (workspace) COMPLEX array, dimension( LDQ, max(NN) ) */
00430 /*          The (right) orthogonal matrix computed by CGGES. */
00431 
00432 /*  ALPHA   (workspace) COMPLEX array, dimension (max(NN)) */
00433 /*  BETA    (workspace) COMPLEX array, dimension (max(NN)) */
00434 /*          The generalized eigenvalues of (A,B) computed by CGGES. */
00435 /*          ALPHA(k) / BETA(k) is the k-th generalized eigenvalue of A */
00436 /*          and B. */
00437 
00438 /*  WORK    (workspace) COMPLEX array, dimension (LWORK) */
00439 
00440 /*  LWORK   (input) INTEGER */
00441 /*          The dimension of the array WORK.  LWORK >= 3*N*N. */
00442 
00443 /*  RWORK   (workspace) REAL array, dimension ( 8*N ) */
00444 /*          Real workspace. */
00445 
00446 /*  RESULT  (output) REAL array, dimension (15) */
00447 /*          The values computed by the tests described above. */
00448 /*          The values are currently limited to 1/ulp, to avoid overflow. */
00449 
00450 /*  BWORK   (workspace) LOGICAL array, dimension (N) */
00451 
00452 /*  INFO    (output) INTEGER */
00453 /*          = 0:  successful exit */
00454 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00455 /*          > 0:  A routine returned an error code.  INFO is the */
00456 /*                absolute value of the INFO value returned. */
00457 
00458 /*  ===================================================================== */
00459 
00460 /*     .. Parameters .. */
00461 /*     .. */
00462 /*     .. Local Scalars .. */
00463 /*     .. */
00464 /*     .. Local Arrays .. */
00465 /*     .. */
00466 /*     .. External Functions .. */
00467 /*     .. */
00468 /*     .. External Subroutines .. */
00469 /*     .. */
00470 /*     .. Intrinsic Functions .. */
00471 /*     .. */
00472 /*     .. Statement Functions .. */
00473 /*     .. */
00474 /*     .. Statement Function definitions .. */
00475 /*     .. */
00476 /*     .. Data statements .. */
00477     /* Parameter adjustments */
00478     --nn;
00479     --dotype;
00480     --iseed;
00481     t_dim1 = *lda;
00482     t_offset = 1 + t_dim1;
00483     t -= t_offset;
00484     s_dim1 = *lda;
00485     s_offset = 1 + s_dim1;
00486     s -= s_offset;
00487     b_dim1 = *lda;
00488     b_offset = 1 + b_dim1;
00489     b -= b_offset;
00490     a_dim1 = *lda;
00491     a_offset = 1 + a_dim1;
00492     a -= a_offset;
00493     z_dim1 = *ldq;
00494     z_offset = 1 + z_dim1;
00495     z__ -= z_offset;
00496     q_dim1 = *ldq;
00497     q_offset = 1 + q_dim1;
00498     q -= q_offset;
00499     --alpha;
00500     --beta;
00501     --work;
00502     --rwork;
00503     --result;
00504     --bwork;
00505 
00506     /* Function Body */
00507 /*     .. */
00508 /*     .. Executable Statements .. */
00509 
00510 /*     Check for errors */
00511 
00512     *info = 0;
00513 
00514     badnn = FALSE_;
00515     nmax = 1;
00516     i__1 = *nsizes;
00517     for (j = 1; j <= i__1; ++j) {
00518 /* Computing MAX */
00519         i__2 = nmax, i__3 = nn[j];
00520         nmax = max(i__2,i__3);
00521         if (nn[j] < 0) {
00522             badnn = TRUE_;
00523         }
00524 /* L10: */
00525     }
00526 
00527     if (*nsizes < 0) {
00528         *info = -1;
00529     } else if (badnn) {
00530         *info = -2;
00531     } else if (*ntypes < 0) {
00532         *info = -3;
00533     } else if (*thresh < 0.f) {
00534         *info = -6;
00535     } else if (*lda <= 1 || *lda < nmax) {
00536         *info = -9;
00537     } else if (*ldq <= 1 || *ldq < nmax) {
00538         *info = -14;
00539     }
00540 
00541 /*     Compute workspace */
00542 /*      (Note: Comments in the code beginning "Workspace:" describe the */
00543 /*       minimal amount of workspace needed at that point in the code, */
00544 /*       as well as the preferred amount for good performance. */
00545 /*       NB refers to the optimal block size for the immediately */
00546 /*       following subroutine, as returned by ILAENV. */
00547 
00548     minwrk = 1;
00549     if (*info == 0 && *lwork >= 1) {
00550         minwrk = nmax * 3 * nmax;
00551 /* Computing MAX */
00552         i__1 = 1, i__2 = ilaenv_(&c__1, "CGEQRF", " ", &nmax, &nmax, &c_n1, &
00553                 c_n1), i__1 = max(i__1,i__2), i__2 = 
00554                 ilaenv_(&c__1, "CUNMQR", "LC", &nmax, &nmax, &nmax, &c_n1), i__1 = max(i__1,i__2), i__2 = ilaenv_(&
00555                 c__1, "CUNGQR", " ", &nmax, &nmax, &nmax, &c_n1);
00556         nb = max(i__1,i__2);
00557 /* Computing MAX */
00558         i__1 = nmax + nmax * nb, i__2 = nmax * 3 * nmax;
00559         maxwrk = max(i__1,i__2);
00560         work[1].r = (real) maxwrk, work[1].i = 0.f;
00561     }
00562 
00563     if (*lwork < minwrk) {
00564         *info = -19;
00565     }
00566 
00567     if (*info != 0) {
00568         i__1 = -(*info);
00569         xerbla_("CDRGES", &i__1);
00570         return 0;
00571     }
00572 
00573 /*     Quick return if possible */
00574 
00575     if (*nsizes == 0 || *ntypes == 0) {
00576         return 0;
00577     }
00578 
00579     ulp = slamch_("Precision");
00580     safmin = slamch_("Safe minimum");
00581     safmin /= ulp;
00582     safmax = 1.f / safmin;
00583     slabad_(&safmin, &safmax);
00584     ulpinv = 1.f / ulp;
00585 
00586 /*     The values RMAGN(2:3) depend on N, see below. */
00587 
00588     rmagn[0] = 0.f;
00589     rmagn[1] = 1.f;
00590 
00591 /*     Loop over matrix sizes */
00592 
00593     ntestt = 0;
00594     nerrs = 0;
00595     nmats = 0;
00596 
00597     i__1 = *nsizes;
00598     for (jsize = 1; jsize <= i__1; ++jsize) {
00599         n = nn[jsize];
00600         n1 = max(1,n);
00601         rmagn[2] = safmax * ulp / (real) n1;
00602         rmagn[3] = safmin * ulpinv * (real) n1;
00603 
00604         if (*nsizes != 1) {
00605             mtypes = min(26,*ntypes);
00606         } else {
00607             mtypes = min(27,*ntypes);
00608         }
00609 
00610 /*        Loop over matrix types */
00611 
00612         i__2 = mtypes;
00613         for (jtype = 1; jtype <= i__2; ++jtype) {
00614             if (! dotype[jtype]) {
00615                 goto L180;
00616             }
00617             ++nmats;
00618             ntest = 0;
00619 
00620 /*           Save ISEED in case of an error. */
00621 
00622             for (j = 1; j <= 4; ++j) {
00623                 ioldsd[j - 1] = iseed[j];
00624 /* L20: */
00625             }
00626 
00627 /*           Initialize RESULT */
00628 
00629             for (j = 1; j <= 13; ++j) {
00630                 result[j] = 0.f;
00631 /* L30: */
00632             }
00633 
00634 /*           Generate test matrices A and B */
00635 
00636 /*           Description of control parameters: */
00637 
00638 /*           KCLASS: =1 means w/o rotation, =2 means w/ rotation, */
00639 /*                   =3 means random. */
00640 /*           KATYPE: the "type" to be passed to CLATM4 for computing A. */
00641 /*           KAZERO: the pattern of zeros on the diagonal for A: */
00642 /*                   =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ), */
00643 /*                   =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ), */
00644 /*                   =6: ( 0, 1, 0, xxx, 0 ).  (xxx means a string of */
00645 /*                   non-zero entries.) */
00646 /*           KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1), */
00647 /*                   =2: large, =3: small. */
00648 /*           LASIGN: .TRUE. if the diagonal elements of A are to be */
00649 /*                   multiplied by a random magnitude 1 number. */
00650 /*           KBTYPE, KBZERO, KBMAGN, LBSIGN: the same, but for B. */
00651 /*           KTRIAN: =0: don't fill in the upper triangle, =1: do. */
00652 /*           KZ1, KZ2, KADD: used to implement KAZERO and KBZERO. */
00653 /*           RMAGN: used to implement KAMAGN and KBMAGN. */
00654 
00655             if (mtypes > 26) {
00656                 goto L110;
00657             }
00658             iinfo = 0;
00659             if (kclass[jtype - 1] < 3) {
00660 
00661 /*              Generate A (w/o rotation) */
00662 
00663                 if ((i__3 = katype[jtype - 1], abs(i__3)) == 3) {
00664                     in = ((n - 1) / 2 << 1) + 1;
00665                     if (in != n) {
00666                         claset_("Full", &n, &n, &c_b1, &c_b1, &a[a_offset], 
00667                                 lda);
00668                     }
00669                 } else {
00670                     in = n;
00671                 }
00672                 clatm4_(&katype[jtype - 1], &in, &kz1[kazero[jtype - 1] - 1], 
00673                         &kz2[kazero[jtype - 1] - 1], &lasign[jtype - 1], &
00674                         rmagn[kamagn[jtype - 1]], &ulp, &rmagn[ktrian[jtype - 
00675                         1] * kamagn[jtype - 1]], &c__2, &iseed[1], &a[
00676                         a_offset], lda);
00677                 iadd = kadd[kazero[jtype - 1] - 1];
00678                 if (iadd > 0 && iadd <= n) {
00679                     i__3 = iadd + iadd * a_dim1;
00680                     i__4 = kamagn[jtype - 1];
00681                     a[i__3].r = rmagn[i__4], a[i__3].i = 0.f;
00682                 }
00683 
00684 /*              Generate B (w/o rotation) */
00685 
00686                 if ((i__3 = kbtype[jtype - 1], abs(i__3)) == 3) {
00687                     in = ((n - 1) / 2 << 1) + 1;
00688                     if (in != n) {
00689                         claset_("Full", &n, &n, &c_b1, &c_b1, &b[b_offset], 
00690                                 lda);
00691                     }
00692                 } else {
00693                     in = n;
00694                 }
00695                 clatm4_(&kbtype[jtype - 1], &in, &kz1[kbzero[jtype - 1] - 1], 
00696                         &kz2[kbzero[jtype - 1] - 1], &lbsign[jtype - 1], &
00697                         rmagn[kbmagn[jtype - 1]], &c_b29, &rmagn[ktrian[jtype 
00698                         - 1] * kbmagn[jtype - 1]], &c__2, &iseed[1], &b[
00699                         b_offset], lda);
00700                 iadd = kadd[kbzero[jtype - 1] - 1];
00701                 if (iadd != 0 && iadd <= n) {
00702                     i__3 = iadd + iadd * b_dim1;
00703                     i__4 = kbmagn[jtype - 1];
00704                     b[i__3].r = rmagn[i__4], b[i__3].i = 0.f;
00705                 }
00706 
00707                 if (kclass[jtype - 1] == 2 && n > 0) {
00708 
00709 /*                 Include rotations */
00710 
00711 /*                 Generate Q, Z as Householder transformations times */
00712 /*                 a diagonal matrix. */
00713 
00714                     i__3 = n - 1;
00715                     for (jc = 1; jc <= i__3; ++jc) {
00716                         i__4 = n;
00717                         for (jr = jc; jr <= i__4; ++jr) {
00718                             i__5 = jr + jc * q_dim1;
00719                             clarnd_(&q__1, &c__3, &iseed[1]);
00720                             q[i__5].r = q__1.r, q[i__5].i = q__1.i;
00721                             i__5 = jr + jc * z_dim1;
00722                             clarnd_(&q__1, &c__3, &iseed[1]);
00723                             z__[i__5].r = q__1.r, z__[i__5].i = q__1.i;
00724 /* L40: */
00725                         }
00726                         i__4 = n + 1 - jc;
00727                         clarfg_(&i__4, &q[jc + jc * q_dim1], &q[jc + 1 + jc * 
00728                                 q_dim1], &c__1, &work[jc]);
00729                         i__4 = (n << 1) + jc;
00730                         i__5 = jc + jc * q_dim1;
00731                         r__2 = q[i__5].r;
00732                         r__1 = r_sign(&c_b29, &r__2);
00733                         work[i__4].r = r__1, work[i__4].i = 0.f;
00734                         i__4 = jc + jc * q_dim1;
00735                         q[i__4].r = 1.f, q[i__4].i = 0.f;
00736                         i__4 = n + 1 - jc;
00737                         clarfg_(&i__4, &z__[jc + jc * z_dim1], &z__[jc + 1 + 
00738                                 jc * z_dim1], &c__1, &work[n + jc]);
00739                         i__4 = n * 3 + jc;
00740                         i__5 = jc + jc * z_dim1;
00741                         r__2 = z__[i__5].r;
00742                         r__1 = r_sign(&c_b29, &r__2);
00743                         work[i__4].r = r__1, work[i__4].i = 0.f;
00744                         i__4 = jc + jc * z_dim1;
00745                         z__[i__4].r = 1.f, z__[i__4].i = 0.f;
00746 /* L50: */
00747                     }
00748                     clarnd_(&q__1, &c__3, &iseed[1]);
00749                     ctemp.r = q__1.r, ctemp.i = q__1.i;
00750                     i__3 = n + n * q_dim1;
00751                     q[i__3].r = 1.f, q[i__3].i = 0.f;
00752                     i__3 = n;
00753                     work[i__3].r = 0.f, work[i__3].i = 0.f;
00754                     i__3 = n * 3;
00755                     r__1 = c_abs(&ctemp);
00756                     q__1.r = ctemp.r / r__1, q__1.i = ctemp.i / r__1;
00757                     work[i__3].r = q__1.r, work[i__3].i = q__1.i;
00758                     clarnd_(&q__1, &c__3, &iseed[1]);
00759                     ctemp.r = q__1.r, ctemp.i = q__1.i;
00760                     i__3 = n + n * z_dim1;
00761                     z__[i__3].r = 1.f, z__[i__3].i = 0.f;
00762                     i__3 = n << 1;
00763                     work[i__3].r = 0.f, work[i__3].i = 0.f;
00764                     i__3 = n << 2;
00765                     r__1 = c_abs(&ctemp);
00766                     q__1.r = ctemp.r / r__1, q__1.i = ctemp.i / r__1;
00767                     work[i__3].r = q__1.r, work[i__3].i = q__1.i;
00768 
00769 /*                 Apply the diagonal matrices */
00770 
00771                     i__3 = n;
00772                     for (jc = 1; jc <= i__3; ++jc) {
00773                         i__4 = n;
00774                         for (jr = 1; jr <= i__4; ++jr) {
00775                             i__5 = jr + jc * a_dim1;
00776                             i__6 = (n << 1) + jr;
00777                             r_cnjg(&q__3, &work[n * 3 + jc]);
00778                             q__2.r = work[i__6].r * q__3.r - work[i__6].i * 
00779                                     q__3.i, q__2.i = work[i__6].r * q__3.i + 
00780                                     work[i__6].i * q__3.r;
00781                             i__7 = jr + jc * a_dim1;
00782                             q__1.r = q__2.r * a[i__7].r - q__2.i * a[i__7].i, 
00783                                     q__1.i = q__2.r * a[i__7].i + q__2.i * a[
00784                                     i__7].r;
00785                             a[i__5].r = q__1.r, a[i__5].i = q__1.i;
00786                             i__5 = jr + jc * b_dim1;
00787                             i__6 = (n << 1) + jr;
00788                             r_cnjg(&q__3, &work[n * 3 + jc]);
00789                             q__2.r = work[i__6].r * q__3.r - work[i__6].i * 
00790                                     q__3.i, q__2.i = work[i__6].r * q__3.i + 
00791                                     work[i__6].i * q__3.r;
00792                             i__7 = jr + jc * b_dim1;
00793                             q__1.r = q__2.r * b[i__7].r - q__2.i * b[i__7].i, 
00794                                     q__1.i = q__2.r * b[i__7].i + q__2.i * b[
00795                                     i__7].r;
00796                             b[i__5].r = q__1.r, b[i__5].i = q__1.i;
00797 /* L60: */
00798                         }
00799 /* L70: */
00800                     }
00801                     i__3 = n - 1;
00802                     cunm2r_("L", "N", &n, &n, &i__3, &q[q_offset], ldq, &work[
00803                             1], &a[a_offset], lda, &work[(n << 1) + 1], &
00804                             iinfo);
00805                     if (iinfo != 0) {
00806                         goto L100;
00807                     }
00808                     i__3 = n - 1;
00809                     cunm2r_("R", "C", &n, &n, &i__3, &z__[z_offset], ldq, &
00810                             work[n + 1], &a[a_offset], lda, &work[(n << 1) + 
00811                             1], &iinfo);
00812                     if (iinfo != 0) {
00813                         goto L100;
00814                     }
00815                     i__3 = n - 1;
00816                     cunm2r_("L", "N", &n, &n, &i__3, &q[q_offset], ldq, &work[
00817                             1], &b[b_offset], lda, &work[(n << 1) + 1], &
00818                             iinfo);
00819                     if (iinfo != 0) {
00820                         goto L100;
00821                     }
00822                     i__3 = n - 1;
00823                     cunm2r_("R", "C", &n, &n, &i__3, &z__[z_offset], ldq, &
00824                             work[n + 1], &b[b_offset], lda, &work[(n << 1) + 
00825                             1], &iinfo);
00826                     if (iinfo != 0) {
00827                         goto L100;
00828                     }
00829                 }
00830             } else {
00831 
00832 /*              Random matrices */
00833 
00834                 i__3 = n;
00835                 for (jc = 1; jc <= i__3; ++jc) {
00836                     i__4 = n;
00837                     for (jr = 1; jr <= i__4; ++jr) {
00838                         i__5 = jr + jc * a_dim1;
00839                         i__6 = kamagn[jtype - 1];
00840                         clarnd_(&q__2, &c__4, &iseed[1]);
00841                         q__1.r = rmagn[i__6] * q__2.r, q__1.i = rmagn[i__6] * 
00842                                 q__2.i;
00843                         a[i__5].r = q__1.r, a[i__5].i = q__1.i;
00844                         i__5 = jr + jc * b_dim1;
00845                         i__6 = kbmagn[jtype - 1];
00846                         clarnd_(&q__2, &c__4, &iseed[1]);
00847                         q__1.r = rmagn[i__6] * q__2.r, q__1.i = rmagn[i__6] * 
00848                                 q__2.i;
00849                         b[i__5].r = q__1.r, b[i__5].i = q__1.i;
00850 /* L80: */
00851                     }
00852 /* L90: */
00853                 }
00854             }
00855 
00856 L100:
00857 
00858             if (iinfo != 0) {
00859                 io___41.ciunit = *nounit;
00860                 s_wsfe(&io___41);
00861                 do_fio(&c__1, "Generator", (ftnlen)9);
00862                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00863                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00864                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00865                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00866                 e_wsfe();
00867                 *info = abs(iinfo);
00868                 return 0;
00869             }
00870 
00871 L110:
00872 
00873             for (i__ = 1; i__ <= 13; ++i__) {
00874                 result[i__] = -1.f;
00875 /* L120: */
00876             }
00877 
00878 /*           Test with and without sorting of eigenvalues */
00879 
00880             for (isort = 0; isort <= 1; ++isort) {
00881                 if (isort == 0) {
00882                     *(unsigned char *)sort = 'N';
00883                     rsub = 0;
00884                 } else {
00885                     *(unsigned char *)sort = 'S';
00886                     rsub = 5;
00887                 }
00888 
00889 /*              Call CGGES to compute H, T, Q, Z, alpha, and beta. */
00890 
00891                 clacpy_("Full", &n, &n, &a[a_offset], lda, &s[s_offset], lda);
00892                 clacpy_("Full", &n, &n, &b[b_offset], lda, &t[t_offset], lda);
00893                 ntest = rsub + 1 + isort;
00894                 result[rsub + 1 + isort] = ulpinv;
00895                 cgges_("V", "V", sort, (L_fp)clctes_, &n, &s[s_offset], lda, &
00896                         t[t_offset], lda, &sdim, &alpha[1], &beta[1], &q[
00897                         q_offset], ldq, &z__[z_offset], ldq, &work[1], lwork, 
00898                         &rwork[1], &bwork[1], &iinfo);
00899                 if (iinfo != 0 && iinfo != n + 2) {
00900                     result[rsub + 1 + isort] = ulpinv;
00901                     io___47.ciunit = *nounit;
00902                     s_wsfe(&io___47);
00903                     do_fio(&c__1, "CGGES", (ftnlen)5);
00904                     do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00905                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00906                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00907                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00908                             ;
00909                     e_wsfe();
00910                     *info = abs(iinfo);
00911                     goto L160;
00912                 }
00913 
00914                 ntest = rsub + 4;
00915 
00916 /*              Do tests 1--4 (or tests 7--9 when reordering ) */
00917 
00918                 if (isort == 0) {
00919                     cget51_(&c__1, &n, &a[a_offset], lda, &s[s_offset], lda, &
00920                             q[q_offset], ldq, &z__[z_offset], ldq, &work[1], &
00921                             rwork[1], &result[1]);
00922                     cget51_(&c__1, &n, &b[b_offset], lda, &t[t_offset], lda, &
00923                             q[q_offset], ldq, &z__[z_offset], ldq, &work[1], &
00924                             rwork[1], &result[2]);
00925                 } else {
00926                     cget54_(&n, &a[a_offset], lda, &b[b_offset], lda, &s[
00927                             s_offset], lda, &t[t_offset], lda, &q[q_offset], 
00928                             ldq, &z__[z_offset], ldq, &work[1], &result[rsub 
00929                             + 2]);
00930                 }
00931 
00932                 cget51_(&c__3, &n, &b[b_offset], lda, &t[t_offset], lda, &q[
00933                         q_offset], ldq, &q[q_offset], ldq, &work[1], &rwork[1]
00934 , &result[rsub + 3]);
00935                 cget51_(&c__3, &n, &b[b_offset], lda, &t[t_offset], lda, &z__[
00936                         z_offset], ldq, &z__[z_offset], ldq, &work[1], &rwork[
00937                         1], &result[rsub + 4]);
00938 
00939 /*              Do test 5 and 6 (or Tests 10 and 11 when reordering): */
00940 /*              check Schur form of A and compare eigenvalues with */
00941 /*              diagonals. */
00942 
00943                 ntest = rsub + 6;
00944                 temp1 = 0.f;
00945 
00946                 i__3 = n;
00947                 for (j = 1; j <= i__3; ++j) {
00948                     ilabad = FALSE_;
00949                     i__4 = j;
00950                     i__5 = j + j * s_dim1;
00951                     q__2.r = alpha[i__4].r - s[i__5].r, q__2.i = alpha[i__4]
00952                             .i - s[i__5].i;
00953                     q__1.r = q__2.r, q__1.i = q__2.i;
00954                     i__6 = j;
00955                     i__7 = j + j * t_dim1;
00956                     q__4.r = beta[i__6].r - t[i__7].r, q__4.i = beta[i__6].i 
00957                             - t[i__7].i;
00958                     q__3.r = q__4.r, q__3.i = q__4.i;
00959 /* Computing MAX */
00960                     i__8 = j;
00961                     i__9 = j + j * s_dim1;
00962                     r__13 = safmin, r__14 = (r__1 = alpha[i__8].r, dabs(r__1))
00963                              + (r__2 = r_imag(&alpha[j]), dabs(r__2)), r__13 =
00964                              max(r__13,r__14), r__14 = (r__3 = s[i__9].r, 
00965                             dabs(r__3)) + (r__4 = r_imag(&s[j + j * s_dim1]), 
00966                             dabs(r__4));
00967 /* Computing MAX */
00968                     i__10 = j;
00969                     i__11 = j + j * t_dim1;
00970                     r__15 = safmin, r__16 = (r__5 = beta[i__10].r, dabs(r__5))
00971                              + (r__6 = r_imag(&beta[j]), dabs(r__6)), r__15 = 
00972                             max(r__15,r__16), r__16 = (r__7 = t[i__11].r, 
00973                             dabs(r__7)) + (r__8 = r_imag(&t[j + j * t_dim1]), 
00974                             dabs(r__8));
00975                     temp2 = (((r__9 = q__1.r, dabs(r__9)) + (r__10 = r_imag(&
00976                             q__1), dabs(r__10))) / dmax(r__13,r__14) + ((
00977                             r__11 = q__3.r, dabs(r__11)) + (r__12 = r_imag(&
00978                             q__3), dabs(r__12))) / dmax(r__15,r__16)) / ulp;
00979 
00980                     if (j < n) {
00981                         i__4 = j + 1 + j * s_dim1;
00982                         if (s[i__4].r != 0.f || s[i__4].i != 0.f) {
00983                             ilabad = TRUE_;
00984                             result[rsub + 5] = ulpinv;
00985                         }
00986                     }
00987                     if (j > 1) {
00988                         i__4 = j + (j - 1) * s_dim1;
00989                         if (s[i__4].r != 0.f || s[i__4].i != 0.f) {
00990                             ilabad = TRUE_;
00991                             result[rsub + 5] = ulpinv;
00992                         }
00993                     }
00994                     temp1 = dmax(temp1,temp2);
00995                     if (ilabad) {
00996                         io___51.ciunit = *nounit;
00997                         s_wsfe(&io___51);
00998                         do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
00999                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01000                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01001                                 ;
01002                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01003                                 integer));
01004                         e_wsfe();
01005                     }
01006 /* L130: */
01007                 }
01008                 result[rsub + 6] = temp1;
01009 
01010                 if (isort >= 1) {
01011 
01012 /*                 Do test 12 */
01013 
01014                     ntest = 12;
01015                     result[12] = 0.f;
01016                     knteig = 0;
01017                     i__3 = n;
01018                     for (i__ = 1; i__ <= i__3; ++i__) {
01019                         if (clctes_(&alpha[i__], &beta[i__])) {
01020                             ++knteig;
01021                         }
01022 /* L140: */
01023                     }
01024                     if (sdim != knteig) {
01025                         result[13] = ulpinv;
01026                     }
01027                 }
01028 
01029 /* L150: */
01030             }
01031 
01032 /*           End of Loop -- Check for RESULT(j) > THRESH */
01033 
01034 L160:
01035 
01036             ntestt += ntest;
01037 
01038 /*           Print out tests which fail. */
01039 
01040             i__3 = ntest;
01041             for (jr = 1; jr <= i__3; ++jr) {
01042                 if (result[jr] >= *thresh) {
01043 
01044 /*                 If this is the first test to fail, */
01045 /*                 print a header to the data file. */
01046 
01047                     if (nerrs == 0) {
01048                         io___53.ciunit = *nounit;
01049                         s_wsfe(&io___53);
01050                         do_fio(&c__1, "CGS", (ftnlen)3);
01051                         e_wsfe();
01052 
01053 /*                    Matrix types */
01054 
01055                         io___54.ciunit = *nounit;
01056                         s_wsfe(&io___54);
01057                         e_wsfe();
01058                         io___55.ciunit = *nounit;
01059                         s_wsfe(&io___55);
01060                         e_wsfe();
01061                         io___56.ciunit = *nounit;
01062                         s_wsfe(&io___56);
01063                         do_fio(&c__1, "Unitary", (ftnlen)7);
01064                         e_wsfe();
01065 
01066 /*                    Tests performed */
01067 
01068                         io___57.ciunit = *nounit;
01069                         s_wsfe(&io___57);
01070                         do_fio(&c__1, "unitary", (ftnlen)7);
01071                         do_fio(&c__1, "'", (ftnlen)1);
01072                         do_fio(&c__1, "transpose", (ftnlen)9);
01073                         for (j = 1; j <= 8; ++j) {
01074                             do_fio(&c__1, "'", (ftnlen)1);
01075                         }
01076                         e_wsfe();
01077 
01078                     }
01079                     ++nerrs;
01080                     if (result[jr] < 1e4f) {
01081                         io___58.ciunit = *nounit;
01082                         s_wsfe(&io___58);
01083                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01084                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01085                                 ;
01086                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01087                                 integer));
01088                         do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01089                         do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01090                                 real));
01091                         e_wsfe();
01092                     } else {
01093                         io___59.ciunit = *nounit;
01094                         s_wsfe(&io___59);
01095                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01096                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01097                                 ;
01098                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01099                                 integer));
01100                         do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01101                         do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01102                                 real));
01103                         e_wsfe();
01104                     }
01105                 }
01106 /* L170: */
01107             }
01108 
01109 L180:
01110             ;
01111         }
01112 /* L190: */
01113     }
01114 
01115 /*     Summary */
01116 
01117     alasvm_("CGS", nounit, &nerrs, &ntestt, &c__0);
01118 
01119     work[1].r = (real) maxwrk, work[1].i = 0.f;
01120 
01121     return 0;
01122 
01123 
01124 
01125 
01126 
01127 
01128 
01129 /*     End of CDRGES */
01130 
01131 } /* cdrges_ */


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