zget35.c
Go to the documentation of this file.
00001 /* zget35.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__10 = 10;
00022 static doublecomplex c_b43 = {1.,0.};
00023 
00024 /* Subroutine */ int zget35_(doublereal *rmax, integer *lmax, integer *ninfo, 
00025         integer *knt, integer *nin)
00026 {
00027     /* System generated locals */
00028     integer i__1, i__2, i__3, i__4, i__5;
00029     doublereal d__1, d__2;
00030     doublecomplex z__1;
00031 
00032     /* Builtin functions */
00033     double sqrt(doublereal);
00034     integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
00035             e_rsle(void);
00036     double z_abs(doublecomplex *);
00037     void z_div(doublecomplex *, doublecomplex *, doublecomplex *);
00038 
00039     /* Local variables */
00040     doublecomplex a[100]        /* was [10][10] */, b[100]      /* was [10][
00041             10] */, c__[100]    /* was [10][10] */;
00042     integer i__, j, m, n;
00043     doublereal vm1[3], vm2[3], dum[1], eps, res, res1;
00044     integer imla, imlb, imlc, info;
00045     doublecomplex csav[100]     /* was [10][10] */;
00046     integer isgn;
00047     doublecomplex atmp[100]     /* was [10][10] */, btmp[100]   /* was [10][
00048             10] */, ctmp[100]   /* was [10][10] */;
00049     doublereal tnrm;
00050     doublecomplex rmul;
00051     doublereal xnrm;
00052     integer imlad;
00053     doublereal scale;
00054     char trana[1], tranb[1];
00055     extern /* Subroutine */ int zgemm_(char *, char *, integer *, integer *, 
00056             integer *, doublecomplex *, doublecomplex *, integer *, 
00057             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00058             integer *), dlabad_(doublereal *, doublereal *);
00059     extern doublereal dlamch_(char *);
00060     integer itrana, itranb;
00061     extern doublereal zlange_(char *, integer *, integer *, doublecomplex *, 
00062             integer *, doublereal *);
00063     doublereal bignum, smlnum;
00064     extern /* Subroutine */ int ztrsyl_(char *, char *, integer *, integer *, 
00065             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00066              doublecomplex *, integer *, doublereal *, integer *);
00067 
00068     /* Fortran I/O blocks */
00069     static cilist io___6 = { 0, 0, 0, 0, 0 };
00070     static cilist io___10 = { 0, 0, 0, 0, 0 };
00071     static cilist io___13 = { 0, 0, 0, 0, 0 };
00072     static cilist io___15 = { 0, 0, 0, 0, 0 };
00073 
00074 
00075 
00076 /*  -- LAPACK test routine (version 3.1) -- */
00077 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00078 /*     November 2006 */
00079 
00080 /*     .. Scalar Arguments .. */
00081 /*     .. */
00082 
00083 /*  Purpose */
00084 /*  ======= */
00085 
00086 /*  ZGET35 tests ZTRSYL, a routine for solving the Sylvester matrix */
00087 /*  equation */
00088 
00089 /*     op(A)*X + ISGN*X*op(B) = scale*C, */
00090 
00091 /*  A and B are assumed to be in Schur canonical form, op() represents an */
00092 /*  optional transpose, and ISGN can be -1 or +1.  Scale is an output */
00093 /*  less than or equal to 1, chosen to avoid overflow in X. */
00094 
00095 /*  The test code verifies that the following residual is order 1: */
00096 
00097 /*     norm(op(A)*X + ISGN*X*op(B) - scale*C) / */
00098 /*         (EPS*max(norm(A),norm(B))*norm(X)) */
00099 
00100 /*  Arguments */
00101 /*  ========== */
00102 
00103 /*  RMAX    (output) DOUBLE PRECISION */
00104 /*          Value of the largest test ratio. */
00105 
00106 /*  LMAX    (output) INTEGER */
00107 /*          Example number where largest test ratio achieved. */
00108 
00109 /*  NINFO   (output) INTEGER */
00110 /*          Number of examples where INFO is nonzero. */
00111 
00112 /*  KNT     (output) INTEGER */
00113 /*          Total number of examples tested. */
00114 
00115 /*  NIN     (input) INTEGER */
00116 /*          Input logical unit number. */
00117 
00118 /*  ===================================================================== */
00119 
00120 /*     .. Parameters .. */
00121 /*     .. */
00122 /*     .. Local Scalars .. */
00123 /*     .. */
00124 /*     .. Local Arrays .. */
00125 /*     .. */
00126 /*     .. External Functions .. */
00127 /*     .. */
00128 /*     .. External Subroutines .. */
00129 /*     .. */
00130 /*     .. Intrinsic Functions .. */
00131 /*     .. */
00132 /*     .. Executable Statements .. */
00133 
00134 /*     Get machine parameters */
00135 
00136     eps = dlamch_("P");
00137     smlnum = dlamch_("S") / eps;
00138     bignum = 1. / smlnum;
00139     dlabad_(&smlnum, &bignum);
00140 
00141 /*     Set up test case parameters */
00142 
00143     vm1[0] = sqrt(smlnum);
00144     vm1[1] = 1.;
00145     vm1[2] = 1e6;
00146     vm2[0] = 1.;
00147     vm2[1] = eps * 2. + 1.;
00148     vm2[2] = 2.;
00149 
00150     *knt = 0;
00151     *ninfo = 0;
00152     *lmax = 0;
00153     *rmax = 0.;
00154 
00155 /*     Begin test loop */
00156 
00157 L10:
00158     io___6.ciunit = *nin;
00159     s_rsle(&io___6);
00160     do_lio(&c__3, &c__1, (char *)&m, (ftnlen)sizeof(integer));
00161     do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
00162     e_rsle();
00163     if (n == 0) {
00164         return 0;
00165     }
00166     i__1 = m;
00167     for (i__ = 1; i__ <= i__1; ++i__) {
00168         io___10.ciunit = *nin;
00169         s_rsle(&io___10);
00170         i__2 = m;
00171         for (j = 1; j <= i__2; ++j) {
00172             do_lio(&c__7, &c__1, (char *)&atmp[i__ + j * 10 - 11], (ftnlen)
00173                     sizeof(doublecomplex));
00174         }
00175         e_rsle();
00176 /* L20: */
00177     }
00178     i__1 = n;
00179     for (i__ = 1; i__ <= i__1; ++i__) {
00180         io___13.ciunit = *nin;
00181         s_rsle(&io___13);
00182         i__2 = n;
00183         for (j = 1; j <= i__2; ++j) {
00184             do_lio(&c__7, &c__1, (char *)&btmp[i__ + j * 10 - 11], (ftnlen)
00185                     sizeof(doublecomplex));
00186         }
00187         e_rsle();
00188 /* L30: */
00189     }
00190     i__1 = m;
00191     for (i__ = 1; i__ <= i__1; ++i__) {
00192         io___15.ciunit = *nin;
00193         s_rsle(&io___15);
00194         i__2 = n;
00195         for (j = 1; j <= i__2; ++j) {
00196             do_lio(&c__7, &c__1, (char *)&ctmp[i__ + j * 10 - 11], (ftnlen)
00197                     sizeof(doublecomplex));
00198         }
00199         e_rsle();
00200 /* L40: */
00201     }
00202     for (imla = 1; imla <= 3; ++imla) {
00203         for (imlad = 1; imlad <= 3; ++imlad) {
00204             for (imlb = 1; imlb <= 3; ++imlb) {
00205                 for (imlc = 1; imlc <= 3; ++imlc) {
00206                     for (itrana = 1; itrana <= 2; ++itrana) {
00207                         for (itranb = 1; itranb <= 2; ++itranb) {
00208                             for (isgn = -1; isgn <= 1; isgn += 2) {
00209                                 if (itrana == 1) {
00210                                     *(unsigned char *)trana = 'N';
00211                                 }
00212                                 if (itrana == 2) {
00213                                     *(unsigned char *)trana = 'C';
00214                                 }
00215                                 if (itranb == 1) {
00216                                     *(unsigned char *)tranb = 'N';
00217                                 }
00218                                 if (itranb == 2) {
00219                                     *(unsigned char *)tranb = 'C';
00220                                 }
00221                                 tnrm = 0.;
00222                                 i__1 = m;
00223                                 for (i__ = 1; i__ <= i__1; ++i__) {
00224                                     i__2 = m;
00225                                     for (j = 1; j <= i__2; ++j) {
00226                                         i__3 = i__ + j * 10 - 11;
00227                                         i__4 = i__ + j * 10 - 11;
00228                                         i__5 = imla - 1;
00229                                         z__1.r = vm1[i__5] * atmp[i__4].r, 
00230                                                 z__1.i = vm1[i__5] * atmp[
00231                                                 i__4].i;
00232                                         a[i__3].r = z__1.r, a[i__3].i = 
00233                                                 z__1.i;
00234 /* Computing MAX */
00235                                         d__1 = tnrm, d__2 = z_abs(&a[i__ + j *
00236                                                  10 - 11]);
00237                                         tnrm = max(d__1,d__2);
00238 /* L50: */
00239                                     }
00240                                     i__2 = i__ + i__ * 10 - 11;
00241                                     i__3 = i__ + i__ * 10 - 11;
00242                                     i__4 = imlad - 1;
00243                                     z__1.r = vm2[i__4] * a[i__3].r, z__1.i = 
00244                                             vm2[i__4] * a[i__3].i;
00245                                     a[i__2].r = z__1.r, a[i__2].i = z__1.i;
00246 /* Computing MAX */
00247                                     d__1 = tnrm, d__2 = z_abs(&a[i__ + i__ * 
00248                                             10 - 11]);
00249                                     tnrm = max(d__1,d__2);
00250 /* L60: */
00251                                 }
00252                                 i__1 = n;
00253                                 for (i__ = 1; i__ <= i__1; ++i__) {
00254                                     i__2 = n;
00255                                     for (j = 1; j <= i__2; ++j) {
00256                                         i__3 = i__ + j * 10 - 11;
00257                                         i__4 = i__ + j * 10 - 11;
00258                                         i__5 = imlb - 1;
00259                                         z__1.r = vm1[i__5] * btmp[i__4].r, 
00260                                                 z__1.i = vm1[i__5] * btmp[
00261                                                 i__4].i;
00262                                         b[i__3].r = z__1.r, b[i__3].i = 
00263                                                 z__1.i;
00264 /* Computing MAX */
00265                                         d__1 = tnrm, d__2 = z_abs(&b[i__ + j *
00266                                                  10 - 11]);
00267                                         tnrm = max(d__1,d__2);
00268 /* L70: */
00269                                     }
00270 /* L80: */
00271                                 }
00272                                 if (tnrm == 0.) {
00273                                     tnrm = 1.;
00274                                 }
00275                                 i__1 = m;
00276                                 for (i__ = 1; i__ <= i__1; ++i__) {
00277                                     i__2 = n;
00278                                     for (j = 1; j <= i__2; ++j) {
00279                                         i__3 = i__ + j * 10 - 11;
00280                                         i__4 = i__ + j * 10 - 11;
00281                                         i__5 = imlc - 1;
00282                                         z__1.r = vm1[i__5] * ctmp[i__4].r, 
00283                                                 z__1.i = vm1[i__5] * ctmp[
00284                                                 i__4].i;
00285                                         c__[i__3].r = z__1.r, c__[i__3].i = 
00286                                                 z__1.i;
00287                                         i__3 = i__ + j * 10 - 11;
00288                                         i__4 = i__ + j * 10 - 11;
00289                                         csav[i__3].r = c__[i__4].r, csav[i__3]
00290                                                 .i = c__[i__4].i;
00291 /* L90: */
00292                                     }
00293 /* L100: */
00294                                 }
00295                                 ++(*knt);
00296                                 ztrsyl_(trana, tranb, &isgn, &m, &n, a, &
00297                                         c__10, b, &c__10, c__, &c__10, &scale, 
00298                                          &info);
00299                                 if (info != 0) {
00300                                     ++(*ninfo);
00301                                 }
00302                                 xnrm = zlange_("M", &m, &n, c__, &c__10, dum);
00303                                 rmul.r = 1., rmul.i = 0.;
00304                                 if (xnrm > 1. && tnrm > 1.) {
00305                                     if (xnrm > bignum / tnrm) {
00306                                         d__1 = max(xnrm,tnrm);
00307                                         rmul.r = d__1, rmul.i = 0.;
00308                                         z_div(&z__1, &c_b43, &rmul);
00309                                         rmul.r = z__1.r, rmul.i = z__1.i;
00310                                     }
00311                                 }
00312                                 d__1 = -scale;
00313                                 z__1.r = d__1 * rmul.r, z__1.i = d__1 * 
00314                                         rmul.i;
00315                                 zgemm_(trana, "N", &m, &n, &m, &rmul, a, &
00316                                         c__10, c__, &c__10, &z__1, csav, &
00317                                         c__10);
00318                                 d__1 = (doublereal) isgn;
00319                                 z__1.r = d__1 * rmul.r, z__1.i = d__1 * 
00320                                         rmul.i;
00321                                 zgemm_("N", tranb, &m, &n, &n, &z__1, c__, &
00322                                         c__10, b, &c__10, &c_b43, csav, &
00323                                         c__10);
00324                                 res1 = zlange_("M", &m, &n, csav, &c__10, dum);
00325 /* Computing MAX */
00326                                 d__1 = smlnum, d__2 = smlnum * xnrm, d__1 = 
00327                                         max(d__1,d__2), d__2 = z_abs(&rmul) * 
00328                                         tnrm * eps * xnrm;
00329                                 res = res1 / max(d__1,d__2);
00330                                 if (res > *rmax) {
00331                                     *lmax = *knt;
00332                                     *rmax = res;
00333                                 }
00334 /* L110: */
00335                             }
00336 /* L120: */
00337                         }
00338 /* L130: */
00339                     }
00340 /* L140: */
00341                 }
00342 /* L150: */
00343             }
00344 /* L160: */
00345         }
00346 /* L170: */
00347     }
00348     goto L10;
00349 
00350 /*     End of ZGET35 */
00351 
00352 } /* zget35_ */


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