clsets.c
Go to the documentation of this file.
00001 /* clsets.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__1 = 1;
00019 
00020 /* Subroutine */ int clsets_(integer *m, integer *p, integer *n, complex *a, 
00021         complex *af, integer *lda, complex *b, complex *bf, integer *ldb, 
00022         complex *c__, complex *cf, complex *d__, complex *df, complex *x, 
00023         complex *work, integer *lwork, real *rwork, real *result)
00024 {
00025     /* System generated locals */
00026     integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, bf_dim1, 
00027             bf_offset;
00028 
00029     /* Local variables */
00030     integer info;
00031     extern /* Subroutine */ int cget02_(char *, integer *, integer *, integer 
00032             *, complex *, integer *, complex *, integer *, complex *, integer 
00033             *, real *, real *), ccopy_(integer *, complex *, integer *
00034 , complex *, integer *), cgglse_(integer *, integer *, integer *, 
00035             complex *, integer *, complex *, integer *, complex *, complex *, 
00036             complex *, complex *, integer *, integer *), clacpy_(char *, 
00037             integer *, integer *, complex *, integer *, complex *, integer *);
00038 
00039 
00040 /*  -- LAPACK test routine (version 3.1) -- */
00041 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00042 /*     November 2006 */
00043 
00044 /*     .. Scalar Arguments .. */
00045 /*     .. */
00046 /*     .. Array Arguments .. */
00047 
00048 /*  Purpose */
00049 /*  ======= */
00050 
00051 /*  CLSETS tests CGGLSE - a subroutine for solving linear equality */
00052 /*  constrained least square problem (LSE). */
00053 
00054 /*  Arguments */
00055 /*  ========= */
00056 
00057 /*  M       (input) INTEGER */
00058 /*          The number of rows of the matrix A.  M >= 0. */
00059 
00060 /*  P       (input) INTEGER */
00061 /*          The number of rows of the matrix B.  P >= 0. */
00062 
00063 /*  N       (input) INTEGER */
00064 /*          The number of columns of the matrices A and B.  N >= 0. */
00065 
00066 /*  A       (input) COMPLEX array, dimension (LDA,N) */
00067 /*          The M-by-N matrix A. */
00068 
00069 /*  AF      (workspace) COMPLEX array, dimension (LDA,N) */
00070 
00071 /*  LDA     (input) INTEGER */
00072 /*          The leading dimension of the arrays A, AF, Q and R. */
00073 /*          LDA >= max(M,N). */
00074 
00075 /*  B       (input) COMPLEX array, dimension (LDB,N) */
00076 /*          The P-by-N matrix A. */
00077 
00078 /*  BF      (workspace) COMPLEX array, dimension (LDB,N) */
00079 
00080 /*  LDB     (input) INTEGER */
00081 /*          The leading dimension of the arrays B, BF, V and S. */
00082 /*          LDB >= max(P,N). */
00083 
00084 /*  C       (input) COMPLEX array, dimension( M ) */
00085 /*          the vector C in the LSE problem. */
00086 
00087 /*  CF      (workspace) COMPLEX array, dimension( M ) */
00088 
00089 /*  D       (input) COMPLEX array, dimension( P ) */
00090 /*          the vector D in the LSE problem. */
00091 
00092 /*  DF      (workspace) COMPLEX array, dimension( P ) */
00093 
00094 /*  X       (output) COMPLEX array, dimension( N ) */
00095 /*          solution vector X in the LSE problem. */
00096 
00097 /*  WORK    (workspace) COMPLEX array, dimension (LWORK) */
00098 
00099 /*  LWORK   (input) INTEGER */
00100 /*          The dimension of the array WORK. */
00101 
00102 /*  RWORK   (workspace) REAL array, dimension (M) */
00103 
00104 /*  RESULT  (output) REAL array, dimension (2) */
00105 /*          The test ratios: */
00106 /*            RESULT(1) = norm( A*x - c )/ norm(A)*norm(X)*EPS */
00107 /*            RESULT(2) = norm( B*x - d )/ norm(B)*norm(X)*EPS */
00108 
00109 /*  ==================================================================== */
00110 
00111 /*     .. */
00112 /*     .. Local Scalars .. */
00113 /*     .. */
00114 /*     .. External Subroutines .. */
00115 /*     .. */
00116 /*     .. Executable Statements .. */
00117 
00118 /*     Copy the matrices A and B to the arrays AF and BF, */
00119 /*     and the vectors C and D to the arrays CF and DF, */
00120 
00121     /* Parameter adjustments */
00122     af_dim1 = *lda;
00123     af_offset = 1 + af_dim1;
00124     af -= af_offset;
00125     a_dim1 = *lda;
00126     a_offset = 1 + a_dim1;
00127     a -= a_offset;
00128     bf_dim1 = *ldb;
00129     bf_offset = 1 + bf_dim1;
00130     bf -= bf_offset;
00131     b_dim1 = *ldb;
00132     b_offset = 1 + b_dim1;
00133     b -= b_offset;
00134     --c__;
00135     --cf;
00136     --d__;
00137     --df;
00138     --x;
00139     --work;
00140     --rwork;
00141     --result;
00142 
00143     /* Function Body */
00144     clacpy_("Full", m, n, &a[a_offset], lda, &af[af_offset], lda);
00145     clacpy_("Full", p, n, &b[b_offset], ldb, &bf[bf_offset], ldb);
00146     ccopy_(m, &c__[1], &c__1, &cf[1], &c__1);
00147     ccopy_(p, &d__[1], &c__1, &df[1], &c__1);
00148 
00149 /*     Solve LSE problem */
00150 
00151     cgglse_(m, n, p, &af[af_offset], lda, &bf[bf_offset], ldb, &cf[1], &df[1], 
00152              &x[1], &work[1], lwork, &info);
00153 
00154 /*     Test the residual for the solution of LSE */
00155 
00156 /*     Compute RESULT(1) = norm( A*x - c ) / norm(A)*norm(X)*EPS */
00157 
00158     ccopy_(m, &c__[1], &c__1, &cf[1], &c__1);
00159     ccopy_(p, &d__[1], &c__1, &df[1], &c__1);
00160     cget02_("No transpose", m, n, &c__1, &a[a_offset], lda, &x[1], n, &cf[1], 
00161             m, &rwork[1], &result[1]);
00162 
00163 /*     Compute result(2) = norm( B*x - d ) / norm(B)*norm(X)*EPS */
00164 
00165     cget02_("No transpose", p, n, &c__1, &b[b_offset], ldb, &x[1], n, &df[1], 
00166             p, &rwork[1], &result[2]);
00167 
00168     return 0;
00169 
00170 /*     End of CLSETS */
00171 
00172 } /* clsets_ */


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