ddrvrf4.c
Go to the documentation of this file.
00001 /* ddrvrf4.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 /* Common Block Declarations */
00017 
00018 struct {
00019     char srnamt[32];
00020 } srnamc_;
00021 
00022 #define srnamc_1 srnamc_
00023 
00024 /* Table of constant values */
00025 
00026 static integer c__2 = 2;
00027 static integer c__1 = 1;
00028 
00029 /* Subroutine */ int ddrvrf4_(integer *nout, integer *nn, integer *nval, 
00030         doublereal *thresh, doublereal *c1, doublereal *c2, integer *ldc, 
00031         doublereal *crf, doublereal *a, integer *lda, doublereal *
00032         d_work_dlange__)
00033 {
00034     /* Initialized data */
00035 
00036     static integer iseedy[4] = { 1988,1989,1990,1991 };
00037     static char uplos[1*2] = "U" "L";
00038     static char forms[1*2] = "N" "T";
00039     static char transs[1*2] = "N" "T";
00040 
00041     /* Format strings */
00042     static char fmt_9999[] = "(1x,\002 *** Error(s) or Failure(s) while test"
00043             "ing DSFRK               ***\002)";
00044     static char fmt_9997[] = "(1x,\002     Failure in \002,a5,\002, CFORM="
00045             "'\002,a1,\002',\002,\002 UPLO='\002,a1,\002',\002,\002 TRANS="
00046             "'\002,a1,\002',\002,\002 N=\002,i3,\002, K =\002,i3,\002, test"
00047             "=\002,g12.5)";
00048     static char fmt_9996[] = "(1x,\002All tests for \002,a5,\002 auxiliary r"
00049             "outine passed the \002,\002threshold (\002,i5,\002 tests run)"
00050             "\002)";
00051     static char fmt_9995[] = "(1x,a6,\002 auxiliary routine:\002,i5,\002 out"
00052             " of \002,i5,\002 tests failed to pass the threshold\002)";
00053 
00054     /* System generated locals */
00055     integer a_dim1, a_offset, c1_dim1, c1_offset, c2_dim1, c2_offset, i__1, 
00056             i__2, i__3, i__4;
00057     doublereal d__1;
00058 
00059     /* Builtin functions */
00060     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00061     integer s_wsle(cilist *), e_wsle(void), s_wsfe(cilist *), e_wsfe(void), 
00062             do_fio(integer *, char *, ftnlen);
00063 
00064     /* Local variables */
00065     integer i__, j, k, n, iik, iin;
00066     doublereal eps, beta;
00067     integer info;
00068     char uplo[1];
00069     integer nrun;
00070     doublereal alpha;
00071     integer nfail, iseed[4];
00072     char cform[1];
00073     extern /* Subroutine */ int dsfrk_(char *, char *, char *, integer *, 
00074             integer *, doublereal *, doublereal *, integer *, doublereal *, 
00075             doublereal *);
00076     integer iform;
00077     doublereal norma, normc;
00078     char trans[1];
00079     integer iuplo;
00080     extern /* Subroutine */ int dsyrk_(char *, char *, integer *, integer *, 
00081             doublereal *, doublereal *, integer *, doublereal *, doublereal *, 
00082              integer *);
00083     extern doublereal dlamch_(char *), dlange_(char *, integer *, 
00084             integer *, doublereal *, integer *, doublereal *);
00085     integer ialpha;
00086     extern doublereal dlarnd_(integer *, integer *);
00087     integer itrans;
00088     extern /* Subroutine */ int dtfttr_(char *, char *, integer *, doublereal 
00089             *, doublereal *, integer *, integer *), dtrttf_(
00090             char *, char *, integer *, doublereal *, integer *, doublereal *, 
00091             integer *);
00092     doublereal result[1];
00093 
00094     /* Fortran I/O blocks */
00095     static cilist io___28 = { 0, 0, 0, 0, 0 };
00096     static cilist io___29 = { 0, 0, 0, fmt_9999, 0 };
00097     static cilist io___30 = { 0, 0, 0, fmt_9997, 0 };
00098     static cilist io___31 = { 0, 0, 0, fmt_9996, 0 };
00099     static cilist io___32 = { 0, 0, 0, fmt_9995, 0 };
00100 
00101 
00102 
00103 /*  -- LAPACK test routine (version 3.2.0) -- */
00104 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00105 /*     November 2008 */
00106 
00107 /*     .. Scalar Arguments .. */
00108 /*     .. */
00109 /*     .. Array Arguments .. */
00110 /*     .. */
00111 
00112 /*  Purpose */
00113 /*  ======= */
00114 
00115 /*  DDRVRF4 tests the LAPACK RFP routines: */
00116 /*      DSFRK */
00117 
00118 /*  Arguments */
00119 /*  ========= */
00120 
00121 /*  NOUT          (input) INTEGER */
00122 /*                The unit number for output. */
00123 
00124 /*  NN            (input) INTEGER */
00125 /*                The number of values of N contained in the vector NVAL. */
00126 
00127 /*  NVAL          (input) INTEGER array, dimension (NN) */
00128 /*                The values of the matrix dimension N. */
00129 
00130 /*  THRESH        (input) DOUBLE PRECISION */
00131 /*                The threshold value for the test ratios.  A result is */
00132 /*                included in the output file if RESULT >= THRESH.  To */
00133 /*                have every test ratio printed, use THRESH = 0. */
00134 
00135 /*  C1            (workspace) DOUBLE PRECISION array, */
00136 /*                dimension (LDC,NMAX) */
00137 
00138 /*  C2            (workspace) DOUBLE PRECISION array, */
00139 /*                dimension (LDC,NMAX) */
00140 
00141 /*  LDC           (input) INTEGER */
00142 /*                The leading dimension of the array A. */
00143 /*                LDA >= max(1,NMAX). */
00144 
00145 /*  CRF           (workspace) DOUBLE PRECISION array, */
00146 /*                dimension ((NMAX*(NMAX+1))/2). */
00147 
00148 /*  A             (workspace) DOUBLE PRECISION array, */
00149 /*                dimension (LDA,NMAX) */
00150 
00151 /*  LDA           (input) INTEGER */
00152 /*                The leading dimension of the array A.  LDA >= max(1,NMAX). */
00153 
00154 /*  D_WORK_DLANGE (workspace) DOUBLE PRECISION array, dimension (NMAX) */
00155 
00156 /*  ===================================================================== */
00157 /*     .. */
00158 /*     .. Parameters .. */
00159 /*     .. */
00160 /*     .. Local Scalars .. */
00161 /*     .. */
00162 /*     .. Local Arrays .. */
00163 /*     .. */
00164 /*     .. External Functions .. */
00165 /*     .. */
00166 /*     .. External Subroutines .. */
00167 /*     .. */
00168 /*     .. Intrinsic Functions .. */
00169 /*     .. */
00170 /*     .. Scalars in Common .. */
00171 /*     .. */
00172 /*     .. Common blocks .. */
00173 /*     .. */
00174 /*     .. Data statements .. */
00175     /* Parameter adjustments */
00176     --nval;
00177     c2_dim1 = *ldc;
00178     c2_offset = 1 + c2_dim1;
00179     c2 -= c2_offset;
00180     c1_dim1 = *ldc;
00181     c1_offset = 1 + c1_dim1;
00182     c1 -= c1_offset;
00183     --crf;
00184     a_dim1 = *lda;
00185     a_offset = 1 + a_dim1;
00186     a -= a_offset;
00187     --d_work_dlange__;
00188 
00189     /* Function Body */
00190 /*     .. */
00191 /*     .. Executable Statements .. */
00192 
00193 /*     Initialize constants and the random number seed. */
00194 
00195     nrun = 0;
00196     nfail = 0;
00197     info = 0;
00198     for (i__ = 1; i__ <= 4; ++i__) {
00199         iseed[i__ - 1] = iseedy[i__ - 1];
00200 /* L10: */
00201     }
00202     eps = dlamch_("Precision");
00203 
00204     i__1 = *nn;
00205     for (iin = 1; iin <= i__1; ++iin) {
00206 
00207         n = nval[iin];
00208 
00209         i__2 = *nn;
00210         for (iik = 1; iik <= i__2; ++iik) {
00211 
00212             k = nval[iin];
00213 
00214             for (iform = 1; iform <= 2; ++iform) {
00215 
00216                 *(unsigned char *)cform = *(unsigned char *)&forms[iform - 1];
00217 
00218                 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00219 
00220                     *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 
00221                             1];
00222 
00223                     for (itrans = 1; itrans <= 2; ++itrans) {
00224 
00225                         *(unsigned char *)trans = *(unsigned char *)&transs[
00226                                 itrans - 1];
00227 
00228                         for (ialpha = 1; ialpha <= 4; ++ialpha) {
00229 
00230                             if (ialpha == 1) {
00231                                 alpha = 0.;
00232                                 beta = 0.;
00233                             } else if (ialpha == 2) {
00234                                 alpha = 1.;
00235                                 beta = 0.;
00236                             } else if (ialpha == 3) {
00237                                 alpha = 0.;
00238                                 beta = 1.;
00239                             } else {
00240                                 alpha = dlarnd_(&c__2, iseed);
00241                                 beta = dlarnd_(&c__2, iseed);
00242                             }
00243 
00244 /*                       All the parameters are set: */
00245 /*                          CFORM, UPLO, TRANS, M, N, */
00246 /*                          ALPHA, and BETA */
00247 /*                       READY TO TEST! */
00248 
00249                             ++nrun;
00250 
00251                             if (itrans == 1) {
00252 
00253 /*                          In this case we are NOTRANS, so A is N-by-K */
00254 
00255                                 i__3 = k;
00256                                 for (j = 1; j <= i__3; ++j) {
00257                                     i__4 = n;
00258                                     for (i__ = 1; i__ <= i__4; ++i__) {
00259                                         a[i__ + j * a_dim1] = dlarnd_(&c__2, 
00260                                                 iseed);
00261                                     }
00262                                 }
00263 
00264                                 norma = dlange_("I", &n, &k, &a[a_offset], 
00265                                         lda, &d_work_dlange__[1]);
00266 
00267                             } else {
00268 
00269 /*                          In this case we are TRANS, so A is K-by-N */
00270 
00271                                 i__3 = n;
00272                                 for (j = 1; j <= i__3; ++j) {
00273                                     i__4 = k;
00274                                     for (i__ = 1; i__ <= i__4; ++i__) {
00275                                         a[i__ + j * a_dim1] = dlarnd_(&c__2, 
00276                                                 iseed);
00277                                     }
00278                                 }
00279 
00280                                 norma = dlange_("I", &k, &n, &a[a_offset], 
00281                                         lda, &d_work_dlange__[1]);
00282 
00283                             }
00284 
00285 /*                       Generate C1 our N--by--N symmetric matrix. */
00286 /*                       Make sure C2 has the same upper/lower part, */
00287 /*                       (the one that we do not touch), so */
00288 /*                       copy the initial C1 in C2 in it. */
00289 
00290                             i__3 = n;
00291                             for (j = 1; j <= i__3; ++j) {
00292                                 i__4 = n;
00293                                 for (i__ = 1; i__ <= i__4; ++i__) {
00294                                     c1[i__ + j * c1_dim1] = dlarnd_(&c__2, 
00295                                             iseed);
00296                                     c2[i__ + j * c2_dim1] = c1[i__ + j * 
00297                                             c1_dim1];
00298                                 }
00299                             }
00300 
00301 /*                       (See comment later on for why we use DLANGE and */
00302 /*                       not DLANSY for C1.) */
00303 
00304                             normc = dlange_("I", &n, &n, &c1[c1_offset], ldc, 
00305                                     &d_work_dlange__[1]);
00306 
00307                             s_copy(srnamc_1.srnamt, "DTRTTF", (ftnlen)32, (
00308                                     ftnlen)6);
00309                             dtrttf_(cform, uplo, &n, &c1[c1_offset], ldc, &
00310                                     crf[1], &info);
00311 
00312 /*                       call dsyrk the BLAS routine -> gives C1 */
00313 
00314                             s_copy(srnamc_1.srnamt, "DSYRK ", (ftnlen)32, (
00315                                     ftnlen)6);
00316                             dsyrk_(uplo, trans, &n, &k, &alpha, &a[a_offset], 
00317                                     lda, &beta, &c1[c1_offset], ldc);
00318 
00319 /*                       call dsfrk the RFP routine -> gives CRF */
00320 
00321                             s_copy(srnamc_1.srnamt, "DSFRK ", (ftnlen)32, (
00322                                     ftnlen)6);
00323                             dsfrk_(cform, uplo, trans, &n, &k, &alpha, &a[
00324                                     a_offset], lda, &beta, &crf[1]);
00325 
00326 /*                       convert CRF in full format -> gives C2 */
00327 
00328                             s_copy(srnamc_1.srnamt, "DTFTTR", (ftnlen)32, (
00329                                     ftnlen)6);
00330                             dtfttr_(cform, uplo, &n, &crf[1], &c2[c2_offset], 
00331                                     ldc, &info);
00332 
00333 /*                       compare C1 and C2 */
00334 
00335                             i__3 = n;
00336                             for (j = 1; j <= i__3; ++j) {
00337                                 i__4 = n;
00338                                 for (i__ = 1; i__ <= i__4; ++i__) {
00339                                     c1[i__ + j * c1_dim1] -= c2[i__ + j * 
00340                                             c2_dim1];
00341                                 }
00342                             }
00343 
00344 /*                       Yes, C1 is symmetric so we could call DLANSY, */
00345 /*                       but we want to check the upper part that is */
00346 /*                       supposed to be unchanged and the diagonal that */
00347 /*                       is supposed to be real -> DLANGE */
00348 
00349                             result[0] = dlange_("I", &n, &n, &c1[c1_offset], 
00350                                     ldc, &d_work_dlange__[1]);
00351 /* Computing MAX */
00352                             d__1 = abs(alpha) * norma + abs(beta);
00353                             result[0] = result[0] / max(d__1,1.) / max(n,1) / 
00354                                     eps;
00355 
00356                             if (result[0] >= *thresh) {
00357                                 if (nfail == 0) {
00358                                     io___28.ciunit = *nout;
00359                                     s_wsle(&io___28);
00360                                     e_wsle();
00361                                     io___29.ciunit = *nout;
00362                                     s_wsfe(&io___29);
00363                                     e_wsfe();
00364                                 }
00365                                 io___30.ciunit = *nout;
00366                                 s_wsfe(&io___30);
00367                                 do_fio(&c__1, "DSFRK", (ftnlen)5);
00368                                 do_fio(&c__1, cform, (ftnlen)1);
00369                                 do_fio(&c__1, uplo, (ftnlen)1);
00370                                 do_fio(&c__1, trans, (ftnlen)1);
00371                                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00372                                         integer));
00373                                 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00374                                         integer));
00375                                 do_fio(&c__1, (char *)&result[0], (ftnlen)
00376                                         sizeof(doublereal));
00377                                 e_wsfe();
00378                                 ++nfail;
00379                             }
00380 
00381 /* L100: */
00382                         }
00383 /* L110: */
00384                     }
00385 /* L120: */
00386                 }
00387 /* L130: */
00388             }
00389 /* L140: */
00390         }
00391 /* L150: */
00392     }
00393 
00394 /*     Print a summary of the results. */
00395 
00396     if (nfail == 0) {
00397         io___31.ciunit = *nout;
00398         s_wsfe(&io___31);
00399         do_fio(&c__1, "DSFRK", (ftnlen)5);
00400         do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00401         e_wsfe();
00402     } else {
00403         io___32.ciunit = *nout;
00404         s_wsfe(&io___32);
00405         do_fio(&c__1, "DSFRK", (ftnlen)5);
00406         do_fio(&c__1, (char *)&nfail, (ftnlen)sizeof(integer));
00407         do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00408         e_wsfe();
00409     }
00410 
00411 
00412     return 0;
00413 
00414 /*     End of DDRVRF4 */
00415 
00416 } /* ddrvrf4_ */


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