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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:23