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