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


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