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


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