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


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