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


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