zchkhb.c
Go to the documentation of this file.
00001 /* zchkhb.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__0 = 0;
00021 static integer c__6 = 6;
00022 static doublereal c_b32 = 1.;
00023 static integer c__1 = 1;
00024 static doublereal c_b42 = 0.;
00025 static integer c__4 = 4;
00026 
00027 /* Subroutine */ int zchkhb_(integer *nsizes, integer *nn, integer *nwdths, 
00028         integer *kk, integer *ntypes, logical *dotype, integer *iseed, 
00029         doublereal *thresh, integer *nounit, doublecomplex *a, integer *lda, 
00030         doublereal *sd, doublereal *se, doublecomplex *u, integer *ldu, 
00031         doublecomplex *work, integer *lwork, doublereal *rwork, doublereal *
00032         result, integer *info)
00033 {
00034     /* Initialized data */
00035 
00036     static integer ktype[15] = { 1,2,4,4,4,4,4,5,5,5,5,5,8,8,8 };
00037     static integer kmagn[15] = { 1,1,1,1,1,2,3,1,1,1,2,3,1,2,3 };
00038     static integer kmode[15] = { 0,0,4,3,1,4,4,4,3,1,4,4,0,0,0 };
00039 
00040     /* Format strings */
00041     static char fmt_9999[] = "(\002 ZCHKHB: \002,a,\002 returned INFO=\002,i"
00042             "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, ISEED="
00043             "(\002,3(i5,\002,\002),i5,\002)\002)";
00044     static char fmt_9998[] = "(/1x,a3,\002 -- Complex Hermitian Banded Tridi"
00045             "agonal Reduction Routines\002)";
00046     static char fmt_9997[] = "(\002 Matrix types (see DCHK23 for details):"
00047             " \002)";
00048     static char fmt_9996[] = "(/\002 Special Matrices:\002,/\002  1=Zero mat"
00049             "rix.                        \002,\002  5=Diagonal: clustered ent"
00050             "ries.\002,/\002  2=Identity matrix.                    \002,\002"
00051             "  6=Diagonal: large, evenly spaced.\002,/\002  3=Diagonal: evenl"
00052             "y spaced entries.    \002,\002  7=Diagonal: small, evenly spaced."
00053             "\002,/\002  4=Diagonal: geometr. spaced entries.\002)";
00054     static char fmt_9995[] = "(\002 Dense \002,a,\002 Banded Matrices:\002,"
00055             "/\002  8=Evenly spaced eigenvals.            \002,\002 12=Small,"
00056             " evenly spaced eigenvals.\002,/\002  9=Geometrically spaced eige"
00057             "nvals.     \002,\002 13=Matrix with random O(1) entries.\002,"
00058             "/\002 10=Clustered eigenvalues.              \002,\002 14=Matrix"
00059             " with large random entries.\002,/\002 11=Large, evenly spaced ei"
00060             "genvals.     \002,\002 15=Matrix with small random entries.\002)";
00061     static char fmt_9994[] = "(/\002 Tests performed:   (S is Tridiag,  U "
00062             "is \002,a,\002,\002,/20x,a,\002 means \002,a,\002.\002,/\002 UPL"
00063             "O='U':\002,/\002  1= | A - U S U\002,a1,\002 | / ( |A| n ulp )  "
00064             "   \002,\002  2= | I - U U\002,a1,\002 | / ( n ulp )\002,/\002 U"
00065             "PLO='L':\002,/\002  3= | A - U S U\002,a1,\002 | / ( |A| n ulp )"
00066             "     \002,\002  4= | I - U U\002,a1,\002 | / ( n ulp )\002)";
00067     static char fmt_9993[] = "(\002 N=\002,i5,\002, K=\002,i4,\002, seed="
00068             "\002,4(i4,\002,\002),\002 type \002,i2,\002, test(\002,i2,\002)"
00069             "=\002,g10.3)";
00070 
00071     /* System generated locals */
00072     integer a_dim1, a_offset, u_dim1, u_offset, i__1, i__2, i__3, i__4, i__5, 
00073             i__6, i__7;
00074     doublereal d__1;
00075     doublecomplex z__1;
00076 
00077     /* Builtin functions */
00078     double sqrt(doublereal), z_abs(doublecomplex *);
00079     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00080     void d_cnjg(doublecomplex *, doublecomplex *);
00081 
00082     /* Local variables */
00083     integer i__, j, k, n, jc, jr;
00084     doublereal ulp, cond;
00085     integer jcol, kmax, nmax;
00086     doublereal unfl, ovfl, temp1;
00087     logical badnn;
00088     integer imode, iinfo;
00089     extern /* Subroutine */ int zhbt21_(char *, integer *, integer *, integer 
00090             *, doublecomplex *, integer *, doublereal *, doublereal *, 
00091             doublecomplex *, integer *, doublecomplex *, doublereal *, 
00092             doublereal *);
00093     doublereal aninv, anorm;
00094     integer nmats, jsize, nerrs, itype, jtype, ntest;
00095     logical badnnb;
00096     extern doublereal dlamch_(char *);
00097     integer idumma[1];
00098     extern /* Subroutine */ int xerbla_(char *, integer *);
00099     integer ioldsd[4];
00100     extern /* Subroutine */ int dlasum_(char *, integer *, integer *, integer 
00101             *);
00102     integer jwidth;
00103     extern /* Subroutine */ int zhbtrd_(char *, char *, integer *, integer *, 
00104             doublecomplex *, integer *, doublereal *, doublereal *, 
00105             doublecomplex *, integer *, doublecomplex *, integer *), zlacpy_(char *, integer *, integer *, doublecomplex *, 
00106             integer *, doublecomplex *, integer *), zlaset_(char *, 
00107             integer *, integer *, doublecomplex *, doublecomplex *, 
00108             doublecomplex *, integer *), zlatmr_(integer *, integer *, 
00109              char *, integer *, char *, doublecomplex *, integer *, 
00110             doublereal *, doublecomplex *, char *, char *, doublecomplex *, 
00111             integer *, doublereal *, doublecomplex *, integer *, doublereal *, 
00112              char *, integer *, integer *, integer *, doublereal *, 
00113             doublereal *, char *, doublecomplex *, integer *, integer *, 
00114             integer *);
00115     doublereal rtunfl, rtovfl, ulpinv;
00116     extern /* Subroutine */ int zlatms_(integer *, integer *, char *, integer 
00117             *, char *, doublereal *, integer *, doublereal *, doublereal *, 
00118             integer *, integer *, char *, doublecomplex *, integer *, 
00119             doublecomplex *, integer *);
00120     integer mtypes, ntestt;
00121 
00122     /* Fortran I/O blocks */
00123     static cilist io___36 = { 0, 0, 0, fmt_9999, 0 };
00124     static cilist io___37 = { 0, 0, 0, fmt_9999, 0 };
00125     static cilist io___40 = { 0, 0, 0, fmt_9999, 0 };
00126     static cilist io___41 = { 0, 0, 0, fmt_9998, 0 };
00127     static cilist io___42 = { 0, 0, 0, fmt_9997, 0 };
00128     static cilist io___43 = { 0, 0, 0, fmt_9996, 0 };
00129     static cilist io___44 = { 0, 0, 0, fmt_9995, 0 };
00130     static cilist io___45 = { 0, 0, 0, fmt_9994, 0 };
00131     static cilist io___46 = { 0, 0, 0, fmt_9993, 0 };
00132 
00133 
00134 
00135 /*  -- LAPACK test routine (version 3.1) -- */
00136 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00137 /*     November 2006 */
00138 
00139 /*     .. Scalar Arguments .. */
00140 /*     .. */
00141 /*     .. Array Arguments .. */
00142 /*     .. */
00143 
00144 /*  Purpose */
00145 /*  ======= */
00146 
00147 /*  ZCHKHB tests the reduction of a Hermitian band matrix to tridiagonal */
00148 /*  from, used with the Hermitian eigenvalue problem. */
00149 
00150 /*  ZHBTRD factors a Hermitian band matrix A as  U S U* , where * means */
00151 /*  conjugate transpose, S is symmetric tridiagonal, and U is unitary. */
00152 /*  ZHBTRD can use either just the lower or just the upper triangle */
00153 /*  of A; ZCHKHB checks both cases. */
00154 
00155 /*  When ZCHKHB is called, a number of matrix "sizes" ("n's"), a number */
00156 /*  of bandwidths ("k's"), and a number of matrix "types" are */
00157 /*  specified.  For each size ("n"), each bandwidth ("k") less than or */
00158 /*  equal to "n", and each type of matrix, one matrix will be generated */
00159 /*  and used to test the hermitian banded reduction routine.  For each */
00160 /*  matrix, a number of tests will be performed: */
00161 
00162 /*  (1)     | A - V S V* | / ( |A| n ulp )  computed by ZHBTRD with */
00163 /*                                          UPLO='U' */
00164 
00165 /*  (2)     | I - UU* | / ( n ulp ) */
00166 
00167 /*  (3)     | A - V S V* | / ( |A| n ulp )  computed by ZHBTRD with */
00168 /*                                          UPLO='L' */
00169 
00170 /*  (4)     | I - UU* | / ( n ulp ) */
00171 
00172 /*  The "sizes" are specified by an array NN(1:NSIZES); the value of */
00173 /*  each element NN(j) specifies one size. */
00174 /*  The "types" are specified by a logical array DOTYPE( 1:NTYPES ); */
00175 /*  if DOTYPE(j) is .TRUE., then matrix type "j" will be generated. */
00176 /*  Currently, the list of possible types is: */
00177 
00178 /*  (1)  The zero matrix. */
00179 /*  (2)  The identity matrix. */
00180 
00181 /*  (3)  A diagonal matrix with evenly spaced entries */
00182 /*       1, ..., ULP  and random signs. */
00183 /*       (ULP = (first number larger than 1) - 1 ) */
00184 /*  (4)  A diagonal matrix with geometrically spaced entries */
00185 /*       1, ..., ULP  and random signs. */
00186 /*  (5)  A diagonal matrix with "clustered" entries 1, ULP, ..., ULP */
00187 /*       and random signs. */
00188 
00189 /*  (6)  Same as (4), but multiplied by SQRT( overflow threshold ) */
00190 /*  (7)  Same as (4), but multiplied by SQRT( underflow threshold ) */
00191 
00192 /*  (8)  A matrix of the form  U* D U, where U is unitary and */
00193 /*       D has evenly spaced entries 1, ..., ULP with random signs */
00194 /*       on the diagonal. */
00195 
00196 /*  (9)  A matrix of the form  U* D U, where U is unitary and */
00197 /*       D has geometrically spaced entries 1, ..., ULP with random */
00198 /*       signs on the diagonal. */
00199 
00200 /*  (10) A matrix of the form  U* D U, where U is unitary and */
00201 /*       D has "clustered" entries 1, ULP,..., ULP with random */
00202 /*       signs on the diagonal. */
00203 
00204 /*  (11) Same as (8), but multiplied by SQRT( overflow threshold ) */
00205 /*  (12) Same as (8), but multiplied by SQRT( underflow threshold ) */
00206 
00207 /*  (13) Hermitian matrix with random entries chosen from (-1,1). */
00208 /*  (14) Same as (13), but multiplied by SQRT( overflow threshold ) */
00209 /*  (15) Same as (13), but multiplied by SQRT( underflow threshold ) */
00210 
00211 /*  Arguments */
00212 /*  ========= */
00213 
00214 /*  NSIZES  (input) INTEGER */
00215 /*          The number of sizes of matrices to use.  If it is zero, */
00216 /*          ZCHKHB does nothing.  It must be at least zero. */
00217 
00218 /*  NN      (input) INTEGER array, dimension (NSIZES) */
00219 /*          An array containing the sizes to be used for the matrices. */
00220 /*          Zero values will be skipped.  The values must be at least */
00221 /*          zero. */
00222 
00223 /*  NWDTHS  (input) INTEGER */
00224 /*          The number of bandwidths to use.  If it is zero, */
00225 /*          ZCHKHB does nothing.  It must be at least zero. */
00226 
00227 /*  KK      (input) INTEGER array, dimension (NWDTHS) */
00228 /*          An array containing the bandwidths to be used for the band */
00229 /*          matrices.  The values must be at least zero. */
00230 
00231 /*  NTYPES  (input) INTEGER */
00232 /*          The number of elements in DOTYPE.   If it is zero, ZCHKHB */
00233 /*          does nothing.  It must be at least zero.  If it is MAXTYP+1 */
00234 /*          and NSIZES is 1, then an additional type, MAXTYP+1 is */
00235 /*          defined, which is to use whatever matrix is in A.  This */
00236 /*          is only useful if DOTYPE(1:MAXTYP) is .FALSE. and */
00237 /*          DOTYPE(MAXTYP+1) is .TRUE. . */
00238 
00239 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00240 /*          If DOTYPE(j) is .TRUE., then for each size in NN a */
00241 /*          matrix of that size and of type j will be generated. */
00242 /*          If NTYPES is smaller than the maximum number of types */
00243 /*          defined (PARAMETER MAXTYP), then types NTYPES+1 through */
00244 /*          MAXTYP will not be generated.  If NTYPES is larger */
00245 /*          than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) */
00246 /*          will be ignored. */
00247 
00248 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00249 /*          On entry ISEED specifies the seed of the random number */
00250 /*          generator. The array elements should be between 0 and 4095; */
00251 /*          if not they will be reduced mod 4096.  Also, ISEED(4) must */
00252 /*          be odd.  The random number generator uses a linear */
00253 /*          congruential sequence limited to small integers, and so */
00254 /*          should produce machine independent random numbers. The */
00255 /*          values of ISEED are changed on exit, and can be used in the */
00256 /*          next call to ZCHKHB to continue the same random number */
00257 /*          sequence. */
00258 
00259 /*  THRESH  (input) DOUBLE PRECISION */
00260 /*          A test will count as "failed" if the "error", computed as */
00261 /*          described above, exceeds THRESH.  Note that the error */
00262 /*          is scaled to be O(1), so THRESH should be a reasonably */
00263 /*          small multiple of 1, e.g., 10 or 100.  In particular, */
00264 /*          it should not depend on the precision (single vs. double) */
00265 /*          or the size of the matrix.  It must be at least zero. */
00266 
00267 /*  NOUNIT  (input) INTEGER */
00268 /*          The FORTRAN unit number for printing out error messages */
00269 /*          (e.g., if a routine returns IINFO not equal to 0.) */
00270 
00271 /*  A       (input/workspace) DOUBLE PRECISION array, dimension */
00272 /*                            (LDA, max(NN)) */
00273 /*          Used to hold the matrix whose eigenvalues are to be */
00274 /*          computed. */
00275 
00276 /*  LDA     (input) INTEGER */
00277 /*          The leading dimension of A.  It must be at least 2 (not 1!) */
00278 /*          and at least max( KK )+1. */
00279 
00280 /*  SD      (workspace) DOUBLE PRECISION array, dimension (max(NN)) */
00281 /*          Used to hold the diagonal of the tridiagonal matrix computed */
00282 /*          by ZHBTRD. */
00283 
00284 /*  SE      (workspace) DOUBLE PRECISION array, dimension (max(NN)) */
00285 /*          Used to hold the off-diagonal of the tridiagonal matrix */
00286 /*          computed by ZHBTRD. */
00287 
00288 /*  U       (workspace) DOUBLE PRECISION array, dimension (LDU, max(NN)) */
00289 /*          Used to hold the unitary matrix computed by ZHBTRD. */
00290 
00291 /*  LDU     (input) INTEGER */
00292 /*          The leading dimension of U.  It must be at least 1 */
00293 /*          and at least max( NN ). */
00294 
00295 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (LWORK) */
00296 
00297 /*  LWORK   (input) INTEGER */
00298 /*          The number of entries in WORK.  This must be at least */
00299 /*          max( LDA+1, max(NN)+1 )*max(NN). */
00300 
00301 /*  RESULT  (output) DOUBLE PRECISION array, dimension (4) */
00302 /*          The values computed by the tests described above. */
00303 /*          The values are currently limited to 1/ulp, to avoid */
00304 /*          overflow. */
00305 
00306 /*  INFO    (output) INTEGER */
00307 /*          If 0, then everything ran OK. */
00308 
00309 /* ----------------------------------------------------------------------- */
00310 
00311 /*       Some Local Variables and Parameters: */
00312 /*       ---- ----- --------- --- ---------- */
00313 /*       ZERO, ONE       Real 0 and 1. */
00314 /*       MAXTYP          The number of types defined. */
00315 /*       NTEST           The number of tests performed, or which can */
00316 /*                       be performed so far, for the current matrix. */
00317 /*       NTESTT          The total number of tests performed so far. */
00318 /*       NMAX            Largest value in NN. */
00319 /*       NMATS           The number of matrices generated so far. */
00320 /*       NERRS           The number of tests which have exceeded THRESH */
00321 /*                       so far. */
00322 /*       COND, IMODE     Values to be passed to the matrix generators. */
00323 /*       ANORM           Norm of A; passed to matrix generators. */
00324 
00325 /*       OVFL, UNFL      Overflow and underflow thresholds. */
00326 /*       ULP, ULPINV     Finest relative precision and its inverse. */
00327 /*       RTOVFL, RTUNFL  Square roots of the previous 2 values. */
00328 /*               The following four arrays decode JTYPE: */
00329 /*       KTYPE(j)        The general type (1-10) for type "j". */
00330 /*       KMODE(j)        The MODE value to be passed to the matrix */
00331 /*                       generator for type "j". */
00332 /*       KMAGN(j)        The order of magnitude ( O(1), */
00333 /*                       O(overflow^(1/2) ), O(underflow^(1/2) ) */
00334 
00335 /*  ===================================================================== */
00336 
00337 /*     .. Parameters .. */
00338 /*     .. */
00339 /*     .. Local Scalars .. */
00340 /*     .. */
00341 /*     .. Local Arrays .. */
00342 /*     .. */
00343 /*     .. External Functions .. */
00344 /*     .. */
00345 /*     .. External Subroutines .. */
00346 /*     .. */
00347 /*     .. Intrinsic Functions .. */
00348 /*     .. */
00349 /*     .. Data statements .. */
00350     /* Parameter adjustments */
00351     --nn;
00352     --kk;
00353     --dotype;
00354     --iseed;
00355     a_dim1 = *lda;
00356     a_offset = 1 + a_dim1;
00357     a -= a_offset;
00358     --sd;
00359     --se;
00360     u_dim1 = *ldu;
00361     u_offset = 1 + u_dim1;
00362     u -= u_offset;
00363     --work;
00364     --rwork;
00365     --result;
00366 
00367     /* Function Body */
00368 /*     .. */
00369 /*     .. Executable Statements .. */
00370 
00371 /*     Check for errors */
00372 
00373     ntestt = 0;
00374     *info = 0;
00375 
00376 /*     Important constants */
00377 
00378     badnn = FALSE_;
00379     nmax = 1;
00380     i__1 = *nsizes;
00381     for (j = 1; j <= i__1; ++j) {
00382 /* Computing MAX */
00383         i__2 = nmax, i__3 = nn[j];
00384         nmax = max(i__2,i__3);
00385         if (nn[j] < 0) {
00386             badnn = TRUE_;
00387         }
00388 /* L10: */
00389     }
00390 
00391     badnnb = FALSE_;
00392     kmax = 0;
00393     i__1 = *nsizes;
00394     for (j = 1; j <= i__1; ++j) {
00395 /* Computing MAX */
00396         i__2 = kmax, i__3 = kk[j];
00397         kmax = max(i__2,i__3);
00398         if (kk[j] < 0) {
00399             badnnb = TRUE_;
00400         }
00401 /* L20: */
00402     }
00403 /* Computing MIN */
00404     i__1 = nmax - 1;
00405     kmax = min(i__1,kmax);
00406 
00407 /*     Check for errors */
00408 
00409     if (*nsizes < 0) {
00410         *info = -1;
00411     } else if (badnn) {
00412         *info = -2;
00413     } else if (*nwdths < 0) {
00414         *info = -3;
00415     } else if (badnnb) {
00416         *info = -4;
00417     } else if (*ntypes < 0) {
00418         *info = -5;
00419     } else if (*lda < kmax + 1) {
00420         *info = -11;
00421     } else if (*ldu < nmax) {
00422         *info = -15;
00423     } else if ((max(*lda,nmax) + 1) * nmax > *lwork) {
00424         *info = -17;
00425     }
00426 
00427     if (*info != 0) {
00428         i__1 = -(*info);
00429         xerbla_("ZCHKHB", &i__1);
00430         return 0;
00431     }
00432 
00433 /*     Quick return if possible */
00434 
00435     if (*nsizes == 0 || *ntypes == 0 || *nwdths == 0) {
00436         return 0;
00437     }
00438 
00439 /*     More Important constants */
00440 
00441     unfl = dlamch_("Safe minimum");
00442     ovfl = 1. / unfl;
00443     ulp = dlamch_("Epsilon") * dlamch_("Base");
00444     ulpinv = 1. / ulp;
00445     rtunfl = sqrt(unfl);
00446     rtovfl = sqrt(ovfl);
00447 
00448 /*     Loop over sizes, types */
00449 
00450     nerrs = 0;
00451     nmats = 0;
00452 
00453     i__1 = *nsizes;
00454     for (jsize = 1; jsize <= i__1; ++jsize) {
00455         n = nn[jsize];
00456         aninv = 1. / (doublereal) max(1,n);
00457 
00458         i__2 = *nwdths;
00459         for (jwidth = 1; jwidth <= i__2; ++jwidth) {
00460             k = kk[jwidth];
00461             if (k > n) {
00462                 goto L180;
00463             }
00464 /* Computing MAX */
00465 /* Computing MIN */
00466             i__5 = n - 1;
00467             i__3 = 0, i__4 = min(i__5,k);
00468             k = max(i__3,i__4);
00469 
00470             if (*nsizes != 1) {
00471                 mtypes = min(15,*ntypes);
00472             } else {
00473                 mtypes = min(16,*ntypes);
00474             }
00475 
00476             i__3 = mtypes;
00477             for (jtype = 1; jtype <= i__3; ++jtype) {
00478                 if (! dotype[jtype]) {
00479                     goto L170;
00480                 }
00481                 ++nmats;
00482                 ntest = 0;
00483 
00484                 for (j = 1; j <= 4; ++j) {
00485                     ioldsd[j - 1] = iseed[j];
00486 /* L30: */
00487                 }
00488 
00489 /*              Compute "A". */
00490 /*              Store as "Upper"; later, we will copy to other format. */
00491 
00492 /*              Control parameters: */
00493 
00494 /*                  KMAGN  KMODE        KTYPE */
00495 /*              =1  O(1)   clustered 1  zero */
00496 /*              =2  large  clustered 2  identity */
00497 /*              =3  small  exponential  (none) */
00498 /*              =4         arithmetic   diagonal, (w/ eigenvalues) */
00499 /*              =5         random log   hermitian, w/ eigenvalues */
00500 /*              =6         random       (none) */
00501 /*              =7                      random diagonal */
00502 /*              =8                      random hermitian */
00503 /*              =9                      positive definite */
00504 /*              =10                     diagonally dominant tridiagonal */
00505 
00506                 if (mtypes > 15) {
00507                     goto L100;
00508                 }
00509 
00510                 itype = ktype[jtype - 1];
00511                 imode = kmode[jtype - 1];
00512 
00513 /*              Compute norm */
00514 
00515                 switch (kmagn[jtype - 1]) {
00516                     case 1:  goto L40;
00517                     case 2:  goto L50;
00518                     case 3:  goto L60;
00519                 }
00520 
00521 L40:
00522                 anorm = 1.;
00523                 goto L70;
00524 
00525 L50:
00526                 anorm = rtovfl * ulp * aninv;
00527                 goto L70;
00528 
00529 L60:
00530                 anorm = rtunfl * n * ulpinv;
00531                 goto L70;
00532 
00533 L70:
00534 
00535                 zlaset_("Full", lda, &n, &c_b1, &c_b1, &a[a_offset], lda);
00536                 iinfo = 0;
00537                 if (jtype <= 15) {
00538                     cond = ulpinv;
00539                 } else {
00540                     cond = ulpinv * aninv / 10.;
00541                 }
00542 
00543 /*              Special Matrices -- Identity & Jordan block */
00544 
00545 /*                 Zero */
00546 
00547                 if (itype == 1) {
00548                     iinfo = 0;
00549 
00550                 } else if (itype == 2) {
00551 
00552 /*                 Identity */
00553 
00554                     i__4 = n;
00555                     for (jcol = 1; jcol <= i__4; ++jcol) {
00556                         i__5 = k + 1 + jcol * a_dim1;
00557                         a[i__5].r = anorm, a[i__5].i = 0.;
00558 /* L80: */
00559                     }
00560 
00561                 } else if (itype == 4) {
00562 
00563 /*                 Diagonal Matrix, [Eigen]values Specified */
00564 
00565                     zlatms_(&n, &n, "S", &iseed[1], "H", &rwork[1], &imode, &
00566                             cond, &anorm, &c__0, &c__0, "Q", &a[k + 1 + 
00567                             a_dim1], lda, &work[1], &iinfo);
00568 
00569                 } else if (itype == 5) {
00570 
00571 /*                 Hermitian, eigenvalues specified */
00572 
00573                     zlatms_(&n, &n, "S", &iseed[1], "H", &rwork[1], &imode, &
00574                             cond, &anorm, &k, &k, "Q", &a[a_offset], lda, &
00575                             work[1], &iinfo);
00576 
00577                 } else if (itype == 7) {
00578 
00579 /*                 Diagonal, random eigenvalues */
00580 
00581                     zlatmr_(&n, &n, "S", &iseed[1], "H", &work[1], &c__6, &
00582                             c_b32, &c_b2, "T", "N", &work[n + 1], &c__1, &
00583                             c_b32, &work[(n << 1) + 1], &c__1, &c_b32, "N", 
00584                             idumma, &c__0, &c__0, &c_b42, &anorm, "Q", &a[k + 
00585                             1 + a_dim1], lda, idumma, &iinfo);
00586 
00587                 } else if (itype == 8) {
00588 
00589 /*                 Hermitian, random eigenvalues */
00590 
00591                     zlatmr_(&n, &n, "S", &iseed[1], "H", &work[1], &c__6, &
00592                             c_b32, &c_b2, "T", "N", &work[n + 1], &c__1, &
00593                             c_b32, &work[(n << 1) + 1], &c__1, &c_b32, "N", 
00594                             idumma, &k, &k, &c_b42, &anorm, "Q", &a[a_offset], 
00595                              lda, idumma, &iinfo);
00596 
00597                 } else if (itype == 9) {
00598 
00599 /*                 Positive definite, eigenvalues specified. */
00600 
00601                     zlatms_(&n, &n, "S", &iseed[1], "P", &rwork[1], &imode, &
00602                             cond, &anorm, &k, &k, "Q", &a[a_offset], lda, &
00603                             work[n + 1], &iinfo);
00604 
00605                 } else if (itype == 10) {
00606 
00607 /*                 Positive definite tridiagonal, eigenvalues specified. */
00608 
00609                     if (n > 1) {
00610                         k = max(1,k);
00611                     }
00612                     zlatms_(&n, &n, "S", &iseed[1], "P", &rwork[1], &imode, &
00613                             cond, &anorm, &c__1, &c__1, "Q", &a[k + a_dim1], 
00614                             lda, &work[1], &iinfo);
00615                     i__4 = n;
00616                     for (i__ = 2; i__ <= i__4; ++i__) {
00617                         i__5 = k + 1 + (i__ - 1) * a_dim1;
00618                         i__6 = k + 1 + i__ * a_dim1;
00619                         z__1.r = a[i__5].r * a[i__6].r - a[i__5].i * a[i__6]
00620                                 .i, z__1.i = a[i__5].r * a[i__6].i + a[i__5]
00621                                 .i * a[i__6].r;
00622                         temp1 = z_abs(&a[k + i__ * a_dim1]) / sqrt(z_abs(&
00623                                 z__1));
00624                         if (temp1 > .5) {
00625                             i__5 = k + i__ * a_dim1;
00626                             i__6 = k + 1 + (i__ - 1) * a_dim1;
00627                             i__7 = k + 1 + i__ * a_dim1;
00628                             z__1.r = a[i__6].r * a[i__7].r - a[i__6].i * a[
00629                                     i__7].i, z__1.i = a[i__6].r * a[i__7].i + 
00630                                     a[i__6].i * a[i__7].r;
00631                             d__1 = sqrt(z_abs(&z__1)) * .5;
00632                             a[i__5].r = d__1, a[i__5].i = 0.;
00633                         }
00634 /* L90: */
00635                     }
00636 
00637                 } else {
00638 
00639                     iinfo = 1;
00640                 }
00641 
00642                 if (iinfo != 0) {
00643                     io___36.ciunit = *nounit;
00644                     s_wsfe(&io___36);
00645                     do_fio(&c__1, "Generator", (ftnlen)9);
00646                     do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00647                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00648                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00649                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00650                             ;
00651                     e_wsfe();
00652                     *info = abs(iinfo);
00653                     return 0;
00654                 }
00655 
00656 L100:
00657 
00658 /*              Call ZHBTRD to compute S and U from upper triangle. */
00659 
00660                 i__4 = k + 1;
00661                 zlacpy_(" ", &i__4, &n, &a[a_offset], lda, &work[1], lda);
00662 
00663                 ntest = 1;
00664                 zhbtrd_("V", "U", &n, &k, &work[1], lda, &sd[1], &se[1], &u[
00665                         u_offset], ldu, &work[*lda * n + 1], &iinfo);
00666 
00667                 if (iinfo != 0) {
00668                     io___37.ciunit = *nounit;
00669                     s_wsfe(&io___37);
00670                     do_fio(&c__1, "ZHBTRD(U)", (ftnlen)9);
00671                     do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00672                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00673                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00674                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00675                             ;
00676                     e_wsfe();
00677                     *info = abs(iinfo);
00678                     if (iinfo < 0) {
00679                         return 0;
00680                     } else {
00681                         result[1] = ulpinv;
00682                         goto L150;
00683                     }
00684                 }
00685 
00686 /*              Do tests 1 and 2 */
00687 
00688                 zhbt21_("Upper", &n, &k, &c__1, &a[a_offset], lda, &sd[1], &
00689                         se[1], &u[u_offset], ldu, &work[1], &rwork[1], &
00690                         result[1]);
00691 
00692 /*              Convert A from Upper-Triangle-Only storage to */
00693 /*              Lower-Triangle-Only storage. */
00694 
00695                 i__4 = n;
00696                 for (jc = 1; jc <= i__4; ++jc) {
00697 /* Computing MIN */
00698                     i__6 = k, i__7 = n - jc;
00699                     i__5 = min(i__6,i__7);
00700                     for (jr = 0; jr <= i__5; ++jr) {
00701                         i__6 = jr + 1 + jc * a_dim1;
00702                         d_cnjg(&z__1, &a[k + 1 - jr + (jc + jr) * a_dim1]);
00703                         a[i__6].r = z__1.r, a[i__6].i = z__1.i;
00704 /* L110: */
00705                     }
00706 /* L120: */
00707                 }
00708                 i__4 = n;
00709                 for (jc = n + 1 - k; jc <= i__4; ++jc) {
00710 /* Computing MIN */
00711                     i__5 = k, i__6 = n - jc;
00712                     i__7 = k;
00713                     for (jr = min(i__5,i__6) + 1; jr <= i__7; ++jr) {
00714                         i__5 = jr + 1 + jc * a_dim1;
00715                         a[i__5].r = 0., a[i__5].i = 0.;
00716 /* L130: */
00717                     }
00718 /* L140: */
00719                 }
00720 
00721 /*              Call ZHBTRD to compute S and U from lower triangle */
00722 
00723                 i__4 = k + 1;
00724                 zlacpy_(" ", &i__4, &n, &a[a_offset], lda, &work[1], lda);
00725 
00726                 ntest = 3;
00727                 zhbtrd_("V", "L", &n, &k, &work[1], lda, &sd[1], &se[1], &u[
00728                         u_offset], ldu, &work[*lda * n + 1], &iinfo);
00729 
00730                 if (iinfo != 0) {
00731                     io___40.ciunit = *nounit;
00732                     s_wsfe(&io___40);
00733                     do_fio(&c__1, "ZHBTRD(L)", (ftnlen)9);
00734                     do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00735                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00736                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00737                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00738                             ;
00739                     e_wsfe();
00740                     *info = abs(iinfo);
00741                     if (iinfo < 0) {
00742                         return 0;
00743                     } else {
00744                         result[3] = ulpinv;
00745                         goto L150;
00746                     }
00747                 }
00748                 ntest = 4;
00749 
00750 /*              Do tests 3 and 4 */
00751 
00752                 zhbt21_("Lower", &n, &k, &c__1, &a[a_offset], lda, &sd[1], &
00753                         se[1], &u[u_offset], ldu, &work[1], &rwork[1], &
00754                         result[3]);
00755 
00756 /*              End of Loop -- Check for RESULT(j) > THRESH */
00757 
00758 L150:
00759                 ntestt += ntest;
00760 
00761 /*              Print out tests which fail. */
00762 
00763                 i__4 = ntest;
00764                 for (jr = 1; jr <= i__4; ++jr) {
00765                     if (result[jr] >= *thresh) {
00766 
00767 /*                    If this is the first test to fail, */
00768 /*                    print a header to the data file. */
00769 
00770                         if (nerrs == 0) {
00771                             io___41.ciunit = *nounit;
00772                             s_wsfe(&io___41);
00773                             do_fio(&c__1, "ZHB", (ftnlen)3);
00774                             e_wsfe();
00775                             io___42.ciunit = *nounit;
00776                             s_wsfe(&io___42);
00777                             e_wsfe();
00778                             io___43.ciunit = *nounit;
00779                             s_wsfe(&io___43);
00780                             e_wsfe();
00781                             io___44.ciunit = *nounit;
00782                             s_wsfe(&io___44);
00783                             do_fio(&c__1, "Hermitian", (ftnlen)9);
00784                             e_wsfe();
00785                             io___45.ciunit = *nounit;
00786                             s_wsfe(&io___45);
00787                             do_fio(&c__1, "unitary", (ftnlen)7);
00788                             do_fio(&c__1, "*", (ftnlen)1);
00789                             do_fio(&c__1, "conjugate transpose", (ftnlen)19);
00790                             for (j = 1; j <= 4; ++j) {
00791                                 do_fio(&c__1, "*", (ftnlen)1);
00792                             }
00793                             e_wsfe();
00794                         }
00795                         ++nerrs;
00796                         io___46.ciunit = *nounit;
00797                         s_wsfe(&io___46);
00798                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00799                         do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
00800                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
00801                                 integer));
00802                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
00803                                 ;
00804                         do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
00805                         do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
00806                                 doublereal));
00807                         e_wsfe();
00808                     }
00809 /* L160: */
00810                 }
00811 
00812 L170:
00813                 ;
00814             }
00815 L180:
00816             ;
00817         }
00818 /* L190: */
00819     }
00820 
00821 /*     Summary */
00822 
00823     dlasum_("ZHB", nounit, &nerrs, &ntestt);
00824     return 0;
00825 
00826 
00827 
00828 
00829 /*     End of ZCHKHB */
00830 
00831 } /* zchkhb_ */


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