cchkhs.c
Go to the documentation of this file.
00001 /* cchkhs.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 complex c_b2 = {1.f,0.f};
00020 static integer c__1 = 1;
00021 static real c_b27 = 1.f;
00022 static integer c__0 = 0;
00023 static real c_b33 = 0.f;
00024 static integer c__4 = 4;
00025 static integer c__6 = 6;
00026 
00027 /* Subroutine */ int cchkhs_(integer *nsizes, integer *nn, integer *ntypes, 
00028         logical *dotype, integer *iseed, real *thresh, integer *nounit, 
00029         complex *a, integer *lda, complex *h__, complex *t1, complex *t2, 
00030         complex *u, integer *ldu, complex *z__, complex *uz, complex *w1, 
00031         complex *w3, complex *evectl, complex *evectr, complex *evecty, 
00032         complex *evectx, complex *uu, complex *tau, complex *work, integer *
00033         nwork, real *rwork, integer *iwork, logical *select, real *result, 
00034         integer *info)
00035 {
00036     /* Initialized data */
00037 
00038     static integer ktype[21] = { 1,2,3,4,4,4,4,4,6,6,6,6,6,6,6,6,6,6,9,9,9 };
00039     static integer kmagn[21] = { 1,1,1,1,1,1,2,3,1,1,1,1,1,1,1,1,2,3,1,2,3 };
00040     static integer kmode[21] = { 0,0,0,4,3,1,4,4,4,3,1,5,4,3,1,5,5,5,4,3,1 };
00041     static integer kconds[21] = { 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,0,0,0 };
00042 
00043     /* Format strings */
00044     static char fmt_9999[] = "(\002 CCHKHS: \002,a,\002 returned INFO=\002,i"
00045             "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, ISEED="
00046             "(\002,3(i5,\002,\002),i5,\002)\002)";
00047     static char fmt_9998[] = "(\002 CCHKHS: \002,a,\002 Eigenvectors from"
00048             " \002,a,\002 incorrectly \002,\002normalized.\002,/\002 Bits of "
00049             "error=\002,0p,g10.3,\002,\002,9x,\002N=\002,i6,\002, JTYPE=\002,"
00050             "i6,\002, ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00051     static char fmt_9997[] = "(\002 CCHKHS: Selected \002,a,\002 Eigenvector"
00052             "s from \002,a,\002 do not match other eigenvectors \002,9x,\002N="
00053             "\002,i6,\002, JTYPE=\002,i6,\002, ISEED=(\002,3(i5,\002,\002),i5,"
00054             "\002)\002)";
00055 
00056     /* System generated locals */
00057     integer a_dim1, a_offset, evectl_dim1, evectl_offset, evectr_dim1, 
00058             evectr_offset, evectx_dim1, evectx_offset, evecty_dim1, 
00059             evecty_offset, h_dim1, h_offset, t1_dim1, t1_offset, t2_dim1, 
00060             t2_offset, u_dim1, u_offset, uu_dim1, uu_offset, uz_dim1, 
00061             uz_offset, z_dim1, z_offset, i__1, i__2, i__3, i__4, i__5, i__6;
00062     real r__1, r__2;
00063     complex q__1;
00064 
00065     /* Builtin functions */
00066     double sqrt(doublereal);
00067     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00068     double c_abs(complex *);
00069 
00070     /* Local variables */
00071     integer i__, j, k, n, n1, jj, in, ihi, ilo;
00072     real ulp, cond;
00073     integer jcol, nmax;
00074     real unfl, ovfl, temp1, temp2;
00075     logical badnn;
00076     extern /* Subroutine */ int cget10_(integer *, integer *, complex *, 
00077             integer *, complex *, integer *, complex *, real *, real *), 
00078             cget22_(char *, char *, char *, integer *, complex *, integer *, 
00079             complex *, integer *, complex *, complex *, real *, real *), cgemm_(char *, char *, integer *, 
00080             integer *, integer *, complex *, complex *, integer *, complex *, 
00081             integer *, complex *, complex *, integer *);
00082     logical match;
00083     integer imode;
00084     extern /* Subroutine */ int chst01_(integer *, integer *, integer *, 
00085             complex *, integer *, complex *, integer *, complex *, integer *, 
00086             complex *, integer *, real *, real *);
00087     real dumma[4];
00088     integer iinfo;
00089     real conds, aninv, anorm;
00090     extern /* Subroutine */ int ccopy_(integer *, complex *, integer *, 
00091             complex *, integer *);
00092     integer nmats, jsize, nerrs, itype, jtype, ntest;
00093     real rtulp;
00094     extern /* Subroutine */ int slabad_(real *, real *), cgehrd_(integer *, 
00095             integer *, integer *, complex *, integer *, complex *, complex *, 
00096             integer *, integer *), clatme_(integer *, char *, integer *, 
00097             complex *, integer *, real *, complex *, char *, char *, char *, 
00098             char *, real *, integer *, real *, integer *, integer *, real *, 
00099             complex *, integer *, complex *, integer *);
00100     complex cdumma[4];
00101     extern doublereal slamch_(char *);
00102     extern /* Subroutine */ int chsein_(char *, char *, char *, logical *, 
00103             integer *, complex *, integer *, complex *, complex *, integer *, 
00104             complex *, integer *, integer *, integer *, complex *, real *, 
00105             integer *, integer *, integer *), clacpy_(
00106             char *, integer *, integer *, complex *, integer *, complex *, 
00107             integer *);
00108     integer idumma[1];
00109     extern /* Subroutine */ int claset_(char *, integer *, integer *, complex 
00110             *, complex *, complex *, integer *);
00111     integer ioldsd[4];
00112     extern /* Subroutine */ int xerbla_(char *, integer *), clatmr_(
00113             integer *, integer *, char *, integer *, char *, complex *, 
00114             integer *, real *, complex *, char *, char *, complex *, integer *
00115 , real *, complex *, integer *, real *, char *, integer *, 
00116             integer *, integer *, real *, real *, char *, complex *, integer *
00117 , integer *, integer *), clatms_(integer *, integer *, char *, integer *, char *, 
00118             real *, integer *, real *, real *, integer *, integer *, char *, 
00119             complex *, integer *, complex *, integer *), chseqr_(char *, char *, integer *, integer *, integer *, 
00120             complex *, integer *, complex *, complex *, integer *, complex *, 
00121             integer *, integer *), ctrevc_(char *, char *, 
00122             logical *, integer *, complex *, integer *, complex *, integer *, 
00123             complex *, integer *, integer *, integer *, complex *, real *, 
00124             integer *), cunghr_(integer *, integer *, integer 
00125             *, complex *, integer *, complex *, complex *, integer *, integer 
00126             *), cunmhr_(char *, char *, integer *, integer *, integer *, 
00127             integer *, complex *, integer *, complex *, complex *, integer *, 
00128             complex *, integer *, integer *), slafts_(char *, 
00129             integer *, integer *, integer *, integer *, real *, integer *, 
00130             real *, integer *, integer *), slasum_(char *, integer *, 
00131             integer *, integer *);
00132     real rtunfl, rtovfl, rtulpi, ulpinv;
00133     integer mtypes, ntestt;
00134 
00135     /* Fortran I/O blocks */
00136     static cilist io___35 = { 0, 0, 0, fmt_9999, 0 };
00137     static cilist io___38 = { 0, 0, 0, fmt_9999, 0 };
00138     static cilist io___40 = { 0, 0, 0, fmt_9999, 0 };
00139     static cilist io___41 = { 0, 0, 0, fmt_9999, 0 };
00140     static cilist io___42 = { 0, 0, 0, fmt_9999, 0 };
00141     static cilist io___47 = { 0, 0, 0, fmt_9999, 0 };
00142     static cilist io___49 = { 0, 0, 0, fmt_9998, 0 };
00143     static cilist io___50 = { 0, 0, 0, fmt_9999, 0 };
00144     static cilist io___54 = { 0, 0, 0, fmt_9997, 0 };
00145     static cilist io___55 = { 0, 0, 0, fmt_9999, 0 };
00146     static cilist io___56 = { 0, 0, 0, fmt_9998, 0 };
00147     static cilist io___57 = { 0, 0, 0, fmt_9999, 0 };
00148     static cilist io___58 = { 0, 0, 0, fmt_9997, 0 };
00149     static cilist io___59 = { 0, 0, 0, fmt_9999, 0 };
00150     static cilist io___60 = { 0, 0, 0, fmt_9998, 0 };
00151     static cilist io___61 = { 0, 0, 0, fmt_9999, 0 };
00152     static cilist io___62 = { 0, 0, 0, fmt_9998, 0 };
00153     static cilist io___63 = { 0, 0, 0, fmt_9999, 0 };
00154     static cilist io___64 = { 0, 0, 0, fmt_9999, 0 };
00155 
00156 
00157 
00158 /*  -- LAPACK test routine (version 3.1.1) -- */
00159 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00160 /*     February 2007 */
00161 
00162 /*     .. Scalar Arguments .. */
00163 /*     .. */
00164 /*     .. Array Arguments .. */
00165 /*     .. */
00166 
00167 /*  Purpose */
00168 /*  ======= */
00169 
00170 /*     CCHKHS  checks the nonsymmetric eigenvalue problem routines. */
00171 
00172 /*             CGEHRD factors A as  U H U' , where ' means conjugate */
00173 /*             transpose, H is hessenberg, and U is unitary. */
00174 
00175 /*             CUNGHR generates the unitary matrix U. */
00176 
00177 /*             CUNMHR multiplies a matrix by the unitary matrix U. */
00178 
00179 /*             CHSEQR factors H as  Z T Z' , where Z is unitary and T */
00180 /*             is upper triangular.  It also computes the eigenvalues, */
00181 /*             w(1), ..., w(n); we define a diagonal matrix W whose */
00182 /*             (diagonal) entries are the eigenvalues. */
00183 
00184 /*             CTREVC computes the left eigenvector matrix L and the */
00185 /*             right eigenvector matrix R for the matrix T.  The */
00186 /*             columns of L are the complex conjugates of the left */
00187 /*             eigenvectors of T.  The columns of R are the right */
00188 /*             eigenvectors of T.  L is lower triangular, and R is */
00189 /*             upper triangular. */
00190 
00191 /*             CHSEIN computes the left eigenvector matrix Y and the */
00192 /*             right eigenvector matrix X for the matrix H.  The */
00193 /*             columns of Y are the complex conjugates of the left */
00194 /*             eigenvectors of H.  The columns of X are the right */
00195 /*             eigenvectors of H.  Y is lower triangular, and X is */
00196 /*             upper triangular. */
00197 
00198 /*     When CCHKHS is called, a number of matrix "sizes" ("n's") and a */
00199 /*     number of matrix "types" are specified.  For each size ("n") */
00200 /*     and each type of matrix, one matrix will be generated and used */
00201 /*     to test the nonsymmetric eigenroutines.  For each matrix, 14 */
00202 /*     tests will be performed: */
00203 
00204 /*     (1)     | A - U H U**H | / ( |A| n ulp ) */
00205 
00206 /*     (2)     | I - UU**H | / ( n ulp ) */
00207 
00208 /*     (3)     | H - Z T Z**H | / ( |H| n ulp ) */
00209 
00210 /*     (4)     | I - ZZ**H | / ( n ulp ) */
00211 
00212 /*     (5)     | A - UZ H (UZ)**H | / ( |A| n ulp ) */
00213 
00214 /*     (6)     | I - UZ (UZ)**H | / ( n ulp ) */
00215 
00216 /*     (7)     | T(Z computed) - T(Z not computed) | / ( |T| ulp ) */
00217 
00218 /*     (8)     | W(Z computed) - W(Z not computed) | / ( |W| ulp ) */
00219 
00220 /*     (9)     | TR - RW | / ( |T| |R| ulp ) */
00221 
00222 /*     (10)    | L**H T - W**H L | / ( |T| |L| ulp ) */
00223 
00224 /*     (11)    | HX - XW | / ( |H| |X| ulp ) */
00225 
00226 /*     (12)    | Y**H H - W**H Y | / ( |H| |Y| ulp ) */
00227 
00228 /*     (13)    | AX - XW | / ( |A| |X| ulp ) */
00229 
00230 /*     (14)    | Y**H A - W**H Y | / ( |A| |Y| ulp ) */
00231 
00232 /*     The "sizes" are specified by an array NN(1:NSIZES); the value of */
00233 /*     each element NN(j) specifies one size. */
00234 /*     The "types" are specified by a logical array DOTYPE( 1:NTYPES ); */
00235 /*     if DOTYPE(j) is .TRUE., then matrix type "j" will be generated. */
00236 /*     Currently, the list of possible types is: */
00237 
00238 /*     (1)  The zero matrix. */
00239 /*     (2)  The identity matrix. */
00240 /*     (3)  A (transposed) Jordan block, with 1's on the diagonal. */
00241 
00242 /*     (4)  A diagonal matrix with evenly spaced entries */
00243 /*          1, ..., ULP  and random complex angles. */
00244 /*          (ULP = (first number larger than 1) - 1 ) */
00245 /*     (5)  A diagonal matrix with geometrically spaced entries */
00246 /*          1, ..., ULP  and random complex angles. */
00247 /*     (6)  A diagonal matrix with "clustered" entries 1, ULP, ..., ULP */
00248 /*          and random complex angles. */
00249 
00250 /*     (7)  Same as (4), but multiplied by SQRT( overflow threshold ) */
00251 /*     (8)  Same as (4), but multiplied by SQRT( underflow threshold ) */
00252 
00253 /*     (9)  A matrix of the form  U' T U, where U is unitary and */
00254 /*          T has evenly spaced entries 1, ..., ULP with random complex */
00255 /*          angles on the diagonal and random O(1) entries in the upper */
00256 /*          triangle. */
00257 
00258 /*     (10) A matrix of the form  U' T U, where U is unitary and */
00259 /*          T has geometrically spaced entries 1, ..., ULP with random */
00260 /*          complex angles on the diagonal and random O(1) entries in */
00261 /*          the upper triangle. */
00262 
00263 /*     (11) A matrix of the form  U' T U, where U is unitary and */
00264 /*          T has "clustered" entries 1, ULP,..., ULP with random */
00265 /*          complex angles on the diagonal and random O(1) entries in */
00266 /*          the upper triangle. */
00267 
00268 /*     (12) A matrix of the form  U' T U, where U is unitary and */
00269 /*          T has complex eigenvalues randomly chosen from */
00270 /*          ULP < |z| < 1   and random O(1) entries in the upper */
00271 /*          triangle. */
00272 
00273 /*     (13) A matrix of the form  X' T X, where X has condition */
00274 /*          SQRT( ULP ) and T has evenly spaced entries 1, ..., ULP */
00275 /*          with random complex angles on the diagonal and random O(1) */
00276 /*          entries in the upper triangle. */
00277 
00278 /*     (14) A matrix of the form  X' T X, where X has condition */
00279 /*          SQRT( ULP ) and T has geometrically spaced entries */
00280 /*          1, ..., ULP with random complex angles on the diagonal */
00281 /*          and random O(1) entries in the upper triangle. */
00282 
00283 /*     (15) A matrix of the form  X' T X, where X has condition */
00284 /*          SQRT( ULP ) and T has "clustered" entries 1, ULP,..., ULP */
00285 /*          with random complex angles on the diagonal and random O(1) */
00286 /*          entries in the upper triangle. */
00287 
00288 /*     (16) A matrix of the form  X' T X, where X has condition */
00289 /*          SQRT( ULP ) and T has complex eigenvalues randomly chosen */
00290 /*          from   ULP < |z| < 1   and random O(1) entries in the upper */
00291 /*          triangle. */
00292 
00293 /*     (17) Same as (16), but multiplied by SQRT( overflow threshold ) */
00294 /*     (18) Same as (16), but multiplied by SQRT( underflow threshold ) */
00295 
00296 /*     (19) Nonsymmetric matrix with random entries chosen from |z| < 1 */
00297 /*     (20) Same as (19), but multiplied by SQRT( overflow threshold ) */
00298 /*     (21) Same as (19), but multiplied by SQRT( underflow threshold ) */
00299 
00300 /*  Arguments */
00301 /*  ========== */
00302 
00303 /*  NSIZES - INTEGER */
00304 /*           The number of sizes of matrices to use.  If it is zero, */
00305 /*           CCHKHS does nothing.  It must be at least zero. */
00306 /*           Not modified. */
00307 
00308 /*  NN     - INTEGER array, dimension (NSIZES) */
00309 /*           An array containing the sizes to be used for the matrices. */
00310 /*           Zero values will be skipped.  The values must be at least */
00311 /*           zero. */
00312 /*           Not modified. */
00313 
00314 /*  NTYPES - INTEGER */
00315 /*           The number of elements in DOTYPE.   If it is zero, CCHKHS */
00316 /*           does nothing.  It must be at least zero.  If it is MAXTYP+1 */
00317 /*           and NSIZES is 1, then an additional type, MAXTYP+1 is */
00318 /*           defined, which is to use whatever matrix is in A.  This */
00319 /*           is only useful if DOTYPE(1:MAXTYP) is .FALSE. and */
00320 /*           DOTYPE(MAXTYP+1) is .TRUE. . */
00321 /*           Not modified. */
00322 
00323 /*  DOTYPE - LOGICAL array, dimension (NTYPES) */
00324 /*           If DOTYPE(j) is .TRUE., then for each size in NN a */
00325 /*           matrix of that size and of type j will be generated. */
00326 /*           If NTYPES is smaller than the maximum number of types */
00327 /*           defined (PARAMETER MAXTYP), then types NTYPES+1 through */
00328 /*           MAXTYP will not be generated.  If NTYPES is larger */
00329 /*           than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) */
00330 /*           will be ignored. */
00331 /*           Not modified. */
00332 
00333 /*  ISEED  - INTEGER array, dimension (4) */
00334 /*           On entry ISEED specifies the seed of the random number */
00335 /*           generator. The array elements should be between 0 and 4095; */
00336 /*           if not they will be reduced mod 4096.  Also, ISEED(4) must */
00337 /*           be odd.  The random number generator uses a linear */
00338 /*           congruential sequence limited to small integers, and so */
00339 /*           should produce machine independent random numbers. The */
00340 /*           values of ISEED are changed on exit, and can be used in the */
00341 /*           next call to CCHKHS to continue the same random number */
00342 /*           sequence. */
00343 /*           Modified. */
00344 
00345 /*  THRESH - REAL */
00346 /*           A test will count as "failed" if the "error", computed as */
00347 /*           described above, exceeds THRESH.  Note that the error */
00348 /*           is scaled to be O(1), so THRESH should be a reasonably */
00349 /*           small multiple of 1, e.g., 10 or 100.  In particular, */
00350 /*           it should not depend on the precision (single vs. double) */
00351 /*           or the size of the matrix.  It must be at least zero. */
00352 /*           Not modified. */
00353 
00354 /*  NOUNIT - INTEGER */
00355 /*           The FORTRAN unit number for printing out error messages */
00356 /*           (e.g., if a routine returns IINFO not equal to 0.) */
00357 /*           Not modified. */
00358 
00359 /*  A      - COMPLEX array, dimension (LDA,max(NN)) */
00360 /*           Used to hold the matrix whose eigenvalues are to be */
00361 /*           computed.  On exit, A contains the last matrix actually */
00362 /*           used. */
00363 /*           Modified. */
00364 
00365 /*  LDA    - INTEGER */
00366 /*           The leading dimension of A, H, T1 and T2.  It must be at */
00367 /*           least 1 and at least max( NN ). */
00368 /*           Not modified. */
00369 
00370 /*  H      - COMPLEX array, dimension (LDA,max(NN)) */
00371 /*           The upper hessenberg matrix computed by CGEHRD.  On exit, */
00372 /*           H contains the Hessenberg form of the matrix in A. */
00373 /*           Modified. */
00374 
00375 /*  T1     - COMPLEX array, dimension (LDA,max(NN)) */
00376 /*           The Schur (="quasi-triangular") matrix computed by CHSEQR */
00377 /*           if Z is computed.  On exit, T1 contains the Schur form of */
00378 /*           the matrix in A. */
00379 /*           Modified. */
00380 
00381 /*  T2     - COMPLEX array, dimension (LDA,max(NN)) */
00382 /*           The Schur matrix computed by CHSEQR when Z is not computed. */
00383 /*           This should be identical to T1. */
00384 /*           Modified. */
00385 
00386 /*  LDU    - INTEGER */
00387 /*           The leading dimension of U, Z, UZ and UU.  It must be at */
00388 /*           least 1 and at least max( NN ). */
00389 /*           Not modified. */
00390 
00391 /*  U      - COMPLEX array, dimension (LDU,max(NN)) */
00392 /*           The unitary matrix computed by CGEHRD. */
00393 /*           Modified. */
00394 
00395 /*  Z      - COMPLEX array, dimension (LDU,max(NN)) */
00396 /*           The unitary matrix computed by CHSEQR. */
00397 /*           Modified. */
00398 
00399 /*  UZ     - COMPLEX array, dimension (LDU,max(NN)) */
00400 /*           The product of U times Z. */
00401 /*           Modified. */
00402 
00403 /*  W1     - COMPLEX array, dimension (max(NN)) */
00404 /*           The eigenvalues of A, as computed by a full Schur */
00405 /*           decomposition H = Z T Z'.  On exit, W1 contains the */
00406 /*           eigenvalues of the matrix in A. */
00407 /*           Modified. */
00408 
00409 /*  W3     - COMPLEX array, dimension (max(NN)) */
00410 /*           The eigenvalues of A, as computed by a partial Schur */
00411 /*           decomposition (Z not computed, T only computed as much */
00412 /*           as is necessary for determining eigenvalues).  On exit, */
00413 /*           W3 contains the eigenvalues of the matrix in A, possibly */
00414 /*           perturbed by CHSEIN. */
00415 /*           Modified. */
00416 
00417 /*  EVECTL - COMPLEX array, dimension (LDU,max(NN)) */
00418 /*           The conjugate transpose of the (upper triangular) left */
00419 /*           eigenvector matrix for the matrix in T1. */
00420 /*           Modified. */
00421 
00422 /*  EVECTR - COMPLEX array, dimension (LDU,max(NN)) */
00423 /*           The (upper triangular) right eigenvector matrix for the */
00424 /*           matrix in T1. */
00425 /*           Modified. */
00426 
00427 /*  EVECTY - COMPLEX array, dimension (LDU,max(NN)) */
00428 /*           The conjugate transpose of the left eigenvector matrix */
00429 /*           for the matrix in H. */
00430 /*           Modified. */
00431 
00432 /*  EVECTX - COMPLEX array, dimension (LDU,max(NN)) */
00433 /*           The right eigenvector matrix for the matrix in H. */
00434 /*           Modified. */
00435 
00436 /*  UU     - COMPLEX array, dimension (LDU,max(NN)) */
00437 /*           Details of the unitary matrix computed by CGEHRD. */
00438 /*           Modified. */
00439 
00440 /*  TAU    - COMPLEX array, dimension (max(NN)) */
00441 /*           Further details of the unitary matrix computed by CGEHRD. */
00442 /*           Modified. */
00443 
00444 /*  WORK   - COMPLEX array, dimension (NWORK) */
00445 /*           Workspace. */
00446 /*           Modified. */
00447 
00448 /*  NWORK  - INTEGER */
00449 /*           The number of entries in WORK.  NWORK >= 4*NN(j)*NN(j) + 2. */
00450 
00451 /*  RWORK  - REAL array, dimension (max(NN)) */
00452 /*           Workspace.  Could be equivalenced to IWORK, but not SELECT. */
00453 /*           Modified. */
00454 
00455 /*  IWORK  - INTEGER array, dimension (max(NN)) */
00456 /*           Workspace. */
00457 /*           Modified. */
00458 
00459 /*  SELECT - LOGICAL array, dimension (max(NN)) */
00460 /*           Workspace.  Could be equivalenced to IWORK, but not RWORK. */
00461 /*           Modified. */
00462 
00463 /*  RESULT - REAL array, dimension (14) */
00464 /*           The values computed by the fourteen tests described above. */
00465 /*           The values are currently limited to 1/ulp, to avoid */
00466 /*           overflow. */
00467 /*           Modified. */
00468 
00469 /*  INFO   - INTEGER */
00470 /*           If 0, then everything ran OK. */
00471 /*            -1: NSIZES < 0 */
00472 /*            -2: Some NN(j) < 0 */
00473 /*            -3: NTYPES < 0 */
00474 /*            -6: THRESH < 0 */
00475 /*            -9: LDA < 1 or LDA < NMAX, where NMAX is max( NN(j) ). */
00476 /*           -14: LDU < 1 or LDU < NMAX. */
00477 /*           -26: NWORK too small. */
00478 /*           If  CLATMR, CLATMS, or CLATME returns an error code, the */
00479 /*               absolute value of it is returned. */
00480 /*           If 1, then CHSEQR could not find all the shifts. */
00481 /*           If 2, then the EISPACK code (for small blocks) failed. */
00482 /*           If >2, then 30*N iterations were not enough to find an */
00483 /*               eigenvalue or to decompose the problem. */
00484 /*           Modified. */
00485 
00486 /* ----------------------------------------------------------------------- */
00487 
00488 /*     Some Local Variables and Parameters: */
00489 /*     ---- ----- --------- --- ---------- */
00490 
00491 /*     ZERO, ONE       Real 0 and 1. */
00492 /*     MAXTYP          The number of types defined. */
00493 /*     MTEST           The number of tests defined: care must be taken */
00494 /*                     that (1) the size of RESULT, (2) the number of */
00495 /*                     tests actually performed, and (3) MTEST agree. */
00496 /*     NTEST           The number of tests performed on this matrix */
00497 /*                     so far.  This should be less than MTEST, and */
00498 /*                     equal to it by the last test.  It will be less */
00499 /*                     if any of the routines being tested indicates */
00500 /*                     that it could not compute the matrices that */
00501 /*                     would be tested. */
00502 /*     NMAX            Largest value in NN. */
00503 /*     NMATS           The number of matrices generated so far. */
00504 /*     NERRS           The number of tests which have exceeded THRESH */
00505 /*                     so far (computed by SLAFTS). */
00506 /*     COND, CONDS, */
00507 /*     IMODE           Values to be passed to the matrix generators. */
00508 /*     ANORM           Norm of A; passed to matrix generators. */
00509 
00510 /*     OVFL, UNFL      Overflow and underflow thresholds. */
00511 /*     ULP, ULPINV     Finest relative precision and its inverse. */
00512 /*     RTOVFL, RTUNFL, */
00513 /*     RTULP, RTULPI   Square roots of the previous 4 values. */
00514 
00515 /*             The following four arrays decode JTYPE: */
00516 /*     KTYPE(j)        The general type (1-10) for type "j". */
00517 /*     KMODE(j)        The MODE value to be passed to the matrix */
00518 /*                     generator for type "j". */
00519 /*     KMAGN(j)        The order of magnitude ( O(1), */
00520 /*                     O(overflow^(1/2) ), O(underflow^(1/2) ) */
00521 /*     KCONDS(j)       Selects whether CONDS is to be 1 or */
00522 /*                     1/sqrt(ulp).  (0 means irrelevant.) */
00523 
00524 /*  ===================================================================== */
00525 
00526 /*     .. Parameters .. */
00527 /*     .. */
00528 /*     .. Local Scalars .. */
00529 /*     .. */
00530 /*     .. Local Arrays .. */
00531 /*     .. */
00532 /*     .. External Functions .. */
00533 /*     .. */
00534 /*     .. External Subroutines .. */
00535 /*     .. */
00536 /*     .. Intrinsic Functions .. */
00537 /*     .. */
00538 /*     .. Data statements .. */
00539     /* Parameter adjustments */
00540     --nn;
00541     --dotype;
00542     --iseed;
00543     t2_dim1 = *lda;
00544     t2_offset = 1 + t2_dim1;
00545     t2 -= t2_offset;
00546     t1_dim1 = *lda;
00547     t1_offset = 1 + t1_dim1;
00548     t1 -= t1_offset;
00549     h_dim1 = *lda;
00550     h_offset = 1 + h_dim1;
00551     h__ -= h_offset;
00552     a_dim1 = *lda;
00553     a_offset = 1 + a_dim1;
00554     a -= a_offset;
00555     uu_dim1 = *ldu;
00556     uu_offset = 1 + uu_dim1;
00557     uu -= uu_offset;
00558     evectx_dim1 = *ldu;
00559     evectx_offset = 1 + evectx_dim1;
00560     evectx -= evectx_offset;
00561     evecty_dim1 = *ldu;
00562     evecty_offset = 1 + evecty_dim1;
00563     evecty -= evecty_offset;
00564     evectr_dim1 = *ldu;
00565     evectr_offset = 1 + evectr_dim1;
00566     evectr -= evectr_offset;
00567     evectl_dim1 = *ldu;
00568     evectl_offset = 1 + evectl_dim1;
00569     evectl -= evectl_offset;
00570     uz_dim1 = *ldu;
00571     uz_offset = 1 + uz_dim1;
00572     uz -= uz_offset;
00573     z_dim1 = *ldu;
00574     z_offset = 1 + z_dim1;
00575     z__ -= z_offset;
00576     u_dim1 = *ldu;
00577     u_offset = 1 + u_dim1;
00578     u -= u_offset;
00579     --w1;
00580     --w3;
00581     --tau;
00582     --work;
00583     --rwork;
00584     --iwork;
00585     --select;
00586     --result;
00587 
00588     /* Function Body */
00589 /*     .. */
00590 /*     .. Executable Statements .. */
00591 
00592 /*     Check for errors */
00593 
00594     ntestt = 0;
00595     *info = 0;
00596 
00597     badnn = FALSE_;
00598     nmax = 0;
00599     i__1 = *nsizes;
00600     for (j = 1; j <= i__1; ++j) {
00601 /* Computing MAX */
00602         i__2 = nmax, i__3 = nn[j];
00603         nmax = max(i__2,i__3);
00604         if (nn[j] < 0) {
00605             badnn = TRUE_;
00606         }
00607 /* L10: */
00608     }
00609 
00610 /*     Check for errors */
00611 
00612     if (*nsizes < 0) {
00613         *info = -1;
00614     } else if (badnn) {
00615         *info = -2;
00616     } else if (*ntypes < 0) {
00617         *info = -3;
00618     } else if (*thresh < 0.f) {
00619         *info = -6;
00620     } else if (*lda <= 1 || *lda < nmax) {
00621         *info = -9;
00622     } else if (*ldu <= 1 || *ldu < nmax) {
00623         *info = -14;
00624     } else if ((nmax << 2) * nmax + 2 > *nwork) {
00625         *info = -26;
00626     }
00627 
00628     if (*info != 0) {
00629         i__1 = -(*info);
00630         xerbla_("CCHKHS", &i__1);
00631         return 0;
00632     }
00633 
00634 /*     Quick return if possible */
00635 
00636     if (*nsizes == 0 || *ntypes == 0) {
00637         return 0;
00638     }
00639 
00640 /*     More important constants */
00641 
00642     unfl = slamch_("Safe minimum");
00643     ovfl = slamch_("Overflow");
00644     slabad_(&unfl, &ovfl);
00645     ulp = slamch_("Epsilon") * slamch_("Base");
00646     ulpinv = 1.f / ulp;
00647     rtunfl = sqrt(unfl);
00648     rtovfl = sqrt(ovfl);
00649     rtulp = sqrt(ulp);
00650     rtulpi = 1.f / rtulp;
00651 
00652 /*     Loop over sizes, types */
00653 
00654     nerrs = 0;
00655     nmats = 0;
00656 
00657     i__1 = *nsizes;
00658     for (jsize = 1; jsize <= i__1; ++jsize) {
00659         n = nn[jsize];
00660         n1 = max(1,n);
00661         aninv = 1.f / (real) n1;
00662 
00663         if (*nsizes != 1) {
00664             mtypes = min(21,*ntypes);
00665         } else {
00666             mtypes = min(22,*ntypes);
00667         }
00668 
00669         i__2 = mtypes;
00670         for (jtype = 1; jtype <= i__2; ++jtype) {
00671             if (! dotype[jtype]) {
00672                 goto L250;
00673             }
00674             ++nmats;
00675             ntest = 0;
00676 
00677 /*           Save ISEED in case of an error. */
00678 
00679             for (j = 1; j <= 4; ++j) {
00680                 ioldsd[j - 1] = iseed[j];
00681 /* L20: */
00682             }
00683 
00684 /*           Initialize RESULT */
00685 
00686             for (j = 1; j <= 14; ++j) {
00687                 result[j] = 0.f;
00688 /* L30: */
00689             }
00690 
00691 /*           Compute "A" */
00692 
00693 /*           Control parameters: */
00694 
00695 /*           KMAGN  KCONDS  KMODE        KTYPE */
00696 /*       =1  O(1)   1       clustered 1  zero */
00697 /*       =2  large  large   clustered 2  identity */
00698 /*       =3  small          exponential  Jordan */
00699 /*       =4                 arithmetic   diagonal, (w/ eigenvalues) */
00700 /*       =5                 random log   hermitian, w/ eigenvalues */
00701 /*       =6                 random       general, w/ eigenvalues */
00702 /*       =7                              random diagonal */
00703 /*       =8                              random hermitian */
00704 /*       =9                              random general */
00705 /*       =10                             random triangular */
00706 
00707             if (mtypes > 21) {
00708                 goto L100;
00709             }
00710 
00711             itype = ktype[jtype - 1];
00712             imode = kmode[jtype - 1];
00713 
00714 /*           Compute norm */
00715 
00716             switch (kmagn[jtype - 1]) {
00717                 case 1:  goto L40;
00718                 case 2:  goto L50;
00719                 case 3:  goto L60;
00720             }
00721 
00722 L40:
00723             anorm = 1.f;
00724             goto L70;
00725 
00726 L50:
00727             anorm = rtovfl * ulp * aninv;
00728             goto L70;
00729 
00730 L60:
00731             anorm = rtunfl * n * ulpinv;
00732             goto L70;
00733 
00734 L70:
00735 
00736             claset_("Full", lda, &n, &c_b1, &c_b1, &a[a_offset], lda);
00737             iinfo = 0;
00738             cond = ulpinv;
00739 
00740 /*           Special Matrices */
00741 
00742             if (itype == 1) {
00743 
00744 /*              Zero */
00745 
00746                 iinfo = 0;
00747             } else if (itype == 2) {
00748 
00749 /*              Identity */
00750 
00751                 i__3 = n;
00752                 for (jcol = 1; jcol <= i__3; ++jcol) {
00753                     i__4 = jcol + jcol * a_dim1;
00754                     a[i__4].r = anorm, a[i__4].i = 0.f;
00755 /* L80: */
00756                 }
00757 
00758             } else if (itype == 3) {
00759 
00760 /*              Jordan Block */
00761 
00762                 i__3 = n;
00763                 for (jcol = 1; jcol <= i__3; ++jcol) {
00764                     i__4 = jcol + jcol * a_dim1;
00765                     a[i__4].r = anorm, a[i__4].i = 0.f;
00766                     if (jcol > 1) {
00767                         i__4 = jcol + (jcol - 1) * a_dim1;
00768                         a[i__4].r = 1.f, a[i__4].i = 0.f;
00769                     }
00770 /* L90: */
00771                 }
00772 
00773             } else if (itype == 4) {
00774 
00775 /*              Diagonal Matrix, [Eigen]values Specified */
00776 
00777                 clatmr_(&n, &n, "D", &iseed[1], "N", &work[1], &imode, &cond, 
00778                         &c_b2, "T", "N", &work[n + 1], &c__1, &c_b27, &work[(
00779                         n << 1) + 1], &c__1, &c_b27, "N", idumma, &c__0, &
00780                         c__0, &c_b33, &anorm, "NO", &a[a_offset], lda, &iwork[
00781                         1], &iinfo);
00782 
00783             } else if (itype == 5) {
00784 
00785 /*              Hermitian, eigenvalues specified */
00786 
00787                 clatms_(&n, &n, "D", &iseed[1], "H", &rwork[1], &imode, &cond, 
00788                          &anorm, &n, &n, "N", &a[a_offset], lda, &work[1], &
00789                         iinfo);
00790 
00791             } else if (itype == 6) {
00792 
00793 /*              General, eigenvalues specified */
00794 
00795                 if (kconds[jtype - 1] == 1) {
00796                     conds = 1.f;
00797                 } else if (kconds[jtype - 1] == 2) {
00798                     conds = rtulpi;
00799                 } else {
00800                     conds = 0.f;
00801                 }
00802 
00803                 clatme_(&n, "D", &iseed[1], &work[1], &imode, &cond, &c_b2, 
00804                         " ", "T", "T", "T", &rwork[1], &c__4, &conds, &n, &n, 
00805                         &anorm, &a[a_offset], lda, &work[n + 1], &iinfo);
00806 
00807             } else if (itype == 7) {
00808 
00809 /*              Diagonal, random eigenvalues */
00810 
00811                 clatmr_(&n, &n, "D", &iseed[1], "N", &work[1], &c__6, &c_b27, 
00812                         &c_b2, "T", "N", &work[n + 1], &c__1, &c_b27, &work[(
00813                         n << 1) + 1], &c__1, &c_b27, "N", idumma, &c__0, &
00814                         c__0, &c_b33, &anorm, "NO", &a[a_offset], lda, &iwork[
00815                         1], &iinfo);
00816 
00817             } else if (itype == 8) {
00818 
00819 /*              Hermitian, random eigenvalues */
00820 
00821                 clatmr_(&n, &n, "D", &iseed[1], "H", &work[1], &c__6, &c_b27, 
00822                         &c_b2, "T", "N", &work[n + 1], &c__1, &c_b27, &work[(
00823                         n << 1) + 1], &c__1, &c_b27, "N", idumma, &n, &n, &
00824                         c_b33, &anorm, "NO", &a[a_offset], lda, &iwork[1], &
00825                         iinfo);
00826 
00827             } else if (itype == 9) {
00828 
00829 /*              General, random eigenvalues */
00830 
00831                 clatmr_(&n, &n, "D", &iseed[1], "N", &work[1], &c__6, &c_b27, 
00832                         &c_b2, "T", "N", &work[n + 1], &c__1, &c_b27, &work[(
00833                         n << 1) + 1], &c__1, &c_b27, "N", idumma, &n, &n, &
00834                         c_b33, &anorm, "NO", &a[a_offset], lda, &iwork[1], &
00835                         iinfo);
00836 
00837             } else if (itype == 10) {
00838 
00839 /*              Triangular, random eigenvalues */
00840 
00841                 clatmr_(&n, &n, "D", &iseed[1], "N", &work[1], &c__6, &c_b27, 
00842                         &c_b2, "T", "N", &work[n + 1], &c__1, &c_b27, &work[(
00843                         n << 1) + 1], &c__1, &c_b27, "N", idumma, &n, &c__0, &
00844                         c_b33, &anorm, "NO", &a[a_offset], lda, &iwork[1], &
00845                         iinfo);
00846 
00847             } else {
00848 
00849                 iinfo = 1;
00850             }
00851 
00852             if (iinfo != 0) {
00853                 io___35.ciunit = *nounit;
00854                 s_wsfe(&io___35);
00855                 do_fio(&c__1, "Generator", (ftnlen)9);
00856                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00857                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00858                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00859                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00860                 e_wsfe();
00861                 *info = abs(iinfo);
00862                 return 0;
00863             }
00864 
00865 L100:
00866 
00867 /*           Call CGEHRD to compute H and U, do tests. */
00868 
00869             clacpy_(" ", &n, &n, &a[a_offset], lda, &h__[h_offset], lda);
00870             ntest = 1;
00871 
00872             ilo = 1;
00873             ihi = n;
00874 
00875             i__3 = *nwork - n;
00876             cgehrd_(&n, &ilo, &ihi, &h__[h_offset], lda, &work[1], &work[n + 
00877                     1], &i__3, &iinfo);
00878 
00879             if (iinfo != 0) {
00880                 result[1] = ulpinv;
00881                 io___38.ciunit = *nounit;
00882                 s_wsfe(&io___38);
00883                 do_fio(&c__1, "CGEHRD", (ftnlen)6);
00884                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00885                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00886                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00887                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00888                 e_wsfe();
00889                 *info = abs(iinfo);
00890                 goto L240;
00891             }
00892 
00893             i__3 = n - 1;
00894             for (j = 1; j <= i__3; ++j) {
00895                 i__4 = j + 1 + j * uu_dim1;
00896                 uu[i__4].r = 0.f, uu[i__4].i = 0.f;
00897                 i__4 = n;
00898                 for (i__ = j + 2; i__ <= i__4; ++i__) {
00899                     i__5 = i__ + j * u_dim1;
00900                     i__6 = i__ + j * h_dim1;
00901                     u[i__5].r = h__[i__6].r, u[i__5].i = h__[i__6].i;
00902                     i__5 = i__ + j * uu_dim1;
00903                     i__6 = i__ + j * h_dim1;
00904                     uu[i__5].r = h__[i__6].r, uu[i__5].i = h__[i__6].i;
00905                     i__5 = i__ + j * h_dim1;
00906                     h__[i__5].r = 0.f, h__[i__5].i = 0.f;
00907 /* L110: */
00908                 }
00909 /* L120: */
00910             }
00911             i__3 = n - 1;
00912             ccopy_(&i__3, &work[1], &c__1, &tau[1], &c__1);
00913             i__3 = *nwork - n;
00914             cunghr_(&n, &ilo, &ihi, &u[u_offset], ldu, &work[1], &work[n + 1], 
00915                      &i__3, &iinfo);
00916             ntest = 2;
00917 
00918             chst01_(&n, &ilo, &ihi, &a[a_offset], lda, &h__[h_offset], lda, &
00919                     u[u_offset], ldu, &work[1], nwork, &rwork[1], &result[1]);
00920 
00921 /*           Call CHSEQR to compute T1, T2 and Z, do tests. */
00922 
00923 /*           Eigenvalues only (W3) */
00924 
00925             clacpy_(" ", &n, &n, &h__[h_offset], lda, &t2[t2_offset], lda);
00926             ntest = 3;
00927             result[3] = ulpinv;
00928 
00929             chseqr_("E", "N", &n, &ilo, &ihi, &t2[t2_offset], lda, &w3[1], &
00930                     uz[uz_offset], ldu, &work[1], nwork, &iinfo);
00931             if (iinfo != 0) {
00932                 io___40.ciunit = *nounit;
00933                 s_wsfe(&io___40);
00934                 do_fio(&c__1, "CHSEQR(E)", (ftnlen)9);
00935                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00936                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00937                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00938                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00939                 e_wsfe();
00940                 if (iinfo <= n + 2) {
00941                     *info = abs(iinfo);
00942                     goto L240;
00943                 }
00944             }
00945 
00946 /*           Eigenvalues (W1) and Full Schur Form (T2) */
00947 
00948             clacpy_(" ", &n, &n, &h__[h_offset], lda, &t2[t2_offset], lda);
00949 
00950             chseqr_("S", "N", &n, &ilo, &ihi, &t2[t2_offset], lda, &w1[1], &
00951                     uz[uz_offset], ldu, &work[1], nwork, &iinfo);
00952             if (iinfo != 0 && iinfo <= n + 2) {
00953                 io___41.ciunit = *nounit;
00954                 s_wsfe(&io___41);
00955                 do_fio(&c__1, "CHSEQR(S)", (ftnlen)9);
00956                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00957                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00958                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00959                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00960                 e_wsfe();
00961                 *info = abs(iinfo);
00962                 goto L240;
00963             }
00964 
00965 /*           Eigenvalues (W1), Schur Form (T1), and Schur Vectors (UZ) */
00966 
00967             clacpy_(" ", &n, &n, &h__[h_offset], lda, &t1[t1_offset], lda);
00968             clacpy_(" ", &n, &n, &u[u_offset], ldu, &uz[uz_offset], ldu);
00969 
00970             chseqr_("S", "V", &n, &ilo, &ihi, &t1[t1_offset], lda, &w1[1], &
00971                     uz[uz_offset], ldu, &work[1], nwork, &iinfo);
00972             if (iinfo != 0 && iinfo <= n + 2) {
00973                 io___42.ciunit = *nounit;
00974                 s_wsfe(&io___42);
00975                 do_fio(&c__1, "CHSEQR(V)", (ftnlen)9);
00976                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00977                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00978                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00979                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00980                 e_wsfe();
00981                 *info = abs(iinfo);
00982                 goto L240;
00983             }
00984 
00985 /*           Compute Z = U' UZ */
00986 
00987             cgemm_("C", "N", &n, &n, &n, &c_b2, &u[u_offset], ldu, &uz[
00988                     uz_offset], ldu, &c_b1, &z__[z_offset], ldu);
00989             ntest = 8;
00990 
00991 /*           Do Tests 3: | H - Z T Z' | / ( |H| n ulp ) */
00992 /*                and 4: | I - Z Z' | / ( n ulp ) */
00993 
00994             chst01_(&n, &ilo, &ihi, &h__[h_offset], lda, &t1[t1_offset], lda, 
00995                     &z__[z_offset], ldu, &work[1], nwork, &rwork[1], &result[
00996                     3]);
00997 
00998 /*           Do Tests 5: | A - UZ T (UZ)' | / ( |A| n ulp ) */
00999 /*                and 6: | I - UZ (UZ)' | / ( n ulp ) */
01000 
01001             chst01_(&n, &ilo, &ihi, &a[a_offset], lda, &t1[t1_offset], lda, &
01002                     uz[uz_offset], ldu, &work[1], nwork, &rwork[1], &result[5]
01003 );
01004 
01005 /*           Do Test 7: | T2 - T1 | / ( |T| n ulp ) */
01006 
01007             cget10_(&n, &n, &t2[t2_offset], lda, &t1[t1_offset], lda, &work[1]
01008 , &rwork[1], &result[7]);
01009 
01010 /*           Do Test 8: | W3 - W1 | / ( max(|W1|,|W3|) ulp ) */
01011 
01012             temp1 = 0.f;
01013             temp2 = 0.f;
01014             i__3 = n;
01015             for (j = 1; j <= i__3; ++j) {
01016 /* Computing MAX */
01017                 r__1 = temp1, r__2 = c_abs(&w1[j]), r__1 = max(r__1,r__2), 
01018                         r__2 = c_abs(&w3[j]);
01019                 temp1 = dmax(r__1,r__2);
01020 /* Computing MAX */
01021                 i__4 = j;
01022                 i__5 = j;
01023                 q__1.r = w1[i__4].r - w3[i__5].r, q__1.i = w1[i__4].i - w3[
01024                         i__5].i;
01025                 r__1 = temp2, r__2 = c_abs(&q__1);
01026                 temp2 = dmax(r__1,r__2);
01027 /* L130: */
01028             }
01029 
01030 /* Computing MAX */
01031             r__1 = unfl, r__2 = ulp * dmax(temp1,temp2);
01032             result[8] = temp2 / dmax(r__1,r__2);
01033 
01034 /*           Compute the Left and Right Eigenvectors of T */
01035 
01036 /*           Compute the Right eigenvector Matrix: */
01037 
01038             ntest = 9;
01039             result[9] = ulpinv;
01040 
01041 /*           Select every other eigenvector */
01042 
01043             i__3 = n;
01044             for (j = 1; j <= i__3; ++j) {
01045                 select[j] = FALSE_;
01046 /* L140: */
01047             }
01048             i__3 = n;
01049             for (j = 1; j <= i__3; j += 2) {
01050                 select[j] = TRUE_;
01051 /* L150: */
01052             }
01053             ctrevc_("Right", "All", &select[1], &n, &t1[t1_offset], lda, 
01054                     cdumma, ldu, &evectr[evectr_offset], ldu, &n, &in, &work[
01055                     1], &rwork[1], &iinfo);
01056             if (iinfo != 0) {
01057                 io___47.ciunit = *nounit;
01058                 s_wsfe(&io___47);
01059                 do_fio(&c__1, "CTREVC(R,A)", (ftnlen)11);
01060                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01061                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01062                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01063                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01064                 e_wsfe();
01065                 *info = abs(iinfo);
01066                 goto L240;
01067             }
01068 
01069 /*           Test 9:  | TR - RW | / ( |T| |R| ulp ) */
01070 
01071             cget22_("N", "N", "N", &n, &t1[t1_offset], lda, &evectr[
01072                     evectr_offset], ldu, &w1[1], &work[1], &rwork[1], dumma);
01073             result[9] = dumma[0];
01074             if (dumma[1] > *thresh) {
01075                 io___49.ciunit = *nounit;
01076                 s_wsfe(&io___49);
01077                 do_fio(&c__1, "Right", (ftnlen)5);
01078                 do_fio(&c__1, "CTREVC", (ftnlen)6);
01079                 do_fio(&c__1, (char *)&dumma[1], (ftnlen)sizeof(real));
01080                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01081                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01082                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01083                 e_wsfe();
01084             }
01085 
01086 /*           Compute selected right eigenvectors and confirm that */
01087 /*           they agree with previous right eigenvectors */
01088 
01089             ctrevc_("Right", "Some", &select[1], &n, &t1[t1_offset], lda, 
01090                     cdumma, ldu, &evectl[evectl_offset], ldu, &n, &in, &work[
01091                     1], &rwork[1], &iinfo);
01092             if (iinfo != 0) {
01093                 io___50.ciunit = *nounit;
01094                 s_wsfe(&io___50);
01095                 do_fio(&c__1, "CTREVC(R,S)", (ftnlen)11);
01096                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01097                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01098                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01099                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01100                 e_wsfe();
01101                 *info = abs(iinfo);
01102                 goto L240;
01103             }
01104 
01105             k = 1;
01106             match = TRUE_;
01107             i__3 = n;
01108             for (j = 1; j <= i__3; ++j) {
01109                 if (select[j]) {
01110                     i__4 = n;
01111                     for (jj = 1; jj <= i__4; ++jj) {
01112                         i__5 = jj + j * evectr_dim1;
01113                         i__6 = jj + k * evectl_dim1;
01114                         if (evectr[i__5].r != evectl[i__6].r || evectr[i__5]
01115                                 .i != evectl[i__6].i) {
01116                             match = FALSE_;
01117                             goto L180;
01118                         }
01119 /* L160: */
01120                     }
01121                     ++k;
01122                 }
01123 /* L170: */
01124             }
01125 L180:
01126             if (! match) {
01127                 io___54.ciunit = *nounit;
01128                 s_wsfe(&io___54);
01129                 do_fio(&c__1, "Right", (ftnlen)5);
01130                 do_fio(&c__1, "CTREVC", (ftnlen)6);
01131                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01132                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01133                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01134                 e_wsfe();
01135             }
01136 
01137 /*           Compute the Left eigenvector Matrix: */
01138 
01139             ntest = 10;
01140             result[10] = ulpinv;
01141             ctrevc_("Left", "All", &select[1], &n, &t1[t1_offset], lda, &
01142                     evectl[evectl_offset], ldu, cdumma, ldu, &n, &in, &work[1]
01143 , &rwork[1], &iinfo);
01144             if (iinfo != 0) {
01145                 io___55.ciunit = *nounit;
01146                 s_wsfe(&io___55);
01147                 do_fio(&c__1, "CTREVC(L,A)", (ftnlen)11);
01148                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01149                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01150                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01151                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01152                 e_wsfe();
01153                 *info = abs(iinfo);
01154                 goto L240;
01155             }
01156 
01157 /*           Test 10:  | LT - WL | / ( |T| |L| ulp ) */
01158 
01159             cget22_("C", "N", "C", &n, &t1[t1_offset], lda, &evectl[
01160                     evectl_offset], ldu, &w1[1], &work[1], &rwork[1], &dumma[
01161                     2]);
01162             result[10] = dumma[2];
01163             if (dumma[3] > *thresh) {
01164                 io___56.ciunit = *nounit;
01165                 s_wsfe(&io___56);
01166                 do_fio(&c__1, "Left", (ftnlen)4);
01167                 do_fio(&c__1, "CTREVC", (ftnlen)6);
01168                 do_fio(&c__1, (char *)&dumma[3], (ftnlen)sizeof(real));
01169                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01170                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01171                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01172                 e_wsfe();
01173             }
01174 
01175 /*           Compute selected left eigenvectors and confirm that */
01176 /*           they agree with previous left eigenvectors */
01177 
01178             ctrevc_("Left", "Some", &select[1], &n, &t1[t1_offset], lda, &
01179                     evectr[evectr_offset], ldu, cdumma, ldu, &n, &in, &work[1]
01180 , &rwork[1], &iinfo);
01181             if (iinfo != 0) {
01182                 io___57.ciunit = *nounit;
01183                 s_wsfe(&io___57);
01184                 do_fio(&c__1, "CTREVC(L,S)", (ftnlen)11);
01185                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01186                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01187                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01188                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01189                 e_wsfe();
01190                 *info = abs(iinfo);
01191                 goto L240;
01192             }
01193 
01194             k = 1;
01195             match = TRUE_;
01196             i__3 = n;
01197             for (j = 1; j <= i__3; ++j) {
01198                 if (select[j]) {
01199                     i__4 = n;
01200                     for (jj = 1; jj <= i__4; ++jj) {
01201                         i__5 = jj + j * evectl_dim1;
01202                         i__6 = jj + k * evectr_dim1;
01203                         if (evectl[i__5].r != evectr[i__6].r || evectl[i__5]
01204                                 .i != evectr[i__6].i) {
01205                             match = FALSE_;
01206                             goto L210;
01207                         }
01208 /* L190: */
01209                     }
01210                     ++k;
01211                 }
01212 /* L200: */
01213             }
01214 L210:
01215             if (! match) {
01216                 io___58.ciunit = *nounit;
01217                 s_wsfe(&io___58);
01218                 do_fio(&c__1, "Left", (ftnlen)4);
01219                 do_fio(&c__1, "CTREVC", (ftnlen)6);
01220                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01221                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01222                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01223                 e_wsfe();
01224             }
01225 
01226 /*           Call CHSEIN for Right eigenvectors of H, do test 11 */
01227 
01228             ntest = 11;
01229             result[11] = ulpinv;
01230             i__3 = n;
01231             for (j = 1; j <= i__3; ++j) {
01232                 select[j] = TRUE_;
01233 /* L220: */
01234             }
01235 
01236             chsein_("Right", "Qr", "Ninitv", &select[1], &n, &h__[h_offset], 
01237                     lda, &w3[1], cdumma, ldu, &evectx[evectx_offset], ldu, &
01238                     n1, &in, &work[1], &rwork[1], &iwork[1], &iwork[1], &
01239                     iinfo);
01240             if (iinfo != 0) {
01241                 io___59.ciunit = *nounit;
01242                 s_wsfe(&io___59);
01243                 do_fio(&c__1, "CHSEIN(R)", (ftnlen)9);
01244                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01245                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01246                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01247                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01248                 e_wsfe();
01249                 *info = abs(iinfo);
01250                 if (iinfo < 0) {
01251                     goto L240;
01252                 }
01253             } else {
01254 
01255 /*              Test 11:  | HX - XW | / ( |H| |X| ulp ) */
01256 
01257 /*                        (from inverse iteration) */
01258 
01259                 cget22_("N", "N", "N", &n, &h__[h_offset], lda, &evectx[
01260                         evectx_offset], ldu, &w3[1], &work[1], &rwork[1], 
01261                         dumma);
01262                 if (dumma[0] < ulpinv) {
01263                     result[11] = dumma[0] * aninv;
01264                 }
01265                 if (dumma[1] > *thresh) {
01266                     io___60.ciunit = *nounit;
01267                     s_wsfe(&io___60);
01268                     do_fio(&c__1, "Right", (ftnlen)5);
01269                     do_fio(&c__1, "CHSEIN", (ftnlen)6);
01270                     do_fio(&c__1, (char *)&dumma[1], (ftnlen)sizeof(real));
01271                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01272                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01273                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
01274                             ;
01275                     e_wsfe();
01276                 }
01277             }
01278 
01279 /*           Call CHSEIN for Left eigenvectors of H, do test 12 */
01280 
01281             ntest = 12;
01282             result[12] = ulpinv;
01283             i__3 = n;
01284             for (j = 1; j <= i__3; ++j) {
01285                 select[j] = TRUE_;
01286 /* L230: */
01287             }
01288 
01289             chsein_("Left", "Qr", "Ninitv", &select[1], &n, &h__[h_offset], 
01290                     lda, &w3[1], &evecty[evecty_offset], ldu, cdumma, ldu, &
01291                     n1, &in, &work[1], &rwork[1], &iwork[1], &iwork[1], &
01292                     iinfo);
01293             if (iinfo != 0) {
01294                 io___61.ciunit = *nounit;
01295                 s_wsfe(&io___61);
01296                 do_fio(&c__1, "CHSEIN(L)", (ftnlen)9);
01297                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01298                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01299                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01300                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01301                 e_wsfe();
01302                 *info = abs(iinfo);
01303                 if (iinfo < 0) {
01304                     goto L240;
01305                 }
01306             } else {
01307 
01308 /*              Test 12:  | YH - WY | / ( |H| |Y| ulp ) */
01309 
01310 /*                        (from inverse iteration) */
01311 
01312                 cget22_("C", "N", "C", &n, &h__[h_offset], lda, &evecty[
01313                         evecty_offset], ldu, &w3[1], &work[1], &rwork[1], &
01314                         dumma[2]);
01315                 if (dumma[2] < ulpinv) {
01316                     result[12] = dumma[2] * aninv;
01317                 }
01318                 if (dumma[3] > *thresh) {
01319                     io___62.ciunit = *nounit;
01320                     s_wsfe(&io___62);
01321                     do_fio(&c__1, "Left", (ftnlen)4);
01322                     do_fio(&c__1, "CHSEIN", (ftnlen)6);
01323                     do_fio(&c__1, (char *)&dumma[3], (ftnlen)sizeof(real));
01324                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01325                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01326                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
01327                             ;
01328                     e_wsfe();
01329                 }
01330             }
01331 
01332 /*           Call CUNMHR for Right eigenvectors of A, do test 13 */
01333 
01334             ntest = 13;
01335             result[13] = ulpinv;
01336 
01337             cunmhr_("Left", "No transpose", &n, &n, &ilo, &ihi, &uu[uu_offset]
01338 , ldu, &tau[1], &evectx[evectx_offset], ldu, &work[1], 
01339                     nwork, &iinfo);
01340             if (iinfo != 0) {
01341                 io___63.ciunit = *nounit;
01342                 s_wsfe(&io___63);
01343                 do_fio(&c__1, "CUNMHR(L)", (ftnlen)9);
01344                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01345                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01346                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01347                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01348                 e_wsfe();
01349                 *info = abs(iinfo);
01350                 if (iinfo < 0) {
01351                     goto L240;
01352                 }
01353             } else {
01354 
01355 /*              Test 13:  | AX - XW | / ( |A| |X| ulp ) */
01356 
01357 /*                        (from inverse iteration) */
01358 
01359                 cget22_("N", "N", "N", &n, &a[a_offset], lda, &evectx[
01360                         evectx_offset], ldu, &w3[1], &work[1], &rwork[1], 
01361                         dumma);
01362                 if (dumma[0] < ulpinv) {
01363                     result[13] = dumma[0] * aninv;
01364                 }
01365             }
01366 
01367 /*           Call CUNMHR for Left eigenvectors of A, do test 14 */
01368 
01369             ntest = 14;
01370             result[14] = ulpinv;
01371 
01372             cunmhr_("Left", "No transpose", &n, &n, &ilo, &ihi, &uu[uu_offset]
01373 , ldu, &tau[1], &evecty[evecty_offset], ldu, &work[1], 
01374                     nwork, &iinfo);
01375             if (iinfo != 0) {
01376                 io___64.ciunit = *nounit;
01377                 s_wsfe(&io___64);
01378                 do_fio(&c__1, "CUNMHR(L)", (ftnlen)9);
01379                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
01380                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01381                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01382                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
01383                 e_wsfe();
01384                 *info = abs(iinfo);
01385                 if (iinfo < 0) {
01386                     goto L240;
01387                 }
01388             } else {
01389 
01390 /*              Test 14:  | YA - WY | / ( |A| |Y| ulp ) */
01391 
01392 /*                        (from inverse iteration) */
01393 
01394                 cget22_("C", "N", "C", &n, &a[a_offset], lda, &evecty[
01395                         evecty_offset], ldu, &w3[1], &work[1], &rwork[1], &
01396                         dumma[2]);
01397                 if (dumma[2] < ulpinv) {
01398                     result[14] = dumma[2] * aninv;
01399                 }
01400             }
01401 
01402 /*           End of Loop -- Check for RESULT(j) > THRESH */
01403 
01404 L240:
01405 
01406             ntestt += ntest;
01407             slafts_("CHS", &n, &n, &jtype, &ntest, &result[1], ioldsd, thresh, 
01408                      nounit, &nerrs);
01409 
01410 L250:
01411             ;
01412         }
01413 /* L260: */
01414     }
01415 
01416 /*     Summary */
01417 
01418     slasum_("CHS", nounit, &nerrs, &ntestt);
01419 
01420     return 0;
01421 
01422 
01423 /*     End of CCHKHS */
01424 
01425 } /* cchkhs_ */


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