ddrvrf1.c
Go to the documentation of this file.
00001 /* ddrvrf1.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 ddrvrf1_(integer *nout, integer *nn, integer *nval, 
00030         doublereal *thresh, doublereal *a, integer *lda, doublereal *arf, 
00031         doublereal *work)
00032 {
00033     /* Initialized data */
00034 
00035     static integer iseedy[4] = { 1988,1989,1990,1991 };
00036     static char uplos[1*2] = "U" "L";
00037     static char forms[1*2] = "N" "T";
00038     static char norms[1*4] = "M" "1" "I" "F";
00039 
00040     /* Format strings */
00041     static char fmt_9999[] = "(1x,\002 *** Error(s) or Failure(s) while test"
00042             "ing DLANSF              ***\002)";
00043     static char fmt_9998[] = "(1x,\002     Error in \002,a6,\002 with UPLO="
00044             "'\002,a1,\002', FORM='\002,a1,\002', N=\002,i5)";
00045     static char fmt_9997[] = "(1x,\002     Failure in \002,a6,\002 N=\002,"
00046             "i5,\002 TYPE=\002,i5,\002 UPLO='\002,a1,\002', FORM ='\002,a1"
00047             ",\002', NORM='\002,a1,\002', test=\002,g12.5)";
00048     static char fmt_9996[] = "(1x,\002All tests for \002,a6,\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     static char fmt_9994[] = "(26x,i5,\002 error message recorded (\002,a6"
00054             ",\002)\002)";
00055 
00056     /* System generated locals */
00057     integer a_dim1, a_offset, i__1, i__2, i__3;
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, n, iin, iit;
00066     doublereal eps;
00067     integer info;
00068     char norm[1], uplo[1];
00069     integer nrun, nfail;
00070     doublereal large;
00071     integer iseed[4];
00072     char cform[1];
00073     doublereal small;
00074     integer iform;
00075     doublereal norma;
00076     integer inorm, iuplo, nerrs;
00077     extern doublereal dlamch_(char *), dlarnd_(integer *, integer *), 
00078             dlansf_(char *, char *, char *, integer *, doublereal *, 
00079             doublereal *), dlansy_(char *, char *, 
00080             integer *, doublereal *, integer *, doublereal *);
00081     extern /* Subroutine */ int dtrttf_(char *, char *, integer *, doublereal 
00082             *, integer *, doublereal *, integer *);
00083     doublereal result[1], normarf;
00084 
00085     /* Fortran I/O blocks */
00086     static cilist io___22 = { 0, 0, 0, 0, 0 };
00087     static cilist io___23 = { 0, 0, 0, fmt_9999, 0 };
00088     static cilist io___24 = { 0, 0, 0, fmt_9998, 0 };
00089     static cilist io___30 = { 0, 0, 0, 0, 0 };
00090     static cilist io___31 = { 0, 0, 0, fmt_9999, 0 };
00091     static cilist io___32 = { 0, 0, 0, fmt_9997, 0 };
00092     static cilist io___33 = { 0, 0, 0, fmt_9996, 0 };
00093     static cilist io___34 = { 0, 0, 0, fmt_9995, 0 };
00094     static cilist io___35 = { 0, 0, 0, fmt_9994, 0 };
00095 
00096 
00097 
00098 /*  -- LAPACK test routine (version 3.2.0) -- */
00099 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00100 /*     November 2008 */
00101 
00102 /*     .. Scalar Arguments .. */
00103 /*     .. */
00104 /*     .. Array Arguments .. */
00105 /*     .. */
00106 
00107 /*  Purpose */
00108 /*  ======= */
00109 
00110 /*  DDRVRF1 tests the LAPACK RFP routines: */
00111 /*      DLANSF */
00112 
00113 /*  Arguments */
00114 /*  ========= */
00115 
00116 /*  NOUT          (input) INTEGER */
00117 /*                The unit number for output. */
00118 
00119 /*  NN            (input) INTEGER */
00120 /*                The number of values of N contained in the vector NVAL. */
00121 
00122 /*  NVAL          (input) INTEGER array, dimension (NN) */
00123 /*                The values of the matrix dimension N. */
00124 
00125 /*  THRESH        (input) DOUBLE PRECISION */
00126 /*                The threshold value for the test ratios.  A result is */
00127 /*                included in the output file if RESULT >= THRESH.  To have */
00128 /*                every test ratio printed, use THRESH = 0. */
00129 
00130 /*  A             (workspace) DOUBLE PRECISION array, dimension (LDA,NMAX) */
00131 
00132 /*  LDA           (input) INTEGER */
00133 /*                The leading dimension of the array A.  LDA >= max(1,NMAX). */
00134 
00135 /*  ARF           (workspace) DOUBLE PRECISION array, dimension ((NMAX*(NMAX+1))/2). */
00136 
00137 /*  WORK          (workspace) DOUBLE PRECISION array, dimension ( NMAX ) */
00138 
00139 /*  ===================================================================== */
00140 /*     .. */
00141 /*     .. Parameters .. */
00142 /*     .. */
00143 /*     .. Local Scalars .. */
00144 /*     .. */
00145 /*     .. Local Arrays .. */
00146 /*     .. */
00147 /*     .. External Functions .. */
00148 /*     .. */
00149 /*     .. External Subroutines .. */
00150 /*     .. */
00151 /*     .. Scalars in Common .. */
00152 /*     .. */
00153 /*     .. Common blocks .. */
00154 /*     .. */
00155 /*     .. Data statements .. */
00156     /* Parameter adjustments */
00157     --nval;
00158     a_dim1 = *lda;
00159     a_offset = 1 + a_dim1;
00160     a -= a_offset;
00161     --arf;
00162     --work;
00163 
00164     /* Function Body */
00165 /*     .. */
00166 /*     .. Executable Statements .. */
00167 
00168 /*     Initialize constants and the random number seed. */
00169 
00170     nrun = 0;
00171     nfail = 0;
00172     nerrs = 0;
00173     info = 0;
00174     for (i__ = 1; i__ <= 4; ++i__) {
00175         iseed[i__ - 1] = iseedy[i__ - 1];
00176 /* L10: */
00177     }
00178 
00179     eps = dlamch_("Precision");
00180     small = dlamch_("Safe minimum");
00181     large = 1. / small;
00182     small = small * *lda * *lda;
00183     large = large / *lda / *lda;
00184 
00185     i__1 = *nn;
00186     for (iin = 1; iin <= i__1; ++iin) {
00187 
00188         n = nval[iin];
00189 
00190         for (iit = 1; iit <= 3; ++iit) {
00191 
00192 /*           IIT = 1 : random matrix */
00193 /*           IIT = 2 : random matrix scaled near underflow */
00194 /*           IIT = 3 : random matrix scaled near overflow */
00195 
00196             i__2 = n;
00197             for (j = 1; j <= i__2; ++j) {
00198                 i__3 = n;
00199                 for (i__ = 1; i__ <= i__3; ++i__) {
00200                     a[i__ + j * a_dim1] = dlarnd_(&c__2, iseed);
00201                 }
00202             }
00203 
00204             if (iit == 2) {
00205                 i__2 = n;
00206                 for (j = 1; j <= i__2; ++j) {
00207                     i__3 = n;
00208                     for (i__ = 1; i__ <= i__3; ++i__) {
00209                         a[i__ + j * a_dim1] *= large;
00210                     }
00211                 }
00212             }
00213 
00214             if (iit == 3) {
00215                 i__2 = n;
00216                 for (j = 1; j <= i__2; ++j) {
00217                     i__3 = n;
00218                     for (i__ = 1; i__ <= i__3; ++i__) {
00219                         a[i__ + j * a_dim1] *= small;
00220                     }
00221                 }
00222             }
00223 
00224 /*           Do first for UPLO = 'U', then for UPLO = 'L' */
00225 
00226             for (iuplo = 1; iuplo <= 2; ++iuplo) {
00227 
00228                 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00229 
00230 /*              Do first for CFORM = 'N', then for CFORM = 'C' */
00231 
00232                 for (iform = 1; iform <= 2; ++iform) {
00233 
00234                     *(unsigned char *)cform = *(unsigned char *)&forms[iform 
00235                             - 1];
00236 
00237                     s_copy(srnamc_1.srnamt, "DTRTTF", (ftnlen)32, (ftnlen)6);
00238                     dtrttf_(cform, uplo, &n, &a[a_offset], lda, &arf[1], &
00239                             info);
00240 
00241 /*                 Check error code from DTRTTF */
00242 
00243                     if (info != 0) {
00244                         if (nfail == 0 && nerrs == 0) {
00245                             io___22.ciunit = *nout;
00246                             s_wsle(&io___22);
00247                             e_wsle();
00248                             io___23.ciunit = *nout;
00249                             s_wsfe(&io___23);
00250                             e_wsfe();
00251                         }
00252                         io___24.ciunit = *nout;
00253                         s_wsfe(&io___24);
00254                         do_fio(&c__1, srnamc_1.srnamt, (ftnlen)32);
00255                         do_fio(&c__1, uplo, (ftnlen)1);
00256                         do_fio(&c__1, cform, (ftnlen)1);
00257                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00258                         e_wsfe();
00259                         ++nerrs;
00260                         goto L100;
00261                     }
00262 
00263                     for (inorm = 1; inorm <= 4; ++inorm) {
00264 
00265 /*                    Check all four norms: 'M', '1', 'I', 'F' */
00266 
00267                         *(unsigned char *)norm = *(unsigned char *)&norms[
00268                                 inorm - 1];
00269                         normarf = dlansf_(norm, cform, uplo, &n, &arf[1], &
00270                                 work[1]);
00271                         norma = dlansy_(norm, uplo, &n, &a[a_offset], lda, &
00272                                 work[1]);
00273 
00274                         result[0] = (norma - normarf) / norma / eps;
00275                         ++nrun;
00276 
00277                         if (result[0] >= *thresh) {
00278                             if (nfail == 0 && nerrs == 0) {
00279                                 io___30.ciunit = *nout;
00280                                 s_wsle(&io___30);
00281                                 e_wsle();
00282                                 io___31.ciunit = *nout;
00283                                 s_wsfe(&io___31);
00284                                 e_wsfe();
00285                             }
00286                             io___32.ciunit = *nout;
00287                             s_wsfe(&io___32);
00288                             do_fio(&c__1, "DLANSF", (ftnlen)6);
00289                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00290                                     ;
00291                             do_fio(&c__1, (char *)&iit, (ftnlen)sizeof(
00292                                     integer));
00293                             do_fio(&c__1, uplo, (ftnlen)1);
00294                             do_fio(&c__1, cform, (ftnlen)1);
00295                             do_fio(&c__1, norm, (ftnlen)1);
00296                             do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(
00297                                     doublereal));
00298                             e_wsfe();
00299                             ++nfail;
00300                         }
00301 /* L90: */
00302                     }
00303 L100:
00304                     ;
00305                 }
00306 /* L110: */
00307             }
00308 /* L120: */
00309         }
00310 /* L130: */
00311     }
00312 
00313 /*     Print a summary of the results. */
00314 
00315     if (nfail == 0) {
00316         io___33.ciunit = *nout;
00317         s_wsfe(&io___33);
00318         do_fio(&c__1, "DLANSF", (ftnlen)6);
00319         do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00320         e_wsfe();
00321     } else {
00322         io___34.ciunit = *nout;
00323         s_wsfe(&io___34);
00324         do_fio(&c__1, "DLANSF", (ftnlen)6);
00325         do_fio(&c__1, (char *)&nfail, (ftnlen)sizeof(integer));
00326         do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00327         e_wsfe();
00328     }
00329     if (nerrs != 0) {
00330         io___35.ciunit = *nout;
00331         s_wsfe(&io___35);
00332         do_fio(&c__1, (char *)&nerrs, (ftnlen)sizeof(integer));
00333         do_fio(&c__1, "DLANSF", (ftnlen)6);
00334         e_wsfe();
00335     }
00336 
00337 
00338     return 0;
00339 
00340 /*     End of DDRVRF1 */
00341 
00342 } /* ddrvrf1_ */


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