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


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