schkbk.c
Go to the documentation of this file.
00001 /* schkbk.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 schkbk_(integer *nin, integer *nout)
00024 {
00025     /* Format strings */
00026     static char fmt_9999[] = "(1x,\002.. test output of SGEBAK .. \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 having largest error   "
00032             "  = \002,i4)";
00033     static char fmt_9995[] = "(1x,\002number of examples where info is not 0"
00034             "  = \002,i4)";
00035     static char fmt_9994[] = "(1x,\002total number of examples tested       "
00036             "  = \002,i4)";
00037 
00038     /* System generated locals */
00039     integer i__1, i__2;
00040     real r__1, r__2;
00041 
00042     /* Builtin functions */
00043     integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
00044             e_rsle(void), s_wsfe(cilist *), e_wsfe(void), do_fio(integer *, 
00045             char *, ftnlen);
00046 
00047     /* Local variables */
00048     real e[400] /* was [20][20] */;
00049     integer i__, j, n;
00050     real x;
00051     integer ihi;
00052     real ein[400]       /* was [20][20] */;
00053     integer ilo;
00054     real eps;
00055     integer knt, info, lmax[2];
00056     real rmax, vmax, scale[20];
00057     integer ninfo;
00058     extern /* Subroutine */ int sgebak_(char *, char *, integer *, integer *, 
00059             integer *, real *, integer *, real *, integer *, integer *);
00060     extern doublereal slamch_(char *);
00061     real safmin;
00062 
00063     /* Fortran I/O blocks */
00064     static cilist io___7 = { 0, 0, 0, 0, 0 };
00065     static cilist io___11 = { 0, 0, 0, 0, 0 };
00066     static cilist io___14 = { 0, 0, 0, 0, 0 };
00067     static cilist io___17 = { 0, 0, 0, 0, 0 };
00068     static cilist io___22 = { 0, 0, 0, fmt_9999, 0 };
00069     static cilist io___23 = { 0, 0, 0, fmt_9998, 0 };
00070     static cilist io___24 = { 0, 0, 0, fmt_9997, 0 };
00071     static cilist io___25 = { 0, 0, 0, fmt_9996, 0 };
00072     static cilist io___26 = { 0, 0, 0, fmt_9995, 0 };
00073     static cilist io___27 = { 0, 0, 0, fmt_9994, 0 };
00074 
00075 
00076 
00077 /*  -- LAPACK test routine (version 3.1) -- */
00078 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00079 /*     November 2006 */
00080 
00081 /*     .. Scalar Arguments .. */
00082 /*     .. */
00083 
00084 /*  Purpose */
00085 /*  ======= */
00086 
00087 /*  SCHKBK tests SGEBAK, a routine for backward transformation of */
00088 /*  the computed right or left eigenvectors if the orginal matrix */
00089 /*  was preprocessed by balance subroutine SGEBAL. */
00090 
00091 /*  Arguments */
00092 /*  ========= */
00093 
00094 /*  NIN     (input) INTEGER */
00095 /*          The logical unit number for input.  NIN > 0. */
00096 
00097 /*  NOUT    (input) INTEGER */
00098 /*          The logical unit number for output.  NOUT > 0. */
00099 
00100 /* ====================================================================== */
00101 
00102 /*     .. Parameters .. */
00103 /*     .. */
00104 /*     .. Local Scalars .. */
00105 /*     .. */
00106 /*     .. Local Arrays .. */
00107 /*     .. */
00108 /*     .. External Functions .. */
00109 /*     .. */
00110 /*     .. External Subroutines .. */
00111 /*     .. */
00112 /*     .. Intrinsic Functions .. */
00113 /*     .. */
00114 /*     .. Executable Statements .. */
00115 
00116     lmax[0] = 0;
00117     lmax[1] = 0;
00118     ninfo = 0;
00119     knt = 0;
00120     rmax = 0.f;
00121     eps = slamch_("E");
00122     safmin = slamch_("S");
00123 
00124 L10:
00125 
00126     io___7.ciunit = *nin;
00127     s_rsle(&io___7);
00128     do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
00129     do_lio(&c__3, &c__1, (char *)&ilo, (ftnlen)sizeof(integer));
00130     do_lio(&c__3, &c__1, (char *)&ihi, (ftnlen)sizeof(integer));
00131     e_rsle();
00132     if (n == 0) {
00133         goto L60;
00134     }
00135 
00136     io___11.ciunit = *nin;
00137     s_rsle(&io___11);
00138     i__1 = n;
00139     for (i__ = 1; i__ <= i__1; ++i__) {
00140         do_lio(&c__4, &c__1, (char *)&scale[i__ - 1], (ftnlen)sizeof(real));
00141     }
00142     e_rsle();
00143     i__1 = n;
00144     for (i__ = 1; i__ <= i__1; ++i__) {
00145         io___14.ciunit = *nin;
00146         s_rsle(&io___14);
00147         i__2 = n;
00148         for (j = 1; j <= i__2; ++j) {
00149             do_lio(&c__4, &c__1, (char *)&e[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___17.ciunit = *nin;
00159         s_rsle(&io___17);
00160         i__2 = n;
00161         for (j = 1; j <= i__2; ++j) {
00162             do_lio(&c__4, &c__1, (char *)&ein[i__ + j * 20 - 21], (ftnlen)
00163                     sizeof(real));
00164         }
00165         e_rsle();
00166 /* L30: */
00167     }
00168 
00169     ++knt;
00170     sgebak_("B", "R", &n, &ilo, &ihi, scale, &n, e, &c__20, &info);
00171 
00172     if (info != 0) {
00173         ++ninfo;
00174         lmax[0] = knt;
00175     }
00176 
00177     vmax = 0.f;
00178     i__1 = n;
00179     for (i__ = 1; i__ <= i__1; ++i__) {
00180         i__2 = n;
00181         for (j = 1; j <= i__2; ++j) {
00182             x = (r__1 = e[i__ + j * 20 - 21] - ein[i__ + j * 20 - 21], dabs(
00183                     r__1)) / eps;
00184             if ((r__1 = e[i__ + j * 20 - 21], dabs(r__1)) > safmin) {
00185                 x /= (r__2 = e[i__ + j * 20 - 21], dabs(r__2));
00186             }
00187             vmax = dmax(vmax,x);
00188 /* L40: */
00189         }
00190 /* L50: */
00191     }
00192 
00193     if (vmax > rmax) {
00194         lmax[1] = knt;
00195         rmax = vmax;
00196     }
00197 
00198     goto L10;
00199 
00200 L60:
00201 
00202     io___22.ciunit = *nout;
00203     s_wsfe(&io___22);
00204     e_wsfe();
00205 
00206     io___23.ciunit = *nout;
00207     s_wsfe(&io___23);
00208     do_fio(&c__1, (char *)&rmax, (ftnlen)sizeof(real));
00209     e_wsfe();
00210     io___24.ciunit = *nout;
00211     s_wsfe(&io___24);
00212     do_fio(&c__1, (char *)&lmax[0], (ftnlen)sizeof(integer));
00213     e_wsfe();
00214     io___25.ciunit = *nout;
00215     s_wsfe(&io___25);
00216     do_fio(&c__1, (char *)&lmax[1], (ftnlen)sizeof(integer));
00217     e_wsfe();
00218     io___26.ciunit = *nout;
00219     s_wsfe(&io___26);
00220     do_fio(&c__1, (char *)&ninfo, (ftnlen)sizeof(integer));
00221     e_wsfe();
00222     io___27.ciunit = *nout;
00223     s_wsfe(&io___27);
00224     do_fio(&c__1, (char *)&knt, (ftnlen)sizeof(integer));
00225     e_wsfe();
00226 
00227     return 0;
00228 
00229 /*     End of SCHKBK */
00230 
00231 } /* schkbk_ */


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