schkgl.c
Go to the documentation of this file.
00001 /* schkgl.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 integer c__3 = 3;
00019 static integer c__1 = 1;
00020 static integer c__4 = 4;
00021 static integer c__20 = 20;
00022 
00023 /* Subroutine */ int schkgl_(integer *nin, integer *nout)
00024 {
00025     /* Format strings */
00026     static char fmt_9999[] = "(1x,\002.. test output of SGGBAL .. \002)";
00027     static char fmt_9998[] = "(1x,\002value of largest test error           "
00028             " = \002,e12.3)";
00029     static char fmt_9997[] = "(1x,\002example number where info is not zero "
00030             " = \002,i4)";
00031     static char fmt_9996[] = "(1x,\002example number where ILO or IHI wrong "
00032             " = \002,i4)";
00033     static char fmt_9995[] = "(1x,\002example number having largest error   "
00034             " = \002,i4)";
00035     static char fmt_9994[] = "(1x,\002number of examples where info is not 0"
00036             " = \002,i4)";
00037     static char fmt_9993[] = "(1x,\002total number of examples tested       "
00038             " = \002,i4)";
00039 
00040     /* System generated locals */
00041     integer i__1, i__2;
00042     real r__1, r__2, r__3;
00043 
00044     /* Builtin functions */
00045     integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
00046             e_rsle(void), s_wsfe(cilist *), e_wsfe(void), do_fio(integer *, 
00047             char *, ftnlen);
00048 
00049     /* Local variables */
00050     real a[400] /* was [20][20] */, b[400]      /* was [20][20] */;
00051     integer i__, j, n;
00052     real ain[400]       /* was [20][20] */, bin[400]    /* was [20][20] */;
00053     integer ihi, ilo;
00054     real eps;
00055     integer knt, info, lmax[5];
00056     real rmax, vmax, work[120];
00057     integer ihiin, ninfo, iloin;
00058     real anorm, bnorm;
00059     extern /* Subroutine */ int sggbal_(char *, integer *, real *, integer *, 
00060             real *, integer *, integer *, integer *, real *, real *, real *, 
00061             integer *);
00062     real lscale[20];
00063     extern doublereal slamch_(char *);
00064     real rscale[20];
00065     extern doublereal slange_(char *, integer *, integer *, real *, integer *, 
00066              real *);
00067     real lsclin[20], rsclin[20];
00068 
00069     /* Fortran I/O blocks */
00070     static cilist io___6 = { 0, 0, 0, 0, 0 };
00071     static cilist io___9 = { 0, 0, 0, 0, 0 };
00072     static cilist io___12 = { 0, 0, 0, 0, 0 };
00073     static cilist io___14 = { 0, 0, 0, 0, 0 };
00074     static cilist io___17 = { 0, 0, 0, 0, 0 };
00075     static cilist io___19 = { 0, 0, 0, 0, 0 };
00076     static cilist io___21 = { 0, 0, 0, 0, 0 };
00077     static cilist io___23 = { 0, 0, 0, 0, 0 };
00078     static cilist io___34 = { 0, 0, 0, fmt_9999, 0 };
00079     static cilist io___35 = { 0, 0, 0, fmt_9998, 0 };
00080     static cilist io___36 = { 0, 0, 0, fmt_9997, 0 };
00081     static cilist io___37 = { 0, 0, 0, fmt_9996, 0 };
00082     static cilist io___38 = { 0, 0, 0, fmt_9995, 0 };
00083     static cilist io___39 = { 0, 0, 0, fmt_9994, 0 };
00084     static cilist io___40 = { 0, 0, 0, fmt_9993, 0 };
00085 
00086 
00087 
00088 /*  -- LAPACK test routine (version 3.1) -- */
00089 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00090 /*     November 2006 */
00091 
00092 /*     .. Scalar Arguments .. */
00093 /*     .. */
00094 
00095 /*  Purpose */
00096 /*  ======= */
00097 
00098 /*  SCHKGL tests SGGBAL, a routine for balancing a matrix pair (A, B). */
00099 
00100 /*  Arguments */
00101 /*  ========= */
00102 
00103 /*  NIN     (input) INTEGER */
00104 /*          The logical unit number for input.  NIN > 0. */
00105 
00106 /*  NOUT    (input) INTEGER */
00107 /*          The logical unit number for output.  NOUT > 0. */
00108 
00109 /*  ===================================================================== */
00110 
00111 /*     .. Parameters .. */
00112 /*     .. */
00113 /*     .. Local Scalars .. */
00114 /*     .. */
00115 /*     .. Local Arrays .. */
00116 /*     .. */
00117 /*     .. External Functions .. */
00118 /*     .. */
00119 /*     .. External Subroutines .. */
00120 /*     .. */
00121 /*     .. Intrinsic Functions .. */
00122 /*     .. */
00123 /*     .. Executable Statements .. */
00124 
00125     lmax[0] = 0;
00126     lmax[1] = 0;
00127     lmax[2] = 0;
00128     ninfo = 0;
00129     knt = 0;
00130     rmax = 0.f;
00131 
00132     eps = slamch_("Precision");
00133 
00134 L10:
00135 
00136     io___6.ciunit = *nin;
00137     s_rsle(&io___6);
00138     do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
00139     e_rsle();
00140     if (n == 0) {
00141         goto L90;
00142     }
00143     i__1 = n;
00144     for (i__ = 1; i__ <= i__1; ++i__) {
00145         io___9.ciunit = *nin;
00146         s_rsle(&io___9);
00147         i__2 = n;
00148         for (j = 1; j <= i__2; ++j) {
00149             do_lio(&c__4, &c__1, (char *)&a[i__ + j * 20 - 21], (ftnlen)
00150                     sizeof(real));
00151         }
00152         e_rsle();
00153 /* L20: */
00154     }
00155 
00156     i__1 = n;
00157     for (i__ = 1; i__ <= i__1; ++i__) {
00158         io___12.ciunit = *nin;
00159         s_rsle(&io___12);
00160         i__2 = n;
00161         for (j = 1; j <= i__2; ++j) {
00162             do_lio(&c__4, &c__1, (char *)&b[i__ + j * 20 - 21], (ftnlen)
00163                     sizeof(real));
00164         }
00165         e_rsle();
00166 /* L30: */
00167     }
00168 
00169     io___14.ciunit = *nin;
00170     s_rsle(&io___14);
00171     do_lio(&c__3, &c__1, (char *)&iloin, (ftnlen)sizeof(integer));
00172     do_lio(&c__3, &c__1, (char *)&ihiin, (ftnlen)sizeof(integer));
00173     e_rsle();
00174     i__1 = n;
00175     for (i__ = 1; i__ <= i__1; ++i__) {
00176         io___17.ciunit = *nin;
00177         s_rsle(&io___17);
00178         i__2 = n;
00179         for (j = 1; j <= i__2; ++j) {
00180             do_lio(&c__4, &c__1, (char *)&ain[i__ + j * 20 - 21], (ftnlen)
00181                     sizeof(real));
00182         }
00183         e_rsle();
00184 /* L40: */
00185     }
00186     i__1 = n;
00187     for (i__ = 1; i__ <= i__1; ++i__) {
00188         io___19.ciunit = *nin;
00189         s_rsle(&io___19);
00190         i__2 = n;
00191         for (j = 1; j <= i__2; ++j) {
00192             do_lio(&c__4, &c__1, (char *)&bin[i__ + j * 20 - 21], (ftnlen)
00193                     sizeof(real));
00194         }
00195         e_rsle();
00196 /* L50: */
00197     }
00198 
00199     io___21.ciunit = *nin;
00200     s_rsle(&io___21);
00201     i__1 = n;
00202     for (i__ = 1; i__ <= i__1; ++i__) {
00203         do_lio(&c__4, &c__1, (char *)&lsclin[i__ - 1], (ftnlen)sizeof(real));
00204     }
00205     e_rsle();
00206     io___23.ciunit = *nin;
00207     s_rsle(&io___23);
00208     i__1 = n;
00209     for (i__ = 1; i__ <= i__1; ++i__) {
00210         do_lio(&c__4, &c__1, (char *)&rsclin[i__ - 1], (ftnlen)sizeof(real));
00211     }
00212     e_rsle();
00213 
00214     anorm = slange_("M", &n, &n, a, &c__20, work);
00215     bnorm = slange_("M", &n, &n, b, &c__20, work);
00216 
00217     ++knt;
00218 
00219     sggbal_("B", &n, a, &c__20, b, &c__20, &ilo, &ihi, lscale, rscale, work, &
00220             info);
00221 
00222     if (info != 0) {
00223         ++ninfo;
00224         lmax[0] = knt;
00225     }
00226 
00227     if (ilo != iloin || ihi != ihiin) {
00228         ++ninfo;
00229         lmax[1] = knt;
00230     }
00231 
00232     vmax = 0.f;
00233     i__1 = n;
00234     for (i__ = 1; i__ <= i__1; ++i__) {
00235         i__2 = n;
00236         for (j = 1; j <= i__2; ++j) {
00237 /* Computing MAX */
00238             r__2 = vmax, r__3 = (r__1 = a[i__ + j * 20 - 21] - ain[i__ + j * 
00239                     20 - 21], dabs(r__1));
00240             vmax = dmax(r__2,r__3);
00241 /* Computing MAX */
00242             r__2 = vmax, r__3 = (r__1 = b[i__ + j * 20 - 21] - bin[i__ + j * 
00243                     20 - 21], dabs(r__1));
00244             vmax = dmax(r__2,r__3);
00245 /* L60: */
00246         }
00247 /* L70: */
00248     }
00249 
00250     i__1 = n;
00251     for (i__ = 1; i__ <= i__1; ++i__) {
00252 /* Computing MAX */
00253         r__2 = vmax, r__3 = (r__1 = lscale[i__ - 1] - lsclin[i__ - 1], dabs(
00254                 r__1));
00255         vmax = dmax(r__2,r__3);
00256 /* Computing MAX */
00257         r__2 = vmax, r__3 = (r__1 = rscale[i__ - 1] - rsclin[i__ - 1], dabs(
00258                 r__1));
00259         vmax = dmax(r__2,r__3);
00260 /* L80: */
00261     }
00262 
00263     vmax /= eps * dmax(anorm,bnorm);
00264 
00265     if (vmax > rmax) {
00266         lmax[2] = knt;
00267         rmax = vmax;
00268     }
00269 
00270     goto L10;
00271 
00272 L90:
00273 
00274     io___34.ciunit = *nout;
00275     s_wsfe(&io___34);
00276     e_wsfe();
00277 
00278     io___35.ciunit = *nout;
00279     s_wsfe(&io___35);
00280     do_fio(&c__1, (char *)&rmax, (ftnlen)sizeof(real));
00281     e_wsfe();
00282     io___36.ciunit = *nout;
00283     s_wsfe(&io___36);
00284     do_fio(&c__1, (char *)&lmax[0], (ftnlen)sizeof(integer));
00285     e_wsfe();
00286     io___37.ciunit = *nout;
00287     s_wsfe(&io___37);
00288     do_fio(&c__1, (char *)&lmax[1], (ftnlen)sizeof(integer));
00289     e_wsfe();
00290     io___38.ciunit = *nout;
00291     s_wsfe(&io___38);
00292     do_fio(&c__1, (char *)&lmax[2], (ftnlen)sizeof(integer));
00293     e_wsfe();
00294     io___39.ciunit = *nout;
00295     s_wsfe(&io___39);
00296     do_fio(&c__1, (char *)&ninfo, (ftnlen)sizeof(integer));
00297     e_wsfe();
00298     io___40.ciunit = *nout;
00299     s_wsfe(&io___40);
00300     do_fio(&c__1, (char *)&knt, (ftnlen)sizeof(integer));
00301     e_wsfe();
00302 
00303     return 0;
00304 
00305 /*     End of SCHKGL */
00306 
00307 } /* schkgl_ */


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