zchkbl.c
Go to the documentation of this file.
00001 /* zchkbl.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__7 = 7;
00021 static integer c__5 = 5;
00022 static integer c__20 = 20;
00023 
00024 /* Subroutine */ int zchkbl_(integer *nin, integer *nout)
00025 {
00026     /* Format strings */
00027     static char fmt_9999[] = "(1x,\002.. test output of ZGEBAL .. \002)";
00028     static char fmt_9998[] = "(1x,\002value of largest test error           "
00029             " = \002,d12.3)";
00030     static char fmt_9997[] = "(1x,\002example number where info is not zero "
00031             " = \002,i4)";
00032     static char fmt_9996[] = "(1x,\002example number where ILO or IHI wrong "
00033             " = \002,i4)";
00034     static char fmt_9995[] = "(1x,\002example number having largest error   "
00035             " = \002,i4)";
00036     static char fmt_9994[] = "(1x,\002number of examples where info is not 0"
00037             " = \002,i4)";
00038     static char fmt_9993[] = "(1x,\002total number of examples tested       "
00039             " = \002,i4)";
00040 
00041     /* System generated locals */
00042     integer i__1, i__2, i__3, i__4;
00043     doublereal d__1, d__2, d__3, d__4, d__5, d__6;
00044     doublecomplex z__1, z__2;
00045 
00046     /* Builtin functions */
00047     integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
00048             e_rsle(void);
00049     double d_imag(doublecomplex *);
00050     integer s_wsfe(cilist *), e_wsfe(void), do_fio(integer *, char *, ftnlen);
00051 
00052     /* Local variables */
00053     doublecomplex a[400]        /* was [20][20] */;
00054     integer i__, j, n;
00055     doublecomplex ain[400]      /* was [20][20] */;
00056     integer ihi, ilo, knt, info, lmax[3];
00057     doublereal meps, temp, rmax, vmax, scale[20];
00058     integer ihiin, ninfo, iloin;
00059     doublereal anorm, sfmin, dummy[1];
00060     extern doublereal dlamch_(char *);
00061     extern /* Subroutine */ int zgebal_(char *, integer *, doublecomplex *, 
00062             integer *, integer *, integer *, doublereal *, integer *);
00063     doublereal scalin[20];
00064     extern doublereal zlange_(char *, integer *, integer *, doublecomplex *, 
00065             integer *, doublereal *);
00066 
00067     /* Fortran I/O blocks */
00068     static cilist io___8 = { 0, 0, 0, 0, 0 };
00069     static cilist io___11 = { 0, 0, 0, 0, 0 };
00070     static cilist io___14 = { 0, 0, 0, 0, 0 };
00071     static cilist io___17 = { 0, 0, 0, 0, 0 };
00072     static cilist io___19 = { 0, 0, 0, 0, 0 };
00073     static cilist io___28 = { 0, 0, 0, fmt_9999, 0 };
00074     static cilist io___29 = { 0, 0, 0, fmt_9998, 0 };
00075     static cilist io___30 = { 0, 0, 0, fmt_9997, 0 };
00076     static cilist io___31 = { 0, 0, 0, fmt_9996, 0 };
00077     static cilist io___32 = { 0, 0, 0, fmt_9995, 0 };
00078     static cilist io___33 = { 0, 0, 0, fmt_9994, 0 };
00079     static cilist io___34 = { 0, 0, 0, fmt_9993, 0 };
00080 
00081 
00082 
00083 /*  -- LAPACK test routine (version 3.1) -- */
00084 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00085 /*     November 2006 */
00086 
00087 /*     .. Scalar Arguments .. */
00088 /*     .. */
00089 
00090 /*  Purpose */
00091 /*  ======= */
00092 
00093 /*  ZCHKBL tests ZGEBAL, a routine for balancing a general complex */
00094 /*  matrix and isolating some of its eigenvalues. */
00095 
00096 /*  Arguments */
00097 /*  ========= */
00098 
00099 /*  NIN     (input) INTEGER */
00100 /*          The logical unit number for input.  NIN > 0. */
00101 
00102 /*  NOUT    (input) INTEGER */
00103 /*          The logical unit number for output.  NOUT > 0. */
00104 
00105 /* ====================================================================== */
00106 
00107 /*     .. Parameters .. */
00108 /*     .. */
00109 /*     .. Local Scalars .. */
00110 /*     .. */
00111 /*     .. Local Arrays .. */
00112 /*     .. */
00113 /*     .. External Functions .. */
00114 /*     .. */
00115 /*     .. External Subroutines .. */
00116 /*     .. */
00117 /*     .. Intrinsic Functions .. */
00118 /*     .. */
00119 /*     .. Statement Functions .. */
00120 /*     .. */
00121 /*     .. Statement Function definitions .. */
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.;
00131     vmax = 0.;
00132     sfmin = dlamch_("S");
00133     meps = dlamch_("E");
00134 
00135 L10:
00136 
00137     io___8.ciunit = *nin;
00138     s_rsle(&io___8);
00139     do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
00140     e_rsle();
00141     if (n == 0) {
00142         goto L70;
00143     }
00144     i__1 = n;
00145     for (i__ = 1; i__ <= i__1; ++i__) {
00146         io___11.ciunit = *nin;
00147         s_rsle(&io___11);
00148         i__2 = n;
00149         for (j = 1; j <= i__2; ++j) {
00150             do_lio(&c__7, &c__1, (char *)&a[i__ + j * 20 - 21], (ftnlen)
00151                     sizeof(doublecomplex));
00152         }
00153         e_rsle();
00154 /* L20: */
00155     }
00156 
00157     io___14.ciunit = *nin;
00158     s_rsle(&io___14);
00159     do_lio(&c__3, &c__1, (char *)&iloin, (ftnlen)sizeof(integer));
00160     do_lio(&c__3, &c__1, (char *)&ihiin, (ftnlen)sizeof(integer));
00161     e_rsle();
00162     i__1 = n;
00163     for (i__ = 1; i__ <= i__1; ++i__) {
00164         io___17.ciunit = *nin;
00165         s_rsle(&io___17);
00166         i__2 = n;
00167         for (j = 1; j <= i__2; ++j) {
00168             do_lio(&c__7, &c__1, (char *)&ain[i__ + j * 20 - 21], (ftnlen)
00169                     sizeof(doublecomplex));
00170         }
00171         e_rsle();
00172 /* L30: */
00173     }
00174     io___19.ciunit = *nin;
00175     s_rsle(&io___19);
00176     i__1 = n;
00177     for (i__ = 1; i__ <= i__1; ++i__) {
00178         do_lio(&c__5, &c__1, (char *)&scalin[i__ - 1], (ftnlen)sizeof(
00179                 doublereal));
00180     }
00181     e_rsle();
00182 
00183     anorm = zlange_("M", &n, &n, a, &c__20, dummy);
00184     ++knt;
00185     zgebal_("B", &n, a, &c__20, &ilo, &ihi, scale, &info);
00186 
00187     if (info != 0) {
00188         ++ninfo;
00189         lmax[0] = knt;
00190     }
00191 
00192     if (ilo != iloin || ihi != ihiin) {
00193         ++ninfo;
00194         lmax[1] = knt;
00195     }
00196 
00197     i__1 = n;
00198     for (i__ = 1; i__ <= i__1; ++i__) {
00199         i__2 = n;
00200         for (j = 1; j <= i__2; ++j) {
00201 /* Computing MAX */
00202             i__3 = i__ + j * 20 - 21;
00203             i__4 = i__ + j * 20 - 21;
00204             d__5 = (d__1 = a[i__3].r, abs(d__1)) + (d__2 = d_imag(&a[i__ + j *
00205                      20 - 21]), abs(d__2)), d__6 = (d__3 = ain[i__4].r, abs(
00206                     d__3)) + (d__4 = d_imag(&ain[i__ + j * 20 - 21]), abs(
00207                     d__4));
00208             temp = max(d__5,d__6);
00209             temp = max(temp,sfmin);
00210             i__3 = i__ + j * 20 - 21;
00211             i__4 = i__ + j * 20 - 21;
00212             z__2.r = a[i__3].r - ain[i__4].r, z__2.i = a[i__3].i - ain[i__4]
00213                     .i;
00214             z__1.r = z__2.r, z__1.i = z__2.i;
00215 /* Computing MAX */
00216             d__3 = vmax, d__4 = ((d__1 = z__1.r, abs(d__1)) + (d__2 = d_imag(&
00217                     z__1), abs(d__2))) / temp;
00218             vmax = max(d__3,d__4);
00219 /* L40: */
00220         }
00221 /* L50: */
00222     }
00223 
00224     i__1 = n;
00225     for (i__ = 1; i__ <= i__1; ++i__) {
00226 /* Computing MAX */
00227         d__1 = scale[i__ - 1], d__2 = scalin[i__ - 1];
00228         temp = max(d__1,d__2);
00229         temp = max(temp,sfmin);
00230 /* Computing MAX */
00231         d__2 = vmax, d__3 = (d__1 = scale[i__ - 1] - scalin[i__ - 1], abs(
00232                 d__1)) / temp;
00233         vmax = max(d__2,d__3);
00234 /* L60: */
00235     }
00236 
00237     if (vmax > rmax) {
00238         lmax[2] = knt;
00239         rmax = vmax;
00240     }
00241 
00242     goto L10;
00243 
00244 L70:
00245 
00246     io___28.ciunit = *nout;
00247     s_wsfe(&io___28);
00248     e_wsfe();
00249 
00250     io___29.ciunit = *nout;
00251     s_wsfe(&io___29);
00252     do_fio(&c__1, (char *)&rmax, (ftnlen)sizeof(doublereal));
00253     e_wsfe();
00254     io___30.ciunit = *nout;
00255     s_wsfe(&io___30);
00256     do_fio(&c__1, (char *)&lmax[0], (ftnlen)sizeof(integer));
00257     e_wsfe();
00258     io___31.ciunit = *nout;
00259     s_wsfe(&io___31);
00260     do_fio(&c__1, (char *)&lmax[1], (ftnlen)sizeof(integer));
00261     e_wsfe();
00262     io___32.ciunit = *nout;
00263     s_wsfe(&io___32);
00264     do_fio(&c__1, (char *)&lmax[2], (ftnlen)sizeof(integer));
00265     e_wsfe();
00266     io___33.ciunit = *nout;
00267     s_wsfe(&io___33);
00268     do_fio(&c__1, (char *)&ninfo, (ftnlen)sizeof(integer));
00269     e_wsfe();
00270     io___34.ciunit = *nout;
00271     s_wsfe(&io___34);
00272     do_fio(&c__1, (char *)&knt, (ftnlen)sizeof(integer));
00273     e_wsfe();
00274 
00275     return 0;
00276 
00277 /*     End of ZCHKBL */
00278 
00279 } /* zchkbl_ */


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