zcklse.c
Go to the documentation of this file.
00001 /* zcklse.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__8 = 8;
00019 static integer c__1 = 1;
00020 static integer c__0 = 0;
00021 
00022 /* Subroutine */ int zcklse_(integer *nn, integer *mval, integer *pval, 
00023         integer *nval, integer *nmats, integer *iseed, doublereal *thresh, 
00024         integer *nmax, doublecomplex *a, doublecomplex *af, doublecomplex *b, 
00025         doublecomplex *bf, doublecomplex *x, doublecomplex *work, doublereal *
00026         rwork, integer *nin, integer *nout, integer *info)
00027 {
00028     /* Format strings */
00029     static char fmt_9997[] = "(\002 *** Invalid input  for LSE:  M = \002,"
00030             "i6,\002, P = \002,i6,\002, N = \002,i6,\002;\002,/\002     must "
00031             "satisfy P <= N <= P+M  \002,\002(this set of values will be skip"
00032             "ped)\002)";
00033     static char fmt_9999[] = "(\002 ZLATMS in ZCKLSE   INFO = \002,i5)";
00034     static char fmt_9998[] = "(\002 M=\002,i4,\002 P=\002,i4,\002, N=\002,"
00035             "i4,\002, type \002,i2,\002, test \002,i2,\002, ratio=\002,g13.6)";
00036 
00037     /* System generated locals */
00038     integer i__1, i__2, i__3, i__4, i__5, i__6, i__7;
00039 
00040     /* Builtin functions */
00041     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00042     integer s_wsle(cilist *), e_wsle(void), s_wsfe(cilist *), do_fio(integer *
00043             , char *, ftnlen), e_wsfe(void);
00044 
00045     /* Local variables */
00046     integer i__, m, n, p, ik, nt, lda, ldb, kla, klb, kua, kub, imat;
00047     char path[3], type__[1];
00048     integer nrun, modea, modeb, nfail;
00049     char dista[1], distb[1];
00050     integer iinfo;
00051     doublereal anorm, bnorm;
00052     integer lwork;
00053     extern /* Subroutine */ int dlatb9_(char *, integer *, integer *, integer 
00054             *, integer *, char *, integer *, integer *, integer *, integer *, 
00055             doublereal *, doublereal *, integer *, integer *, doublereal *, 
00056             doublereal *, char *, char *), 
00057             alahdg_(integer *, char *);
00058     doublereal cndnma, cndnmb;
00059     extern /* Subroutine */ int alareq_(char *, integer *, logical *, integer 
00060             *, integer *, integer *), alasum_(char *, integer *, 
00061             integer *, integer *, integer *), zlarhs_(char *, char *, 
00062             char *, char *, integer *, integer *, integer *, integer *, 
00063             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00064              doublecomplex *, integer *, integer *, integer *);
00065     logical dotype[8];
00066     extern /* Subroutine */ int zlatms_(integer *, integer *, char *, integer 
00067             *, char *, doublereal *, integer *, doublereal *, doublereal *, 
00068             integer *, integer *, char *, doublecomplex *, integer *, 
00069             doublecomplex *, integer *);
00070     logical firstt;
00071     doublereal result[7];
00072     extern /* Subroutine */ int zlsets_(integer *, integer *, integer *, 
00073             doublecomplex *, doublecomplex *, integer *, doublecomplex *, 
00074             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00075             doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *
00076 , integer *, doublereal *, doublereal *);
00077 
00078     /* Fortran I/O blocks */
00079     static cilist io___13 = { 0, 0, 0, 0, 0 };
00080     static cilist io___14 = { 0, 0, 0, fmt_9997, 0 };
00081     static cilist io___30 = { 0, 0, 0, fmt_9999, 0 };
00082     static cilist io___31 = { 0, 0, 0, fmt_9999, 0 };
00083     static cilist io___35 = { 0, 0, 0, fmt_9998, 0 };
00084 
00085 
00086 
00087 /*  -- LAPACK test routine (version 3.1) -- */
00088 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00089 /*     November 2006 */
00090 
00091 /*     .. Scalar Arguments .. */
00092 /*     .. */
00093 /*     .. Array Arguments .. */
00094 /*     .. */
00095 
00096 /*  Purpose */
00097 /*  ======= */
00098 
00099 /*  ZCKLSE tests ZGGLSE - a subroutine for solving linear equality */
00100 /*  constrained least square problem (LSE). */
00101 
00102 /*  Arguments */
00103 /*  ========= */
00104 
00105 /*  NN      (input) INTEGER */
00106 /*          The number of values of (M,P,N) contained in the vectors */
00107 /*          (MVAL, PVAL, NVAL). */
00108 
00109 /*  MVAL    (input) INTEGER array, dimension (NN) */
00110 /*          The values of the matrix row(column) dimension M. */
00111 
00112 /*  PVAL    (input) INTEGER array, dimension (NN) */
00113 /*          The values of the matrix row(column) dimension P. */
00114 
00115 /*  NVAL    (input) INTEGER array, dimension (NN) */
00116 /*          The values of the matrix column(row) dimension N. */
00117 
00118 /*  NMATS   (input) INTEGER */
00119 /*          The number of matrix types to be tested for each combination */
00120 /*          of matrix dimensions.  If NMATS >= NTYPES (the maximum */
00121 /*          number of matrix types), then all the different types are */
00122 /*          generated for testing.  If NMATS < NTYPES, another input line */
00123 /*          is read to get the numbers of the matrix types to be used. */
00124 
00125 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00126 /*          On entry, the seed of the random number generator.  The array */
00127 /*          elements should be between 0 and 4095, otherwise they will be */
00128 /*          reduced mod 4096, and ISEED(4) must be odd. */
00129 /*          On exit, the next seed in the random number sequence after */
00130 /*          all the test matrices have been generated. */
00131 
00132 /*  THRESH  (input) DOUBLE PRECISION */
00133 /*          The threshold value for the test ratios.  A result is */
00134 /*          included in the output file if RESULT >= THRESH.  To have */
00135 /*          every test ratio printed, use THRESH = 0. */
00136 
00137 /*  NMAX    (input) INTEGER */
00138 /*          The maximum value permitted for M or N, used in dimensioning */
00139 /*          the work arrays. */
00140 
00141 /*  A       (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00142 
00143 /*  AF      (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00144 
00145 /*  B       (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00146 
00147 /*  BF      (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00148 
00149 /*  X       (workspace) COMPLEX*16 array, dimension (5*NMAX) */
00150 
00151 /*  WORK    (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00152 
00153 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (NMAX) */
00154 
00155 /*  NIN     (input) INTEGER */
00156 /*          The unit number for input. */
00157 
00158 /*  NOUT    (input) INTEGER */
00159 /*          The unit number for output. */
00160 
00161 /*  INFO    (output) INTEGER */
00162 /*          = 0 :  successful exit */
00163 /*          > 0 :  If ZLATMS returns an error code, the absolute value */
00164 /*                 of it is returned. */
00165 
00166 /*  ===================================================================== */
00167 
00168 /*     .. Parameters .. */
00169 /*     .. */
00170 /*     .. Local Scalars .. */
00171 /*     .. */
00172 /*     .. Local Arrays .. */
00173 /*     .. */
00174 /*     .. External Subroutines .. */
00175 /*     .. */
00176 /*     .. Intrinsic Functions .. */
00177 /*     .. */
00178 /*     .. Executable Statements .. */
00179 
00180 /*     Initialize constants and the random number seed. */
00181 
00182     /* Parameter adjustments */
00183     --rwork;
00184     --work;
00185     --x;
00186     --bf;
00187     --b;
00188     --af;
00189     --a;
00190     --iseed;
00191     --nval;
00192     --pval;
00193     --mval;
00194 
00195     /* Function Body */
00196     s_copy(path, "LSE", (ftnlen)3, (ftnlen)3);
00197     *info = 0;
00198     nrun = 0;
00199     nfail = 0;
00200     firstt = TRUE_;
00201     alareq_(path, nmats, dotype, &c__8, nin, nout);
00202     lda = *nmax;
00203     ldb = *nmax;
00204     lwork = *nmax * *nmax;
00205 
00206 /*     Check for valid input values. */
00207 
00208     i__1 = *nn;
00209     for (ik = 1; ik <= i__1; ++ik) {
00210         m = mval[ik];
00211         p = pval[ik];
00212         n = nval[ik];
00213         if (p > n || n > m + p) {
00214             if (firstt) {
00215                 io___13.ciunit = *nout;
00216                 s_wsle(&io___13);
00217                 e_wsle();
00218                 firstt = FALSE_;
00219             }
00220             io___14.ciunit = *nout;
00221             s_wsfe(&io___14);
00222             do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00223             do_fio(&c__1, (char *)&p, (ftnlen)sizeof(integer));
00224             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00225             e_wsfe();
00226         }
00227 /* L10: */
00228     }
00229     firstt = TRUE_;
00230 
00231 /*     Do for each value of M in MVAL. */
00232 
00233     i__1 = *nn;
00234     for (ik = 1; ik <= i__1; ++ik) {
00235         m = mval[ik];
00236         p = pval[ik];
00237         n = nval[ik];
00238         if (p > n || n > m + p) {
00239             goto L40;
00240         }
00241 
00242         for (imat = 1; imat <= 8; ++imat) {
00243 
00244 /*           Do the tests only if DOTYPE( IMAT ) is true. */
00245 
00246             if (! dotype[imat - 1]) {
00247                 goto L30;
00248             }
00249 
00250 /*           Set up parameters with DLATB9 and generate test */
00251 /*           matrices A and B with ZLATMS. */
00252 
00253             dlatb9_(path, &imat, &m, &p, &n, type__, &kla, &kua, &klb, &kub, &
00254                     anorm, &bnorm, &modea, &modeb, &cndnma, &cndnmb, dista, 
00255                     distb);
00256 
00257             zlatms_(&m, &n, dista, &iseed[1], type__, &rwork[1], &modea, &
00258                     cndnma, &anorm, &kla, &kua, "No packing", &a[1], &lda, &
00259                     work[1], &iinfo);
00260             if (iinfo != 0) {
00261                 io___30.ciunit = *nout;
00262                 s_wsfe(&io___30);
00263                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00264                 e_wsfe();
00265                 *info = abs(iinfo);
00266                 goto L30;
00267             }
00268 
00269             zlatms_(&p, &n, distb, &iseed[1], type__, &rwork[1], &modeb, &
00270                     cndnmb, &bnorm, &klb, &kub, "No packing", &b[1], &ldb, &
00271                     work[1], &iinfo);
00272             if (iinfo != 0) {
00273                 io___31.ciunit = *nout;
00274                 s_wsfe(&io___31);
00275                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00276                 e_wsfe();
00277                 *info = abs(iinfo);
00278                 goto L30;
00279             }
00280 
00281 /*           Generate the right-hand sides C and D for the LSE. */
00282 
00283 /* Computing MAX */
00284             i__3 = m - 1;
00285             i__2 = max(i__3,0);
00286 /* Computing MAX */
00287             i__5 = n - 1;
00288             i__4 = max(i__5,0);
00289             i__6 = max(n,1);
00290             i__7 = max(m,1);
00291             zlarhs_("ZGE", "New solution", "Upper", "N", &m, &n, &i__2, &i__4, 
00292                      &c__1, &a[1], &lda, &x[(*nmax << 2) + 1], &i__6, &x[1], &
00293                     i__7, &iseed[1], &iinfo);
00294 
00295 /* Computing MAX */
00296             i__3 = p - 1;
00297             i__2 = max(i__3,0);
00298 /* Computing MAX */
00299             i__5 = n - 1;
00300             i__4 = max(i__5,0);
00301             i__6 = max(n,1);
00302             i__7 = max(p,1);
00303             zlarhs_("ZGE", "Computed", "Upper", "N", &p, &n, &i__2, &i__4, &
00304                     c__1, &b[1], &ldb, &x[(*nmax << 2) + 1], &i__6, &x[(*nmax 
00305                     << 1) + 1], &i__7, &iseed[1], &iinfo);
00306 
00307             nt = 2;
00308 
00309             zlsets_(&m, &p, &n, &a[1], &af[1], &lda, &b[1], &bf[1], &ldb, &x[
00310                     1], &x[*nmax + 1], &x[(*nmax << 1) + 1], &x[*nmax * 3 + 1]
00311 , &x[(*nmax << 2) + 1], &work[1], &lwork, &rwork[1], 
00312                     result);
00313 
00314 /*           Print information about the tests that did not */
00315 /*           pass the threshold. */
00316 
00317             i__2 = nt;
00318             for (i__ = 1; i__ <= i__2; ++i__) {
00319                 if (result[i__ - 1] >= *thresh) {
00320                     if (nfail == 0 && firstt) {
00321                         firstt = FALSE_;
00322                         alahdg_(nout, path);
00323                     }
00324                     io___35.ciunit = *nout;
00325                     s_wsfe(&io___35);
00326                     do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00327                     do_fio(&c__1, (char *)&p, (ftnlen)sizeof(integer));
00328                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00329                     do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00330                     do_fio(&c__1, (char *)&i__, (ftnlen)sizeof(integer));
00331                     do_fio(&c__1, (char *)&result[i__ - 1], (ftnlen)sizeof(
00332                             doublereal));
00333                     e_wsfe();
00334                     ++nfail;
00335                 }
00336 /* L20: */
00337             }
00338             nrun += nt;
00339 
00340 L30:
00341             ;
00342         }
00343 L40:
00344         ;
00345     }
00346 
00347 /*     Print a summary of the results. */
00348 
00349     alasum_(path, nout, &nfail, &nrun, &c__0);
00350 
00351     return 0;
00352 
00353 /*     End of ZCKLSE */
00354 
00355 } /* zcklse_ */


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