sget10.c
Go to the documentation of this file.
00001 /* sget10.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 static real c_b7 = -1.f;
00020 
00021 /* Subroutine */ int sget10_(integer *m, integer *n, real *a, integer *lda, 
00022         real *b, integer *ldb, real *work, real *result)
00023 {
00024     /* System generated locals */
00025     integer a_dim1, a_offset, b_dim1, b_offset, i__1;
00026     real r__1, r__2;
00027 
00028     /* Local variables */
00029     integer j;
00030     real eps, unfl, anorm;
00031     extern doublereal sasum_(integer *, real *, integer *);
00032     extern /* Subroutine */ int scopy_(integer *, real *, integer *, real *, 
00033             integer *);
00034     real wnorm;
00035     extern /* Subroutine */ int saxpy_(integer *, real *, real *, integer *, 
00036             real *, integer *);
00037     extern doublereal slamch_(char *), slange_(char *, integer *, 
00038             integer *, real *, integer *, real *);
00039 
00040 
00041 /*  -- LAPACK test routine (version 3.1) -- */
00042 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00043 /*     November 2006 */
00044 
00045 /*     .. Scalar Arguments .. */
00046 /*     .. */
00047 /*     .. Array Arguments .. */
00048 /*     .. */
00049 
00050 /*  Purpose */
00051 /*  ======= */
00052 
00053 /*  SGET10 compares two matrices A and B and computes the ratio */
00054 /*  RESULT = norm( A - B ) / ( norm(A) * M * EPS ) */
00055 
00056 /*  Arguments */
00057 /*  ========= */
00058 
00059 /*  M       (input) INTEGER */
00060 /*          The number of rows of the matrices A and B. */
00061 
00062 /*  N       (input) INTEGER */
00063 /*          The number of columns of the matrices A and B. */
00064 
00065 /*  A       (input) REAL array, dimension (LDA,N) */
00066 /*          The m by n matrix A. */
00067 
00068 /*  LDA     (input) INTEGER */
00069 /*          The leading dimension of the array A.  LDA >= max(1,M). */
00070 
00071 /*  B       (input) REAL array, dimension (LDB,N) */
00072 /*          The m by n matrix B. */
00073 
00074 /*  LDB     (input) INTEGER */
00075 /*          The leading dimension of the array B.  LDB >= max(1,M). */
00076 
00077 /*  WORK    (workspace) REAL array, dimension (M) */
00078 
00079 /*  RESULT  (output) REAL */
00080 /*          RESULT = norm( A - B ) / ( norm(A) * M * EPS ) */
00081 
00082 /*  ===================================================================== */
00083 
00084 /*     .. Parameters .. */
00085 /*     .. */
00086 /*     .. Local Scalars .. */
00087 /*     .. */
00088 /*     .. External Functions .. */
00089 /*     .. */
00090 /*     .. External Subroutines .. */
00091 /*     .. */
00092 /*     .. Intrinsic Functions .. */
00093 /*     .. */
00094 /*     .. Executable Statements .. */
00095 
00096 /*     Quick return if possible */
00097 
00098     /* Parameter adjustments */
00099     a_dim1 = *lda;
00100     a_offset = 1 + a_dim1;
00101     a -= a_offset;
00102     b_dim1 = *ldb;
00103     b_offset = 1 + b_dim1;
00104     b -= b_offset;
00105     --work;
00106 
00107     /* Function Body */
00108     if (*m <= 0 || *n <= 0) {
00109         *result = 0.f;
00110         return 0;
00111     }
00112 
00113     unfl = slamch_("Safe minimum");
00114     eps = slamch_("Precision");
00115 
00116     wnorm = 0.f;
00117     i__1 = *n;
00118     for (j = 1; j <= i__1; ++j) {
00119         scopy_(m, &a[j * a_dim1 + 1], &c__1, &work[1], &c__1);
00120         saxpy_(m, &c_b7, &b[j * b_dim1 + 1], &c__1, &work[1], &c__1);
00121 /* Computing MAX */
00122         r__1 = wnorm, r__2 = sasum_(n, &work[1], &c__1);
00123         wnorm = dmax(r__1,r__2);
00124 /* L10: */
00125     }
00126 
00127 /* Computing MAX */
00128     r__1 = slange_("1", m, n, &a[a_offset], lda, &work[1]);
00129     anorm = dmax(r__1,unfl);
00130 
00131     if (anorm > wnorm) {
00132         *result = wnorm / anorm / (*m * eps);
00133     } else {
00134         if (anorm < 1.f) {
00135 /* Computing MIN */
00136             r__1 = wnorm, r__2 = *m * anorm;
00137             *result = dmin(r__1,r__2) / anorm / (*m * eps);
00138         } else {
00139 /* Computing MIN */
00140             r__1 = wnorm / anorm, r__2 = (real) (*m);
00141             *result = dmin(r__1,r__2) / (*m * eps);
00142         }
00143     }
00144 
00145     return 0;
00146 
00147 /*     End of SGET10 */
00148 
00149 } /* sget10_ */


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