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


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