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


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