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


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