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


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