zchkgg.c
Go to the documentation of this file.
00001 /* zchkgg.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 doublecomplex c_b1 = {0.,0.};
00019 static doublecomplex c_b2 = {1.,0.};
00020 static integer c__4 = 4;
00021 static doublereal c_b17 = 1.;
00022 static integer c__3 = 3;
00023 static integer c__1 = 1;
00024 static logical c_true = TRUE_;
00025 static logical c_false = FALSE_;
00026 static integer c__2 = 2;
00027 
00028 /* Subroutine */ int zchkgg_(integer *nsizes, integer *nn, integer *ntypes, 
00029         logical *dotype, integer *iseed, doublereal *thresh, logical *tstdif, 
00030         doublereal *thrshn, integer *nounit, doublecomplex *a, integer *lda, 
00031         doublecomplex *b, doublecomplex *h__, doublecomplex *t, doublecomplex 
00032         *s1, doublecomplex *s2, doublecomplex *p1, doublecomplex *p2, 
00033         doublecomplex *u, integer *ldu, doublecomplex *v, doublecomplex *q, 
00034         doublecomplex *z__, doublecomplex *alpha1, doublecomplex *beta1, 
00035         doublecomplex *alpha3, doublecomplex *beta3, doublecomplex *evectl, 
00036         doublecomplex *evectr, doublecomplex *work, integer *lwork, 
00037         doublereal *rwork, logical *llwork, doublereal *result, integer *info)
00038 {
00039     /* Initialized data */
00040 
00041     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,
00042             2,2,2,3 };
00043     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,
00044             2,3,2,1 };
00045     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,
00046             1,1,1,1 };
00047     static logical lasign[26] = { FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00048             TRUE_,FALSE_,TRUE_,TRUE_,FALSE_,FALSE_,TRUE_,TRUE_,TRUE_,FALSE_,
00049             TRUE_,FALSE_,FALSE_,FALSE_,TRUE_,TRUE_,TRUE_,TRUE_,TRUE_,FALSE_ };
00050     static logical lbsign[26] = { FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00051             FALSE_,TRUE_,FALSE_,FALSE_,TRUE_,TRUE_,FALSE_,FALSE_,TRUE_,FALSE_,
00052             TRUE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,
00053             FALSE_ };
00054     static integer kz1[6] = { 0,1,2,1,3,3 };
00055     static integer kz2[6] = { 0,0,1,2,1,1 };
00056     static integer kadd[6] = { 0,0,0,0,3,2 };
00057     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,
00058             4,4,4,0 };
00059     static integer kbtype[26] = { 0,0,1,1,2,-3,1,4,1,1,4,4,1,1,-4,2,-4,8,8,8,
00060             8,8,8,8,8,0 };
00061     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,
00062             3,3,3,1 };
00063     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,
00064             4,4,4,1 };
00065     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,
00066             3,3,2,1 };
00067 
00068     /* Format strings */
00069     static char fmt_9999[] = "(\002 ZCHKGG: \002,a,\002 returned INFO=\002,i"
00070             "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, ISEED="
00071             "(\002,3(i5,\002,\002),i5,\002)\002)";
00072     static char fmt_9998[] = "(\002 ZCHKGG: \002,a,\002 Eigenvectors from"
00073             " \002,a,\002 incorrectly \002,\002normalized.\002,/\002 Bits of "
00074             "error=\002,0p,g10.3,\002,\002,9x,\002N=\002,i6,\002, JTYPE=\002,"
00075             "i6,\002, ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00076     static char fmt_9997[] = "(1x,a3,\002 -- Complex Generalized eigenvalue "
00077             "problem\002)";
00078     static char fmt_9996[] = "(\002 Matrix types (see ZCHKGG for details):"
00079             " \002)";
00080     static char fmt_9995[] = "(\002 Special Matrices:\002,23x,\002(J'=transp"
00081             "osed Jordan block)\002,/\002   1=(0,0)  2=(I,0)  3=(0,I)  4=(I,I"
00082             ")  5=(J',J')  \002,\0026=(diag(J',I), diag(I,J'))\002,/\002 Diag"
00083             "onal Matrices:  ( \002,\002D=diag(0,1,2,...) )\002,/\002   7=(D,"
00084             "I)   9=(large*D, small*I\002,\002)  11=(large*I, small*D)  13=(l"
00085             "arge*D, large*I)\002,/\002   8=(I,D)  10=(small*D, large*I)  12="
00086             "(small*I, large*D) \002,\002 14=(small*D, small*I)\002,/\002  15"
00087             "=(D, reversed D)\002)";
00088     static char fmt_9994[] = "(\002 Matrices Rotated by Random \002,a,\002 M"
00089             "atrices U, V:\002,/\002  16=Transposed Jordan Blocks            "
00090             " 19=geometric \002,\002alpha, beta=0,1\002,/\002  17=arithm. alp"
00091             "ha&beta             \002,\002      20=arithmetic alpha, beta=0,"
00092             "1\002,/\002  18=clustered \002,\002alpha, beta=0,1            21"
00093             "=random alpha, beta=0,1\002,/\002 Large & Small Matrices:\002,"
00094             "/\002  22=(large, small)   \002,\00223=(small,large)    24=(smal"
00095             "l,small)    25=(large,large)\002,/\002  26=random O(1) matrices"
00096             ".\002)";
00097     static char fmt_9993[] = "(/\002 Tests performed:   (H is Hessenberg, S "
00098             "is Schur, B, \002,\002T, P are triangular,\002,/20x,\002U, V, Q,"
00099             " and Z are \002,a,\002, l and r are the\002,/20x,\002appropriate"
00100             " left and right eigenvectors, resp., a is\002,/20x,\002alpha, b "
00101             "is beta, and \002,a,\002 means \002,a,\002.)\002,/\002 1 = | A -"
00102             " U H V\002,a,\002 | / ( |A| n ulp )      2 = | B - U T V\002,a"
00103             ",\002 | / ( |B| n ulp )\002,/\002 3 = | I - UU\002,a,\002 | / ( "
00104             "n ulp )             4 = | I - VV\002,a,\002 | / ( n ulp )\002,"
00105             "/\002 5 = | H - Q S Z\002,a,\002 | / ( |H| n ulp )\002,6x,\0026 "
00106             "= | T - Q P Z\002,a,\002 | / ( |T| n ulp )\002,/\002 7 = | I - QQ"
00107             "\002,a,\002 | / ( n ulp )             8 = | I - ZZ\002,a,\002 | "
00108             "/ ( n ulp )\002,/\002 9 = max | ( b S - a P )\002,a,\002 l | / c"
00109             "onst.  10 = max | ( b H - a T )\002,a,\002 l | / const.\002,/"
00110             "\002 11= max | ( b S - a P ) r | / const.   12 = max | ( b H\002,"
00111             "\002 - a T ) r | / const.\002,/1x)";
00112     static char fmt_9992[] = "(\002 Matrix order=\002,i5,\002, type=\002,i2"
00113             ",\002, seed=\002,4(i4,\002,\002),\002 result \002,i2,\002 is\002"
00114             ",0p,f8.2)";
00115     static char fmt_9991[] = "(\002 Matrix order=\002,i5,\002, type=\002,i2"
00116             ",\002, seed=\002,4(i4,\002,\002),\002 result \002,i2,\002 is\002"
00117             ",1p,d10.3)";
00118 
00119     /* System generated locals */
00120     integer a_dim1, a_offset, b_dim1, b_offset, evectl_dim1, evectl_offset, 
00121             evectr_dim1, evectr_offset, h_dim1, h_offset, p1_dim1, p1_offset, 
00122             p2_dim1, p2_offset, q_dim1, q_offset, s1_dim1, s1_offset, s2_dim1,
00123              s2_offset, t_dim1, t_offset, u_dim1, u_offset, v_dim1, v_offset, 
00124             z_dim1, z_offset, i__1, i__2, i__3, i__4, i__5, i__6, i__7;
00125     doublereal d__1, d__2;
00126     doublecomplex z__1, z__2, z__3;
00127 
00128     /* Builtin functions */
00129     double d_sign(doublereal *, doublereal *), z_abs(doublecomplex *);
00130     void d_cnjg(doublecomplex *, doublecomplex *);
00131     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00132 
00133     /* Local variables */
00134     integer j, n, i1, n1, jc, in, jr;
00135     doublereal ulp;
00136     integer iadd, nmax;
00137     doublereal temp1, temp2;
00138     logical badnn;
00139     doublereal dumma[4];
00140     integer iinfo;
00141     doublereal rmagn[4];
00142     doublecomplex ctemp;
00143     doublereal anorm, bnorm;
00144     extern /* Subroutine */ int zget51_(integer *, integer *, doublecomplex *, 
00145              integer *, doublecomplex *, integer *, doublecomplex *, integer *
00146 , doublecomplex *, integer *, doublecomplex *, doublereal *, 
00147             doublereal *), zget52_(logical *, integer *, doublecomplex *, 
00148             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00149              doublecomplex *, doublecomplex *, doublecomplex *, doublereal *, 
00150             doublereal *);
00151     integer nmats, jsize, nerrs, jtype, ntest;
00152     extern /* Subroutine */ int dlabad_(doublereal *, doublereal *), zgeqr2_(
00153             integer *, integer *, doublecomplex *, integer *, doublecomplex *, 
00154              doublecomplex *, integer *), zlatm4_(integer *, integer *, 
00155             integer *, integer *, logical *, doublereal *, doublereal *, 
00156             doublereal *, integer *, integer *, doublecomplex *, integer *);
00157     extern doublereal dlamch_(char *);
00158     extern /* Subroutine */ int zunm2r_(char *, char *, integer *, integer *, 
00159             integer *, doublecomplex *, integer *, doublecomplex *, 
00160             doublecomplex *, integer *, doublecomplex *, integer *);
00161     doublecomplex cdumma[4];
00162     doublereal safmin, safmax;
00163     integer ioldsd[4];
00164     extern doublereal zlange_(char *, integer *, integer *, doublecomplex *, 
00165             integer *, doublereal *);
00166     extern /* Subroutine */ int dlasum_(char *, integer *, integer *, integer 
00167             *), xerbla_(char *, integer *);
00168     extern /* Double Complex */ VOID zlarnd_(doublecomplex *, integer *, 
00169             integer *);
00170     extern /* Subroutine */ int zgghrd_(char *, char *, integer *, integer *, 
00171             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00172              doublecomplex *, integer *, doublecomplex *, integer *, integer *
00173 ), zlacpy_(char *, integer *, integer *, 
00174             doublecomplex *, integer *, doublecomplex *, integer *), 
00175             zlarfg_(integer *, doublecomplex *, doublecomplex *, integer *, 
00176             doublecomplex *), zlaset_(char *, integer *, integer *, 
00177             doublecomplex *, doublecomplex *, doublecomplex *, integer *), ztgevc_(char *, char *, logical *, integer *, 
00178             doublecomplex *, integer *, doublecomplex *, integer *, 
00179             doublecomplex *, integer *, doublecomplex *, integer *, integer *, 
00180              integer *, doublecomplex *, doublereal *, integer *), zhgeqz_(char *, char *, char *, integer *, integer *, 
00181             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00182              doublecomplex *, doublecomplex *, doublecomplex *, integer *, 
00183             doublecomplex *, integer *, doublecomplex *, integer *, 
00184             doublereal *, integer *);
00185     doublereal ulpinv;
00186     integer lwkopt, mtypes, ntestt;
00187 
00188     /* Fortran I/O blocks */
00189     static cilist io___41 = { 0, 0, 0, fmt_9999, 0 };
00190     static cilist io___42 = { 0, 0, 0, fmt_9999, 0 };
00191     static cilist io___43 = { 0, 0, 0, fmt_9999, 0 };
00192     static cilist io___44 = { 0, 0, 0, fmt_9999, 0 };
00193     static cilist io___45 = { 0, 0, 0, fmt_9999, 0 };
00194     static cilist io___46 = { 0, 0, 0, fmt_9999, 0 };
00195     static cilist io___47 = { 0, 0, 0, fmt_9999, 0 };
00196     static cilist io___48 = { 0, 0, 0, fmt_9999, 0 };
00197     static cilist io___51 = { 0, 0, 0, fmt_9999, 0 };
00198     static cilist io___52 = { 0, 0, 0, fmt_9999, 0 };
00199     static cilist io___54 = { 0, 0, 0, fmt_9998, 0 };
00200     static cilist io___55 = { 0, 0, 0, fmt_9999, 0 };
00201     static cilist io___56 = { 0, 0, 0, fmt_9998, 0 };
00202     static cilist io___57 = { 0, 0, 0, fmt_9999, 0 };
00203     static cilist io___58 = { 0, 0, 0, fmt_9999, 0 };
00204     static cilist io___59 = { 0, 0, 0, fmt_9998, 0 };
00205     static cilist io___60 = { 0, 0, 0, fmt_9999, 0 };
00206     static cilist io___61 = { 0, 0, 0, fmt_9998, 0 };
00207     static cilist io___64 = { 0, 0, 0, fmt_9997, 0 };
00208     static cilist io___65 = { 0, 0, 0, fmt_9996, 0 };
00209     static cilist io___66 = { 0, 0, 0, fmt_9995, 0 };
00210     static cilist io___67 = { 0, 0, 0, fmt_9994, 0 };
00211     static cilist io___68 = { 0, 0, 0, fmt_9993, 0 };
00212     static cilist io___69 = { 0, 0, 0, fmt_9992, 0 };
00213     static cilist io___70 = { 0, 0, 0, fmt_9991, 0 };
00214 
00215 
00216 
00217 /*  -- LAPACK test routine (version 3.1) -- */
00218 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00219 /*     November 2006 */
00220 
00221 /*     .. Scalar Arguments .. */
00222 /*     .. */
00223 /*     .. Array Arguments .. */
00224 /*     .. */
00225 
00226 /*  Purpose */
00227 /*  ======= */
00228 
00229 /*  ZCHKGG  checks the nonsymmetric generalized eigenvalue problem */
00230 /*  routines. */
00231 /*                                 H          H        H */
00232 /*  ZGGHRD factors A and B as U H V  and U T V , where   means conjugate */
00233 /*  transpose, H is hessenberg, T is triangular and U and V are unitary. */
00234 
00235 /*                                  H          H */
00236 /*  ZHGEQZ factors H and T as  Q S Z  and Q P Z , where P and S are upper */
00237 /*  triangular and Q and Z are unitary.  It also computes the generalized */
00238 /*  eigenvalues (alpha(1),beta(1)),...,(alpha(n),beta(n)), where */
00239 /*  alpha(j)=S(j,j) and beta(j)=P(j,j) -- thus, w(j) = alpha(j)/beta(j) */
00240 /*  is a root of the generalized eigenvalue problem */
00241 
00242 /*      det( A - w(j) B ) = 0 */
00243 
00244 /*  and m(j) = beta(j)/alpha(j) is a root of the essentially equivalent */
00245 /*  problem */
00246 
00247 /*      det( m(j) A - B ) = 0 */
00248 
00249 /*  ZTGEVC computes the matrix L of left eigenvectors and the matrix R */
00250 /*  of right eigenvectors for the matrix pair ( S, P ).  In the */
00251 /*  description below,  l and r are left and right eigenvectors */
00252 /*  corresponding to the generalized eigenvalues (alpha,beta). */
00253 
00254 /*  When ZCHKGG is called, a number of matrix "sizes" ("n's") and a */
00255 /*  number of matrix "types" are specified.  For each size ("n") */
00256 /*  and each type of matrix, one matrix will be generated and used */
00257 /*  to test the nonsymmetric eigenroutines.  For each matrix, 13 */
00258 /*  tests will be performed.  The first twelve "test ratios" should be */
00259 /*  small -- O(1).  They will be compared with the threshhold THRESH: */
00260 
00261 /*                   H */
00262 /*  (1)   | A - U H V  | / ( |A| n ulp ) */
00263 
00264 /*                   H */
00265 /*  (2)   | B - U T V  | / ( |B| n ulp ) */
00266 
00267 /*                H */
00268 /*  (3)   | I - UU  | / ( n ulp ) */
00269 
00270 /*                H */
00271 /*  (4)   | I - VV  | / ( n ulp ) */
00272 
00273 /*                   H */
00274 /*  (5)   | H - Q S Z  | / ( |H| n ulp ) */
00275 
00276 /*                   H */
00277 /*  (6)   | T - Q P Z  | / ( |T| n ulp ) */
00278 
00279 /*                H */
00280 /*  (7)   | I - QQ  | / ( n ulp ) */
00281 
00282 /*                H */
00283 /*  (8)   | I - ZZ  | / ( n ulp ) */
00284 
00285 /*  (9)   max over all left eigenvalue/-vector pairs (beta/alpha,l) of */
00286 /*                            H */
00287 /*        | (beta A - alpha B) l | / ( ulp max( |beta A|, |alpha B| ) ) */
00288 
00289 /*  (10)  max over all left eigenvalue/-vector pairs (beta/alpha,l') of */
00290 /*                            H */
00291 /*        | (beta H - alpha T) l' | / ( ulp max( |beta H|, |alpha T| ) ) */
00292 
00293 /*        where the eigenvectors l' are the result of passing Q to */
00294 /*        DTGEVC and back transforming (JOB='B'). */
00295 
00296 /*  (11)  max over all right eigenvalue/-vector pairs (beta/alpha,r) of */
00297 
00298 /*        | (beta A - alpha B) r | / ( ulp max( |beta A|, |alpha B| ) ) */
00299 
00300 /*  (12)  max over all right eigenvalue/-vector pairs (beta/alpha,r') of */
00301 
00302 /*        | (beta H - alpha T) r' | / ( ulp max( |beta H|, |alpha T| ) ) */
00303 
00304 /*        where the eigenvectors r' are the result of passing Z to */
00305 /*        DTGEVC and back transforming (JOB='B'). */
00306 
00307 /*  The last three test ratios will usually be small, but there is no */
00308 /*  mathematical requirement that they be so.  They are therefore */
00309 /*  compared with THRESH only if TSTDIF is .TRUE. */
00310 
00311 /*  (13)  | S(Q,Z computed) - S(Q,Z not computed) | / ( |S| ulp ) */
00312 
00313 /*  (14)  | P(Q,Z computed) - P(Q,Z not computed) | / ( |P| ulp ) */
00314 
00315 /*  (15)  max( |alpha(Q,Z computed) - alpha(Q,Z not computed)|/|S| , */
00316 /*             |beta(Q,Z computed) - beta(Q,Z not computed)|/|P| ) / ulp */
00317 
00318 /*  In addition, the normalization of L and R are checked, and compared */
00319 /*  with the threshhold THRSHN. */
00320 
00321 /*  Test Matrices */
00322 /*  ---- -------- */
00323 
00324 /*  The sizes of the test matrices are specified by an array */
00325 /*  NN(1:NSIZES); the value of each element NN(j) specifies one size. */
00326 /*  The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if */
00327 /*  DOTYPE(j) is .TRUE., then matrix type "j" will be generated. */
00328 /*  Currently, the list of possible types is: */
00329 
00330 /*  (1)  ( 0, 0 )         (a pair of zero matrices) */
00331 
00332 /*  (2)  ( I, 0 )         (an identity and a zero matrix) */
00333 
00334 /*  (3)  ( 0, I )         (an identity and a zero matrix) */
00335 
00336 /*  (4)  ( I, I )         (a pair of identity matrices) */
00337 
00338 /*          t   t */
00339 /*  (5)  ( J , J  )       (a pair of transposed Jordan blocks) */
00340 
00341 /*                                      t                ( I   0  ) */
00342 /*  (6)  ( X, Y )         where  X = ( J   0  )  and Y = (      t ) */
00343 /*                                   ( 0   I  )          ( 0   J  ) */
00344 /*                        and I is a k x k identity and J a (k+1)x(k+1) */
00345 /*                        Jordan block; k=(N-1)/2 */
00346 
00347 /*  (7)  ( D, I )         where D is P*D1, P is a random unitary diagonal */
00348 /*                        matrix (i.e., with random magnitude 1 entries */
00349 /*                        on the diagonal), and D1=diag( 0, 1,..., N-1 ) */
00350 /*                        (i.e., a diagonal matrix with D1(1,1)=0, */
00351 /*                        D1(2,2)=1, ..., D1(N,N)=N-1.) */
00352 /*  (8)  ( I, D ) */
00353 
00354 /*  (9)  ( big*D, small*I ) where "big" is near overflow and small=1/big */
00355 
00356 /*  (10) ( small*D, big*I ) */
00357 
00358 /*  (11) ( big*I, small*D ) */
00359 
00360 /*  (12) ( small*I, big*D ) */
00361 
00362 /*  (13) ( big*D, big*I ) */
00363 
00364 /*  (14) ( small*D, small*I ) */
00365 
00366 /*  (15) ( D1, D2 )        where D1=P*diag( 0, 0, 1, ..., N-3, 0 ) and */
00367 /*                         D2=Q*diag( 0, N-3, N-4,..., 1, 0, 0 ), and */
00368 /*                         P and Q are random unitary diagonal matrices. */
00369 /*            t   t */
00370 /*  (16) U ( J , J ) V     where U and V are random unitary matrices. */
00371 
00372 /*  (17) U ( T1, T2 ) V    where T1 and T2 are upper triangular matrices */
00373 /*                         with random O(1) entries above the diagonal */
00374 /*                         and diagonal entries diag(T1) = */
00375 /*                         P*( 0, 0, 1, ..., N-3, 0 ) and diag(T2) = */
00376 /*                         Q*( 0, N-3, N-4,..., 1, 0, 0 ) */
00377 
00378 /*  (18) U ( T1, T2 ) V    diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 ) */
00379 /*                         diag(T2) = ( 0, 1, 0, 1,..., 1, 0 ) */
00380 /*                         s = machine precision. */
00381 
00382 /*  (19) U ( T1, T2 ) V    diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 ) */
00383 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 ) */
00384 
00385 /*                                                         N-5 */
00386 /*  (20) U ( T1, T2 ) V    diag(T1)=( 0, 0, 1, 1, a, ..., a   =s, 0 ) */
00387 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) */
00388 
00389 /*  (21) U ( T1, T2 ) V    diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 ) */
00390 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) */
00391 /*                         where r1,..., r(N-4) are random. */
00392 
00393 /*  (22) U ( big*T1, small*T2 ) V   diag(T1) = P*( 0, 0, 1, ..., N-3, 0 ) */
00394 /*                                  diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00395 
00396 /*  (23) U ( small*T1, big*T2 ) V   diag(T1) = P*( 0, 0, 1, ..., N-3, 0 ) */
00397 /*                                  diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00398 
00399 /*  (24) U ( small*T1, small*T2 ) V diag(T1) = P*( 0, 0, 1, ..., N-3, 0 ) */
00400 /*                                  diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00401 
00402 /*  (25) U ( big*T1, big*T2 ) V     diag(T1) = P*( 0, 0, 1, ..., N-3, 0 ) */
00403 /*                                  diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00404 
00405 /*  (26) U ( T1, T2 ) V     where T1 and T2 are random upper-triangular */
00406 /*                          matrices. */
00407 
00408 /*  Arguments */
00409 /*  ========= */
00410 
00411 /*  NSIZES  (input) INTEGER */
00412 /*          The number of sizes of matrices to use.  If it is zero, */
00413 /*          ZCHKGG does nothing.  It must be at least zero. */
00414 
00415 /*  NN      (input) INTEGER array, dimension (NSIZES) */
00416 /*          An array containing the sizes to be used for the matrices. */
00417 /*          Zero values will be skipped.  The values must be at least */
00418 /*          zero. */
00419 
00420 /*  NTYPES  (input) INTEGER */
00421 /*          The number of elements in DOTYPE.   If it is zero, ZCHKGG */
00422 /*          does nothing.  It must be at least zero.  If it is MAXTYP+1 */
00423 /*          and NSIZES is 1, then an additional type, MAXTYP+1 is */
00424 /*          defined, which is to use whatever matrix is in A.  This */
00425 /*          is only useful if DOTYPE(1:MAXTYP) is .FALSE. and */
00426 /*          DOTYPE(MAXTYP+1) is .TRUE. . */
00427 
00428 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00429 /*          If DOTYPE(j) is .TRUE., then for each size in NN a */
00430 /*          matrix of that size and of type j will be generated. */
00431 /*          If NTYPES is smaller than the maximum number of types */
00432 /*          defined (PARAMETER MAXTYP), then types NTYPES+1 through */
00433 /*          MAXTYP will not be generated.  If NTYPES is larger */
00434 /*          than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) */
00435 /*          will be ignored. */
00436 
00437 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00438 /*          On entry ISEED specifies the seed of the random number */
00439 /*          generator. The array elements should be between 0 and 4095; */
00440 /*          if not they will be reduced mod 4096.  Also, ISEED(4) must */
00441 /*          be odd.  The random number generator uses a linear */
00442 /*          congruential sequence limited to small integers, and so */
00443 /*          should produce machine independent random numbers. The */
00444 /*          values of ISEED are changed on exit, and can be used in the */
00445 /*          next call to ZCHKGG to continue the same random number */
00446 /*          sequence. */
00447 
00448 /*  THRESH  (input) DOUBLE PRECISION */
00449 /*          A test will count as "failed" if the "error", computed as */
00450 /*          described above, exceeds THRESH.  Note that the error */
00451 /*          is scaled to be O(1), so THRESH should be a reasonably */
00452 /*          small multiple of 1, e.g., 10 or 100.  In particular, */
00453 /*          it should not depend on the precision (single vs. double) */
00454 /*          or the size of the matrix.  It must be at least zero. */
00455 
00456 /*  TSTDIF  (input) LOGICAL */
00457 /*          Specifies whether test ratios 13-15 will be computed and */
00458 /*          compared with THRESH. */
00459 /*          = .FALSE.: Only test ratios 1-12 will be computed and tested. */
00460 /*                     Ratios 13-15 will be set to zero. */
00461 /*          = .TRUE.:  All the test ratios 1-15 will be computed and */
00462 /*                     tested. */
00463 
00464 /*  THRSHN  (input) DOUBLE PRECISION */
00465 /*          Threshhold for reporting eigenvector normalization error. */
00466 /*          If the normalization of any eigenvector differs from 1 by */
00467 /*          more than THRSHN*ulp, then a special error message will be */
00468 /*          printed.  (This is handled separately from the other tests, */
00469 /*          since only a compiler or programming error should cause an */
00470 /*          error message, at least if THRSHN is at least 5--10.) */
00471 
00472 /*  NOUNIT  (input) INTEGER */
00473 /*          The FORTRAN unit number for printing out error messages */
00474 /*          (e.g., if a routine returns IINFO not equal to 0.) */
00475 
00476 /*  A       (input/workspace) COMPLEX*16 array, dimension (LDA, max(NN)) */
00477 /*          Used to hold the original A matrix.  Used as input only */
00478 /*          if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and */
00479 /*          DOTYPE(MAXTYP+1)=.TRUE. */
00480 
00481 /*  LDA     (input) INTEGER */
00482 /*          The leading dimension of A, B, H, T, S1, P1, S2, and P2. */
00483 /*          It must be at least 1 and at least max( NN ). */
00484 
00485 /*  B       (input/workspace) COMPLEX*16 array, dimension (LDA, max(NN)) */
00486 /*          Used to hold the original B matrix.  Used as input only */
00487 /*          if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and */
00488 /*          DOTYPE(MAXTYP+1)=.TRUE. */
00489 
00490 /*  H       (workspace) COMPLEX*16 array, dimension (LDA, max(NN)) */
00491 /*          The upper Hessenberg matrix computed from A by ZGGHRD. */
00492 
00493 /*  T       (workspace) COMPLEX*16 array, dimension (LDA, max(NN)) */
00494 /*          The upper triangular matrix computed from B by ZGGHRD. */
00495 
00496 /*  S1      (workspace) COMPLEX*16 array, dimension (LDA, max(NN)) */
00497 /*          The Schur (upper triangular) matrix computed from H by ZHGEQZ */
00498 /*          when Q and Z are also computed. */
00499 
00500 /*  S2      (workspace) COMPLEX*16 array, dimension (LDA, max(NN)) */
00501 /*          The Schur (upper triangular) matrix computed from H by ZHGEQZ */
00502 /*          when Q and Z are not computed. */
00503 
00504 /*  P1      (workspace) COMPLEX*16 array, dimension (LDA, max(NN)) */
00505 /*          The upper triangular matrix computed from T by ZHGEQZ */
00506 /*          when Q and Z are also computed. */
00507 
00508 /*  P2      (workspace) COMPLEX*16 array, dimension (LDA, max(NN)) */
00509 /*          The upper triangular matrix computed from T by ZHGEQZ */
00510 /*          when Q and Z are not computed. */
00511 
00512 /*  U       (workspace) COMPLEX*16 array, dimension (LDU, max(NN)) */
00513 /*          The (left) unitary matrix computed by ZGGHRD. */
00514 
00515 /*  LDU     (input) INTEGER */
00516 /*          The leading dimension of U, V, Q, Z, EVECTL, and EVEZTR.  It */
00517 /*          must be at least 1 and at least max( NN ). */
00518 
00519 /*  V       (workspace) COMPLEX*16 array, dimension (LDU, max(NN)) */
00520 /*          The (right) unitary matrix computed by ZGGHRD. */
00521 
00522 /*  Q       (workspace) COMPLEX*16 array, dimension (LDU, max(NN)) */
00523 /*          The (left) unitary matrix computed by ZHGEQZ. */
00524 
00525 /*  Z       (workspace) COMPLEX*16 array, dimension (LDU, max(NN)) */
00526 /*          The (left) unitary matrix computed by ZHGEQZ. */
00527 
00528 /*  ALPHA1  (workspace) COMPLEX*16 array, dimension (max(NN)) */
00529 /*  BETA1   (workspace) COMPLEX*16 array, dimension (max(NN)) */
00530 /*          The generalized eigenvalues of (A,B) computed by ZHGEQZ */
00531 /*          when Q, Z, and the full Schur matrices are computed. */
00532 
00533 /*  ALPHA3  (workspace) COMPLEX*16 array, dimension (max(NN)) */
00534 /*  BETA3   (workspace) COMPLEX*16 array, dimension (max(NN)) */
00535 /*          The generalized eigenvalues of (A,B) computed by ZHGEQZ */
00536 /*          when neither Q, Z, nor the Schur matrices are computed. */
00537 
00538 /*  EVECTL  (workspace) COMPLEX*16 array, dimension (LDU, max(NN)) */
00539 /*          The (lower triangular) left eigenvector matrix for the */
00540 /*          matrices in S1 and P1. */
00541 
00542 /*  EVEZTR  (workspace) COMPLEX*16 array, dimension (LDU, max(NN)) */
00543 /*          The (upper triangular) right eigenvector matrix for the */
00544 /*          matrices in S1 and P1. */
00545 
00546 /*  WORK    (workspace) COMPLEX*16 array, dimension (LWORK) */
00547 
00548 /*  LWORK   (input) INTEGER */
00549 /*          The number of entries in WORK.  This must be at least */
00550 /*          max( 4*N, 2 * N**2, 1 ), for all N=NN(j). */
00551 
00552 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (2*max(NN)) */
00553 
00554 /*  LLWORK  (workspace) LOGICAL array, dimension (max(NN)) */
00555 
00556 /*  RESULT  (output) DOUBLE PRECISION array, dimension (15) */
00557 /*          The values computed by the tests described above. */
00558 /*          The values are currently limited to 1/ulp, to avoid */
00559 /*          overflow. */
00560 
00561 /*  INFO    (output) INTEGER */
00562 /*          = 0:  successful exit. */
00563 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00564 /*          > 0:  A routine returned an error code.  INFO is the */
00565 /*                absolute value of the INFO value returned. */
00566 
00567 /*  ===================================================================== */
00568 
00569 /*     .. Parameters .. */
00570 /*     .. */
00571 /*     .. Local Scalars .. */
00572 /*     .. */
00573 /*     .. Local Arrays .. */
00574 /*     .. */
00575 /*     .. External Functions .. */
00576 /*     .. */
00577 /*     .. External Subroutines .. */
00578 /*     .. */
00579 /*     .. Intrinsic Functions .. */
00580 /*     .. */
00581 /*     .. Data statements .. */
00582     /* Parameter adjustments */
00583     --nn;
00584     --dotype;
00585     --iseed;
00586     p2_dim1 = *lda;
00587     p2_offset = 1 + p2_dim1;
00588     p2 -= p2_offset;
00589     p1_dim1 = *lda;
00590     p1_offset = 1 + p1_dim1;
00591     p1 -= p1_offset;
00592     s2_dim1 = *lda;
00593     s2_offset = 1 + s2_dim1;
00594     s2 -= s2_offset;
00595     s1_dim1 = *lda;
00596     s1_offset = 1 + s1_dim1;
00597     s1 -= s1_offset;
00598     t_dim1 = *lda;
00599     t_offset = 1 + t_dim1;
00600     t -= t_offset;
00601     h_dim1 = *lda;
00602     h_offset = 1 + h_dim1;
00603     h__ -= h_offset;
00604     b_dim1 = *lda;
00605     b_offset = 1 + b_dim1;
00606     b -= b_offset;
00607     a_dim1 = *lda;
00608     a_offset = 1 + a_dim1;
00609     a -= a_offset;
00610     evectr_dim1 = *ldu;
00611     evectr_offset = 1 + evectr_dim1;
00612     evectr -= evectr_offset;
00613     evectl_dim1 = *ldu;
00614     evectl_offset = 1 + evectl_dim1;
00615     evectl -= evectl_offset;
00616     z_dim1 = *ldu;
00617     z_offset = 1 + z_dim1;
00618     z__ -= z_offset;
00619     q_dim1 = *ldu;
00620     q_offset = 1 + q_dim1;
00621     q -= q_offset;
00622     v_dim1 = *ldu;
00623     v_offset = 1 + v_dim1;
00624     v -= v_offset;
00625     u_dim1 = *ldu;
00626     u_offset = 1 + u_dim1;
00627     u -= u_offset;
00628     --alpha1;
00629     --beta1;
00630     --alpha3;
00631     --beta3;
00632     --work;
00633     --rwork;
00634     --llwork;
00635     --result;
00636 
00637     /* Function Body */
00638 /*     .. */
00639 /*     .. Executable Statements .. */
00640 
00641 /*     Check for errors */
00642 
00643     *info = 0;
00644 
00645     badnn = FALSE_;
00646     nmax = 1;
00647     i__1 = *nsizes;
00648     for (j = 1; j <= i__1; ++j) {
00649 /* Computing MAX */
00650         i__2 = nmax, i__3 = nn[j];
00651         nmax = max(i__2,i__3);
00652         if (nn[j] < 0) {
00653             badnn = TRUE_;
00654         }
00655 /* L10: */
00656     }
00657 
00658 /* Computing MAX */
00659     i__1 = (nmax << 1) * nmax, i__2 = nmax << 2, i__1 = max(i__1,i__2);
00660     lwkopt = max(i__1,1);
00661 
00662 /*     Check for errors */
00663 
00664     if (*nsizes < 0) {
00665         *info = -1;
00666     } else if (badnn) {
00667         *info = -2;
00668     } else if (*ntypes < 0) {
00669         *info = -3;
00670     } else if (*thresh < 0.) {
00671         *info = -6;
00672     } else if (*lda <= 1 || *lda < nmax) {
00673         *info = -10;
00674     } else if (*ldu <= 1 || *ldu < nmax) {
00675         *info = -19;
00676     } else if (lwkopt > *lwork) {
00677         *info = -30;
00678     }
00679 
00680     if (*info != 0) {
00681         i__1 = -(*info);
00682         xerbla_("ZCHKGG", &i__1);
00683         return 0;
00684     }
00685 
00686 /*     Quick return if possible */
00687 
00688     if (*nsizes == 0 || *ntypes == 0) {
00689         return 0;
00690     }
00691 
00692     safmin = dlamch_("Safe minimum");
00693     ulp = dlamch_("Epsilon") * dlamch_("Base");
00694     safmin /= ulp;
00695     safmax = 1. / safmin;
00696     dlabad_(&safmin, &safmax);
00697     ulpinv = 1. / ulp;
00698 
00699 /*     The values RMAGN(2:3) depend on N, see below. */
00700 
00701     rmagn[0] = 0.;
00702     rmagn[1] = 1.;
00703 
00704 /*     Loop over sizes, types */
00705 
00706     ntestt = 0;
00707     nerrs = 0;
00708     nmats = 0;
00709 
00710     i__1 = *nsizes;
00711     for (jsize = 1; jsize <= i__1; ++jsize) {
00712         n = nn[jsize];
00713         n1 = max(1,n);
00714         rmagn[2] = safmax * ulp / (doublereal) n1;
00715         rmagn[3] = safmin * ulpinv * n1;
00716 
00717         if (*nsizes != 1) {
00718             mtypes = min(26,*ntypes);
00719         } else {
00720             mtypes = min(27,*ntypes);
00721         }
00722 
00723         i__2 = mtypes;
00724         for (jtype = 1; jtype <= i__2; ++jtype) {
00725             if (! dotype[jtype]) {
00726                 goto L230;
00727             }
00728             ++nmats;
00729             ntest = 0;
00730 
00731 /*           Save ISEED in case of an error. */
00732 
00733             for (j = 1; j <= 4; ++j) {
00734                 ioldsd[j - 1] = iseed[j];
00735 /* L20: */
00736             }
00737 
00738 /*           Initialize RESULT */
00739 
00740             for (j = 1; j <= 15; ++j) {
00741                 result[j] = 0.;
00742 /* L30: */
00743             }
00744 
00745 /*           Compute A and B */
00746 
00747 /*           Description of control parameters: */
00748 
00749 /*           KZLASS: =1 means w/o rotation, =2 means w/ rotation, */
00750 /*                   =3 means random. */
00751 /*           KATYPE: the "type" to be passed to ZLATM4 for computing A. */
00752 /*           KAZERO: the pattern of zeros on the diagonal for A: */
00753 /*                   =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ), */
00754 /*                   =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ), */
00755 /*                   =6: ( 0, 1, 0, xxx, 0 ).  (xxx means a string of */
00756 /*                   non-zero entries.) */
00757 /*           KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1), */
00758 /*                   =2: large, =3: small. */
00759 /*           LASIGN: .TRUE. if the diagonal elements of A are to be */
00760 /*                   multiplied by a random magnitude 1 number. */
00761 /*           KBTYPE, KBZERO, KBMAGN, LBSIGN: the same, but for B. */
00762 /*           KTRIAN: =0: don't fill in the upper triangle, =1: do. */
00763 /*           KZ1, KZ2, KADD: used to implement KAZERO and KBZERO. */
00764 /*           RMAGN:  used to implement KAMAGN and KBMAGN. */
00765 
00766             if (mtypes > 26) {
00767                 goto L110;
00768             }
00769             iinfo = 0;
00770             if (kclass[jtype - 1] < 3) {
00771 
00772 /*              Generate A (w/o rotation) */
00773 
00774                 if ((i__3 = katype[jtype - 1], abs(i__3)) == 3) {
00775                     in = ((n - 1) / 2 << 1) + 1;
00776                     if (in != n) {
00777                         zlaset_("Full", &n, &n, &c_b1, &c_b1, &a[a_offset], 
00778                                 lda);
00779                     }
00780                 } else {
00781                     in = n;
00782                 }
00783                 zlatm4_(&katype[jtype - 1], &in, &kz1[kazero[jtype - 1] - 1], 
00784                         &kz2[kazero[jtype - 1] - 1], &lasign[jtype - 1], &
00785                         rmagn[kamagn[jtype - 1]], &ulp, &rmagn[ktrian[jtype - 
00786                         1] * kamagn[jtype - 1]], &c__4, &iseed[1], &a[
00787                         a_offset], lda);
00788                 iadd = kadd[kazero[jtype - 1] - 1];
00789                 if (iadd > 0 && iadd <= n) {
00790                     i__3 = iadd + iadd * a_dim1;
00791                     i__4 = kamagn[jtype - 1];
00792                     a[i__3].r = rmagn[i__4], a[i__3].i = 0.;
00793                 }
00794 
00795 /*              Generate B (w/o rotation) */
00796 
00797                 if ((i__3 = kbtype[jtype - 1], abs(i__3)) == 3) {
00798                     in = ((n - 1) / 2 << 1) + 1;
00799                     if (in != n) {
00800                         zlaset_("Full", &n, &n, &c_b1, &c_b1, &b[b_offset], 
00801                                 lda);
00802                     }
00803                 } else {
00804                     in = n;
00805                 }
00806                 zlatm4_(&kbtype[jtype - 1], &in, &kz1[kbzero[jtype - 1] - 1], 
00807                         &kz2[kbzero[jtype - 1] - 1], &lbsign[jtype - 1], &
00808                         rmagn[kbmagn[jtype - 1]], &c_b17, &rmagn[ktrian[jtype 
00809                         - 1] * kbmagn[jtype - 1]], &c__4, &iseed[1], &b[
00810                         b_offset], lda);
00811                 iadd = kadd[kbzero[jtype - 1] - 1];
00812                 if (iadd != 0) {
00813                     i__3 = iadd + iadd * b_dim1;
00814                     i__4 = kbmagn[jtype - 1];
00815                     b[i__3].r = rmagn[i__4], b[i__3].i = 0.;
00816                 }
00817 
00818                 if (kclass[jtype - 1] == 2 && n > 0) {
00819 
00820 /*                 Include rotations */
00821 
00822 /*                 Generate U, V as Householder transformations times a */
00823 /*                 diagonal matrix.  (Note that ZLARFG makes U(j,j) and */
00824 /*                 V(j,j) real.) */
00825 
00826                     i__3 = n - 1;
00827                     for (jc = 1; jc <= i__3; ++jc) {
00828                         i__4 = n;
00829                         for (jr = jc; jr <= i__4; ++jr) {
00830                             i__5 = jr + jc * u_dim1;
00831                             zlarnd_(&z__1, &c__3, &iseed[1]);
00832                             u[i__5].r = z__1.r, u[i__5].i = z__1.i;
00833                             i__5 = jr + jc * v_dim1;
00834                             zlarnd_(&z__1, &c__3, &iseed[1]);
00835                             v[i__5].r = z__1.r, v[i__5].i = z__1.i;
00836 /* L40: */
00837                         }
00838                         i__4 = n + 1 - jc;
00839                         zlarfg_(&i__4, &u[jc + jc * u_dim1], &u[jc + 1 + jc * 
00840                                 u_dim1], &c__1, &work[jc]);
00841                         i__4 = (n << 1) + jc;
00842                         i__5 = jc + jc * u_dim1;
00843                         d__2 = u[i__5].r;
00844                         d__1 = d_sign(&c_b17, &d__2);
00845                         work[i__4].r = d__1, work[i__4].i = 0.;
00846                         i__4 = jc + jc * u_dim1;
00847                         u[i__4].r = 1., u[i__4].i = 0.;
00848                         i__4 = n + 1 - jc;
00849                         zlarfg_(&i__4, &v[jc + jc * v_dim1], &v[jc + 1 + jc * 
00850                                 v_dim1], &c__1, &work[n + jc]);
00851                         i__4 = n * 3 + jc;
00852                         i__5 = jc + jc * v_dim1;
00853                         d__2 = v[i__5].r;
00854                         d__1 = d_sign(&c_b17, &d__2);
00855                         work[i__4].r = d__1, work[i__4].i = 0.;
00856                         i__4 = jc + jc * v_dim1;
00857                         v[i__4].r = 1., v[i__4].i = 0.;
00858 /* L50: */
00859                     }
00860                     zlarnd_(&z__1, &c__3, &iseed[1]);
00861                     ctemp.r = z__1.r, ctemp.i = z__1.i;
00862                     i__3 = n + n * u_dim1;
00863                     u[i__3].r = 1., u[i__3].i = 0.;
00864                     i__3 = n;
00865                     work[i__3].r = 0., work[i__3].i = 0.;
00866                     i__3 = n * 3;
00867                     d__1 = z_abs(&ctemp);
00868                     z__1.r = ctemp.r / d__1, z__1.i = ctemp.i / d__1;
00869                     work[i__3].r = z__1.r, work[i__3].i = z__1.i;
00870                     zlarnd_(&z__1, &c__3, &iseed[1]);
00871                     ctemp.r = z__1.r, ctemp.i = z__1.i;
00872                     i__3 = n + n * v_dim1;
00873                     v[i__3].r = 1., v[i__3].i = 0.;
00874                     i__3 = n << 1;
00875                     work[i__3].r = 0., work[i__3].i = 0.;
00876                     i__3 = n << 2;
00877                     d__1 = z_abs(&ctemp);
00878                     z__1.r = ctemp.r / d__1, z__1.i = ctemp.i / d__1;
00879                     work[i__3].r = z__1.r, work[i__3].i = z__1.i;
00880 
00881 /*                 Apply the diagonal matrices */
00882 
00883                     i__3 = n;
00884                     for (jc = 1; jc <= i__3; ++jc) {
00885                         i__4 = n;
00886                         for (jr = 1; jr <= i__4; ++jr) {
00887                             i__5 = jr + jc * a_dim1;
00888                             i__6 = (n << 1) + jr;
00889                             d_cnjg(&z__3, &work[n * 3 + jc]);
00890                             z__2.r = work[i__6].r * z__3.r - work[i__6].i * 
00891                                     z__3.i, z__2.i = work[i__6].r * z__3.i + 
00892                                     work[i__6].i * z__3.r;
00893                             i__7 = jr + jc * a_dim1;
00894                             z__1.r = z__2.r * a[i__7].r - z__2.i * a[i__7].i, 
00895                                     z__1.i = z__2.r * a[i__7].i + z__2.i * a[
00896                                     i__7].r;
00897                             a[i__5].r = z__1.r, a[i__5].i = z__1.i;
00898                             i__5 = jr + jc * b_dim1;
00899                             i__6 = (n << 1) + jr;
00900                             d_cnjg(&z__3, &work[n * 3 + jc]);
00901                             z__2.r = work[i__6].r * z__3.r - work[i__6].i * 
00902                                     z__3.i, z__2.i = work[i__6].r * z__3.i + 
00903                                     work[i__6].i * z__3.r;
00904                             i__7 = jr + jc * b_dim1;
00905                             z__1.r = z__2.r * b[i__7].r - z__2.i * b[i__7].i, 
00906                                     z__1.i = z__2.r * b[i__7].i + z__2.i * b[
00907                                     i__7].r;
00908                             b[i__5].r = z__1.r, b[i__5].i = z__1.i;
00909 /* L60: */
00910                         }
00911 /* L70: */
00912                     }
00913                     i__3 = n - 1;
00914                     zunm2r_("L", "N", &n, &n, &i__3, &u[u_offset], ldu, &work[
00915                             1], &a[a_offset], lda, &work[(n << 1) + 1], &
00916                             iinfo);
00917                     if (iinfo != 0) {
00918                         goto L100;
00919                     }
00920                     i__3 = n - 1;
00921                     zunm2r_("R", "C", &n, &n, &i__3, &v[v_offset], ldu, &work[
00922                             n + 1], &a[a_offset], lda, &work[(n << 1) + 1], &
00923                             iinfo);
00924                     if (iinfo != 0) {
00925                         goto L100;
00926                     }
00927                     i__3 = n - 1;
00928                     zunm2r_("L", "N", &n, &n, &i__3, &u[u_offset], ldu, &work[
00929                             1], &b[b_offset], lda, &work[(n << 1) + 1], &
00930                             iinfo);
00931                     if (iinfo != 0) {
00932                         goto L100;
00933                     }
00934                     i__3 = n - 1;
00935                     zunm2r_("R", "C", &n, &n, &i__3, &v[v_offset], ldu, &work[
00936                             n + 1], &b[b_offset], lda, &work[(n << 1) + 1], &
00937                             iinfo);
00938                     if (iinfo != 0) {
00939                         goto L100;
00940                     }
00941                 }
00942             } else {
00943 
00944 /*              Random matrices */
00945 
00946                 i__3 = n;
00947                 for (jc = 1; jc <= i__3; ++jc) {
00948                     i__4 = n;
00949                     for (jr = 1; jr <= i__4; ++jr) {
00950                         i__5 = jr + jc * a_dim1;
00951                         i__6 = kamagn[jtype - 1];
00952                         zlarnd_(&z__2, &c__4, &iseed[1]);
00953                         z__1.r = rmagn[i__6] * z__2.r, z__1.i = rmagn[i__6] * 
00954                                 z__2.i;
00955                         a[i__5].r = z__1.r, a[i__5].i = z__1.i;
00956                         i__5 = jr + jc * b_dim1;
00957                         i__6 = kbmagn[jtype - 1];
00958                         zlarnd_(&z__2, &c__4, &iseed[1]);
00959                         z__1.r = rmagn[i__6] * z__2.r, z__1.i = rmagn[i__6] * 
00960                                 z__2.i;
00961                         b[i__5].r = z__1.r, b[i__5].i = z__1.i;
00962 /* L80: */
00963                     }
00964 /* L90: */
00965                 }
00966             }
00967 
00968             anorm = zlange_("1", &n, &n, &a[a_offset], lda, &rwork[1]);
00969             bnorm = zlange_("1", &n, &n, &b[b_offset], lda, &rwork[1]);
00970 
00971 L100:
00972 
00973             if (iinfo != 0) {
00974                 io___41.ciunit = *nounit;
00975                 s_wsfe(&io___41);
00976                 do_fio(&c__1, "Generator", (ftnlen)9);
00977                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00978                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00979                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00980                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00981                 e_wsfe();
00982                 *info = abs(iinfo);
00983                 return 0;
00984             }
00985 
00986 L110:
00987 
00988 /*           Call ZGEQR2, ZUNM2R, and ZGGHRD to compute H, T, U, and V */
00989 
00990             zlacpy_(" ", &n, &n, &a[a_offset], lda, &h__[h_offset], lda);
00991             zlacpy_(" ", &n, &n, &b[b_offset], lda, &t[t_offset], lda);
00992             ntest = 1;
00993             result[1] = ulpinv;
00994 
00995             zgeqr2_(&n, &n, &t[t_offset], lda, &work[1], &work[n + 1], &iinfo)
00996                     ;
00997             if (iinfo != 0) {
00998                 io___42.ciunit = *nounit;
00999                 s_wsfe(&io___42);
01000                 do_fio(&c__1, "ZGEQR2", (ftnlen)6);
01001                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01002                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01003                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01004                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01005                 e_wsfe();
01006                 *info = abs(iinfo);
01007                 goto L210;
01008             }
01009 
01010             zunm2r_("L", "C", &n, &n, &n, &t[t_offset], lda, &work[1], &h__[
01011                     h_offset], lda, &work[n + 1], &iinfo);
01012             if (iinfo != 0) {
01013                 io___43.ciunit = *nounit;
01014                 s_wsfe(&io___43);
01015                 do_fio(&c__1, "ZUNM2R", (ftnlen)6);
01016                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01017                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01018                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01019                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01020                 e_wsfe();
01021                 *info = abs(iinfo);
01022                 goto L210;
01023             }
01024 
01025             zlaset_("Full", &n, &n, &c_b1, &c_b2, &u[u_offset], ldu);
01026             zunm2r_("R", "N", &n, &n, &n, &t[t_offset], lda, &work[1], &u[
01027                     u_offset], ldu, &work[n + 1], &iinfo);
01028             if (iinfo != 0) {
01029                 io___44.ciunit = *nounit;
01030                 s_wsfe(&io___44);
01031                 do_fio(&c__1, "ZUNM2R", (ftnlen)6);
01032                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01033                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01034                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01035                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01036                 e_wsfe();
01037                 *info = abs(iinfo);
01038                 goto L210;
01039             }
01040 
01041             zgghrd_("V", "I", &n, &c__1, &n, &h__[h_offset], lda, &t[t_offset]
01042 , lda, &u[u_offset], ldu, &v[v_offset], ldu, &iinfo);
01043             if (iinfo != 0) {
01044                 io___45.ciunit = *nounit;
01045                 s_wsfe(&io___45);
01046                 do_fio(&c__1, "ZGGHRD", (ftnlen)6);
01047                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01048                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01049                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01050                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01051                 e_wsfe();
01052                 *info = abs(iinfo);
01053                 goto L210;
01054             }
01055             ntest = 4;
01056 
01057 /*           Do tests 1--4 */
01058 
01059             zget51_(&c__1, &n, &a[a_offset], lda, &h__[h_offset], lda, &u[
01060                     u_offset], ldu, &v[v_offset], ldu, &work[1], &rwork[1], &
01061                     result[1]);
01062             zget51_(&c__1, &n, &b[b_offset], lda, &t[t_offset], lda, &u[
01063                     u_offset], ldu, &v[v_offset], ldu, &work[1], &rwork[1], &
01064                     result[2]);
01065             zget51_(&c__3, &n, &b[b_offset], lda, &t[t_offset], lda, &u[
01066                     u_offset], ldu, &u[u_offset], ldu, &work[1], &rwork[1], &
01067                     result[3]);
01068             zget51_(&c__3, &n, &b[b_offset], lda, &t[t_offset], lda, &v[
01069                     v_offset], ldu, &v[v_offset], ldu, &work[1], &rwork[1], &
01070                     result[4]);
01071 
01072 /*           Call ZHGEQZ to compute S1, P1, S2, P2, Q, and Z, do tests. */
01073 
01074 /*           Compute T1 and UZ */
01075 
01076 /*           Eigenvalues only */
01077 
01078             zlacpy_(" ", &n, &n, &h__[h_offset], lda, &s2[s2_offset], lda);
01079             zlacpy_(" ", &n, &n, &t[t_offset], lda, &p2[p2_offset], lda);
01080             ntest = 5;
01081             result[5] = ulpinv;
01082 
01083             zhgeqz_("E", "N", "N", &n, &c__1, &n, &s2[s2_offset], lda, &p2[
01084                     p2_offset], lda, &alpha3[1], &beta3[1], &q[q_offset], ldu, 
01085                      &z__[z_offset], ldu, &work[1], lwork, &rwork[1], &iinfo);
01086             if (iinfo != 0) {
01087                 io___46.ciunit = *nounit;
01088                 s_wsfe(&io___46);
01089                 do_fio(&c__1, "ZHGEQZ(E)", (ftnlen)9);
01090                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01091                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01092                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01093                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01094                 e_wsfe();
01095                 *info = abs(iinfo);
01096                 goto L210;
01097             }
01098 
01099 /*           Eigenvalues and Full Schur Form */
01100 
01101             zlacpy_(" ", &n, &n, &h__[h_offset], lda, &s2[s2_offset], lda);
01102             zlacpy_(" ", &n, &n, &t[t_offset], lda, &p2[p2_offset], lda);
01103 
01104             zhgeqz_("S", "N", "N", &n, &c__1, &n, &s2[s2_offset], lda, &p2[
01105                     p2_offset], lda, &alpha1[1], &beta1[1], &q[q_offset], ldu, 
01106                      &z__[z_offset], ldu, &work[1], lwork, &rwork[1], &iinfo);
01107             if (iinfo != 0) {
01108                 io___47.ciunit = *nounit;
01109                 s_wsfe(&io___47);
01110                 do_fio(&c__1, "ZHGEQZ(S)", (ftnlen)9);
01111                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01112                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01113                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01114                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01115                 e_wsfe();
01116                 *info = abs(iinfo);
01117                 goto L210;
01118             }
01119 
01120 /*           Eigenvalues, Schur Form, and Schur Vectors */
01121 
01122             zlacpy_(" ", &n, &n, &h__[h_offset], lda, &s1[s1_offset], lda);
01123             zlacpy_(" ", &n, &n, &t[t_offset], lda, &p1[p1_offset], lda);
01124 
01125             zhgeqz_("S", "I", "I", &n, &c__1, &n, &s1[s1_offset], lda, &p1[
01126                     p1_offset], lda, &alpha1[1], &beta1[1], &q[q_offset], ldu, 
01127                      &z__[z_offset], ldu, &work[1], lwork, &rwork[1], &iinfo);
01128             if (iinfo != 0) {
01129                 io___48.ciunit = *nounit;
01130                 s_wsfe(&io___48);
01131                 do_fio(&c__1, "ZHGEQZ(V)", (ftnlen)9);
01132                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01133                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01134                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01135                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01136                 e_wsfe();
01137                 *info = abs(iinfo);
01138                 goto L210;
01139             }
01140 
01141             ntest = 8;
01142 
01143 /*           Do Tests 5--8 */
01144 
01145             zget51_(&c__1, &n, &h__[h_offset], lda, &s1[s1_offset], lda, &q[
01146                     q_offset], ldu, &z__[z_offset], ldu, &work[1], &rwork[1], 
01147                     &result[5]);
01148             zget51_(&c__1, &n, &t[t_offset], lda, &p1[p1_offset], lda, &q[
01149                     q_offset], ldu, &z__[z_offset], ldu, &work[1], &rwork[1], 
01150                     &result[6]);
01151             zget51_(&c__3, &n, &t[t_offset], lda, &p1[p1_offset], lda, &q[
01152                     q_offset], ldu, &q[q_offset], ldu, &work[1], &rwork[1], &
01153                     result[7]);
01154             zget51_(&c__3, &n, &t[t_offset], lda, &p1[p1_offset], lda, &z__[
01155                     z_offset], ldu, &z__[z_offset], ldu, &work[1], &rwork[1], 
01156                     &result[8]);
01157 
01158 /*           Compute the Left and Right Eigenvectors of (S1,P1) */
01159 
01160 /*           9: Compute the left eigenvector Matrix without */
01161 /*              back transforming: */
01162 
01163             ntest = 9;
01164             result[9] = ulpinv;
01165 
01166 /*           To test "SELECT" option, compute half of the eigenvectors */
01167 /*           in one call, and half in another */
01168 
01169             i1 = n / 2;
01170             i__3 = i1;
01171             for (j = 1; j <= i__3; ++j) {
01172                 llwork[j] = TRUE_;
01173 /* L120: */
01174             }
01175             i__3 = n;
01176             for (j = i1 + 1; j <= i__3; ++j) {
01177                 llwork[j] = FALSE_;
01178 /* L130: */
01179             }
01180 
01181             ztgevc_("L", "S", &llwork[1], &n, &s1[s1_offset], lda, &p1[
01182                     p1_offset], lda, &evectl[evectl_offset], ldu, cdumma, ldu, 
01183                      &n, &in, &work[1], &rwork[1], &iinfo);
01184             if (iinfo != 0) {
01185                 io___51.ciunit = *nounit;
01186                 s_wsfe(&io___51);
01187                 do_fio(&c__1, "ZTGEVC(L,S1)", (ftnlen)12);
01188                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01189                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01190                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01191                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01192                 e_wsfe();
01193                 *info = abs(iinfo);
01194                 goto L210;
01195             }
01196 
01197             i1 = in;
01198             i__3 = i1;
01199             for (j = 1; j <= i__3; ++j) {
01200                 llwork[j] = FALSE_;
01201 /* L140: */
01202             }
01203             i__3 = n;
01204             for (j = i1 + 1; j <= i__3; ++j) {
01205                 llwork[j] = TRUE_;
01206 /* L150: */
01207             }
01208 
01209             ztgevc_("L", "S", &llwork[1], &n, &s1[s1_offset], lda, &p1[
01210                     p1_offset], lda, &evectl[(i1 + 1) * evectl_dim1 + 1], ldu, 
01211                      cdumma, ldu, &n, &in, &work[1], &rwork[1], &iinfo);
01212             if (iinfo != 0) {
01213                 io___52.ciunit = *nounit;
01214                 s_wsfe(&io___52);
01215                 do_fio(&c__1, "ZTGEVC(L,S2)", (ftnlen)12);
01216                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01217                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01218                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01219                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01220                 e_wsfe();
01221                 *info = abs(iinfo);
01222                 goto L210;
01223             }
01224 
01225             zget52_(&c_true, &n, &s1[s1_offset], lda, &p1[p1_offset], lda, &
01226                     evectl[evectl_offset], ldu, &alpha1[1], &beta1[1], &work[
01227                     1], &rwork[1], dumma);
01228             result[9] = dumma[0];
01229             if (dumma[1] > *thrshn) {
01230                 io___54.ciunit = *nounit;
01231                 s_wsfe(&io___54);
01232                 do_fio(&c__1, "Left", (ftnlen)4);
01233                 do_fio(&c__1, "ZTGEVC(HOWMNY=S)", (ftnlen)16);
01234                 do_fio(&c__1, (char *)&dumma[1], (ftnlen)sizeof(doublereal));
01235                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01236                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01237                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01238                 e_wsfe();
01239             }
01240 
01241 /*           10: Compute the left eigenvector Matrix with */
01242 /*               back transforming: */
01243 
01244             ntest = 10;
01245             result[10] = ulpinv;
01246             zlacpy_("F", &n, &n, &q[q_offset], ldu, &evectl[evectl_offset], 
01247                     ldu);
01248             ztgevc_("L", "B", &llwork[1], &n, &s1[s1_offset], lda, &p1[
01249                     p1_offset], lda, &evectl[evectl_offset], ldu, cdumma, ldu, 
01250                      &n, &in, &work[1], &rwork[1], &iinfo);
01251             if (iinfo != 0) {
01252                 io___55.ciunit = *nounit;
01253                 s_wsfe(&io___55);
01254                 do_fio(&c__1, "ZTGEVC(L,B)", (ftnlen)11);
01255                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01256                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01257                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01258                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01259                 e_wsfe();
01260                 *info = abs(iinfo);
01261                 goto L210;
01262             }
01263 
01264             zget52_(&c_true, &n, &h__[h_offset], lda, &t[t_offset], lda, &
01265                     evectl[evectl_offset], ldu, &alpha1[1], &beta1[1], &work[
01266                     1], &rwork[1], dumma);
01267             result[10] = dumma[0];
01268             if (dumma[1] > *thrshn) {
01269                 io___56.ciunit = *nounit;
01270                 s_wsfe(&io___56);
01271                 do_fio(&c__1, "Left", (ftnlen)4);
01272                 do_fio(&c__1, "ZTGEVC(HOWMNY=B)", (ftnlen)16);
01273                 do_fio(&c__1, (char *)&dumma[1], (ftnlen)sizeof(doublereal));
01274                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01275                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01276                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01277                 e_wsfe();
01278             }
01279 
01280 /*           11: Compute the right eigenvector Matrix without */
01281 /*               back transforming: */
01282 
01283             ntest = 11;
01284             result[11] = ulpinv;
01285 
01286 /*           To test "SELECT" option, compute half of the eigenvectors */
01287 /*           in one call, and half in another */
01288 
01289             i1 = n / 2;
01290             i__3 = i1;
01291             for (j = 1; j <= i__3; ++j) {
01292                 llwork[j] = TRUE_;
01293 /* L160: */
01294             }
01295             i__3 = n;
01296             for (j = i1 + 1; j <= i__3; ++j) {
01297                 llwork[j] = FALSE_;
01298 /* L170: */
01299             }
01300 
01301             ztgevc_("R", "S", &llwork[1], &n, &s1[s1_offset], lda, &p1[
01302                     p1_offset], lda, cdumma, ldu, &evectr[evectr_offset], ldu, 
01303                      &n, &in, &work[1], &rwork[1], &iinfo);
01304             if (iinfo != 0) {
01305                 io___57.ciunit = *nounit;
01306                 s_wsfe(&io___57);
01307                 do_fio(&c__1, "ZTGEVC(R,S1)", (ftnlen)12);
01308                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01309                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01310                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01311                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01312                 e_wsfe();
01313                 *info = abs(iinfo);
01314                 goto L210;
01315             }
01316 
01317             i1 = in;
01318             i__3 = i1;
01319             for (j = 1; j <= i__3; ++j) {
01320                 llwork[j] = FALSE_;
01321 /* L180: */
01322             }
01323             i__3 = n;
01324             for (j = i1 + 1; j <= i__3; ++j) {
01325                 llwork[j] = TRUE_;
01326 /* L190: */
01327             }
01328 
01329             ztgevc_("R", "S", &llwork[1], &n, &s1[s1_offset], lda, &p1[
01330                     p1_offset], lda, cdumma, ldu, &evectr[(i1 + 1) * 
01331                     evectr_dim1 + 1], ldu, &n, &in, &work[1], &rwork[1], &
01332                     iinfo);
01333             if (iinfo != 0) {
01334                 io___58.ciunit = *nounit;
01335                 s_wsfe(&io___58);
01336                 do_fio(&c__1, "ZTGEVC(R,S2)", (ftnlen)12);
01337                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01338                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01339                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01340                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01341                 e_wsfe();
01342                 *info = abs(iinfo);
01343                 goto L210;
01344             }
01345 
01346             zget52_(&c_false, &n, &s1[s1_offset], lda, &p1[p1_offset], lda, &
01347                     evectr[evectr_offset], ldu, &alpha1[1], &beta1[1], &work[
01348                     1], &rwork[1], dumma);
01349             result[11] = dumma[0];
01350             if (dumma[1] > *thresh) {
01351                 io___59.ciunit = *nounit;
01352                 s_wsfe(&io___59);
01353                 do_fio(&c__1, "Right", (ftnlen)5);
01354                 do_fio(&c__1, "ZTGEVC(HOWMNY=S)", (ftnlen)16);
01355                 do_fio(&c__1, (char *)&dumma[1], (ftnlen)sizeof(doublereal));
01356                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01357                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01358                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01359                 e_wsfe();
01360             }
01361 
01362 /*           12: Compute the right eigenvector Matrix with */
01363 /*               back transforming: */
01364 
01365             ntest = 12;
01366             result[12] = ulpinv;
01367             zlacpy_("F", &n, &n, &z__[z_offset], ldu, &evectr[evectr_offset], 
01368                     ldu);
01369             ztgevc_("R", "B", &llwork[1], &n, &s1[s1_offset], lda, &p1[
01370                     p1_offset], lda, cdumma, ldu, &evectr[evectr_offset], ldu, 
01371                      &n, &in, &work[1], &rwork[1], &iinfo);
01372             if (iinfo != 0) {
01373                 io___60.ciunit = *nounit;
01374                 s_wsfe(&io___60);
01375                 do_fio(&c__1, "ZTGEVC(R,B)", (ftnlen)11);
01376                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01377                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01378                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01379                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01380                 e_wsfe();
01381                 *info = abs(iinfo);
01382                 goto L210;
01383             }
01384 
01385             zget52_(&c_false, &n, &h__[h_offset], lda, &t[t_offset], lda, &
01386                     evectr[evectr_offset], ldu, &alpha1[1], &beta1[1], &work[
01387                     1], &rwork[1], dumma);
01388             result[12] = dumma[0];
01389             if (dumma[1] > *thresh) {
01390                 io___61.ciunit = *nounit;
01391                 s_wsfe(&io___61);
01392                 do_fio(&c__1, "Right", (ftnlen)5);
01393                 do_fio(&c__1, "ZTGEVC(HOWMNY=B)", (ftnlen)16);
01394                 do_fio(&c__1, (char *)&dumma[1], (ftnlen)sizeof(doublereal));
01395                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01396                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01397                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01398                 e_wsfe();
01399             }
01400 
01401 /*           Tests 13--15 are done only on request */
01402 
01403             if (*tstdif) {
01404 
01405 /*              Do Tests 13--14 */
01406 
01407                 zget51_(&c__2, &n, &s1[s1_offset], lda, &s2[s2_offset], lda, &
01408                         q[q_offset], ldu, &z__[z_offset], ldu, &work[1], &
01409                         rwork[1], &result[13]);
01410                 zget51_(&c__2, &n, &p1[p1_offset], lda, &p2[p2_offset], lda, &
01411                         q[q_offset], ldu, &z__[z_offset], ldu, &work[1], &
01412                         rwork[1], &result[14]);
01413 
01414 /*              Do Test 15 */
01415 
01416                 temp1 = 0.;
01417                 temp2 = 0.;
01418                 i__3 = n;
01419                 for (j = 1; j <= i__3; ++j) {
01420 /* Computing MAX */
01421                     i__4 = j;
01422                     i__5 = j;
01423                     z__1.r = alpha1[i__4].r - alpha3[i__5].r, z__1.i = alpha1[
01424                             i__4].i - alpha3[i__5].i;
01425                     d__1 = temp1, d__2 = z_abs(&z__1);
01426                     temp1 = max(d__1,d__2);
01427 /* Computing MAX */
01428                     i__4 = j;
01429                     i__5 = j;
01430                     z__1.r = beta1[i__4].r - beta3[i__5].r, z__1.i = beta1[
01431                             i__4].i - beta3[i__5].i;
01432                     d__1 = temp2, d__2 = z_abs(&z__1);
01433                     temp2 = max(d__1,d__2);
01434 /* L200: */
01435                 }
01436 
01437 /* Computing MAX */
01438                 d__1 = safmin, d__2 = ulp * max(temp1,anorm);
01439                 temp1 /= max(d__1,d__2);
01440 /* Computing MAX */
01441                 d__1 = safmin, d__2 = ulp * max(temp2,bnorm);
01442                 temp2 /= max(d__1,d__2);
01443                 result[15] = max(temp1,temp2);
01444                 ntest = 15;
01445             } else {
01446                 result[13] = 0.;
01447                 result[14] = 0.;
01448                 result[15] = 0.;
01449                 ntest = 12;
01450             }
01451 
01452 /*           End of Loop -- Check for RESULT(j) > THRESH */
01453 
01454 L210:
01455 
01456             ntestt += ntest;
01457 
01458 /*           Print out tests which fail. */
01459 
01460             i__3 = ntest;
01461             for (jr = 1; jr <= i__3; ++jr) {
01462                 if (result[jr] >= *thresh) {
01463 
01464 /*                 If this is the first test to fail, */
01465 /*                 print a header to the data file. */
01466 
01467                     if (nerrs == 0) {
01468                         io___64.ciunit = *nounit;
01469                         s_wsfe(&io___64);
01470                         do_fio(&c__1, "ZGG", (ftnlen)3);
01471                         e_wsfe();
01472 
01473 /*                    Matrix types */
01474 
01475                         io___65.ciunit = *nounit;
01476                         s_wsfe(&io___65);
01477                         e_wsfe();
01478                         io___66.ciunit = *nounit;
01479                         s_wsfe(&io___66);
01480                         e_wsfe();
01481                         io___67.ciunit = *nounit;
01482                         s_wsfe(&io___67);
01483                         do_fio(&c__1, "Unitary", (ftnlen)7);
01484                         e_wsfe();
01485 
01486 /*                    Tests performed */
01487 
01488                         io___68.ciunit = *nounit;
01489                         s_wsfe(&io___68);
01490                         do_fio(&c__1, "unitary", (ftnlen)7);
01491                         do_fio(&c__1, "*", (ftnlen)1);
01492                         do_fio(&c__1, "conjugate transpose", (ftnlen)19);
01493                         for (j = 1; j <= 10; ++j) {
01494                             do_fio(&c__1, "*", (ftnlen)1);
01495                         }
01496                         e_wsfe();
01497 
01498                     }
01499                     ++nerrs;
01500                     if (result[jr] < 1e4) {
01501                         io___69.ciunit = *nounit;
01502                         s_wsfe(&io___69);
01503                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01504                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01505                                 ;
01506                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01507                                 integer));
01508                         do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01509                         do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01510                                 doublereal));
01511                         e_wsfe();
01512                     } else {
01513                         io___70.ciunit = *nounit;
01514                         s_wsfe(&io___70);
01515                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01516                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01517                                 ;
01518                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01519                                 integer));
01520                         do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01521                         do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01522                                 doublereal));
01523                         e_wsfe();
01524                     }
01525                 }
01526 /* L220: */
01527             }
01528 
01529 L230:
01530             ;
01531         }
01532 /* L240: */
01533     }
01534 
01535 /*     Summary */
01536 
01537     dlasum_("ZGG", nounit, &nerrs, &ntestt);
01538     return 0;
01539 
01540 
01541 
01542 
01543 
01544 
01545 
01546 
01547 /*     End of ZCHKGG */
01548 
01549 } /* zchkgg_ */


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