dget54.c
Go to the documentation of this file.
00001 /* dget54.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 doublereal c_b11 = 1.;
00019 static doublereal c_b12 = 0.;
00020 static doublereal c_b15 = -1.;
00021 
00022 /* Subroutine */ int dget54_(integer *n, doublereal *a, integer *lda, 
00023         doublereal *b, integer *ldb, doublereal *s, integer *lds, doublereal *
00024         t, integer *ldt, doublereal *u, integer *ldu, doublereal *v, integer *
00025         ldv, doublereal *work, doublereal *result)
00026 {
00027     /* System generated locals */
00028     integer a_dim1, a_offset, b_dim1, b_offset, s_dim1, s_offset, t_dim1, 
00029             t_offset, u_dim1, u_offset, v_dim1, v_offset, i__1;
00030     doublereal d__1, d__2;
00031 
00032     /* Local variables */
00033     doublereal dum[1], ulp, unfl;
00034     extern /* Subroutine */ int dgemm_(char *, char *, integer *, integer *, 
00035             integer *, doublereal *, doublereal *, integer *, doublereal *, 
00036             integer *, doublereal *, doublereal *, integer *);
00037     doublereal wnorm;
00038     extern doublereal dlamch_(char *), dlange_(char *, integer *, 
00039             integer *, doublereal *, integer *, doublereal *);
00040     extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, 
00041             doublereal *, integer *, doublereal *, integer *);
00042     doublereal abnorm;
00043 
00044 
00045 /*  -- LAPACK test routine (version 3.1) -- */
00046 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00047 /*     November 2006 */
00048 
00049 /*     .. Scalar Arguments .. */
00050 /*     .. */
00051 /*     .. Array Arguments .. */
00052 /*     .. */
00053 
00054 /*  Purpose */
00055 /*  ======= */
00056 
00057 /*  DGET54 checks a generalized decomposition of the form */
00058 
00059 /*           A = U*S*V'  and B = U*T* V' */
00060 
00061 /*  where ' means transpose and U and V are orthogonal. */
00062 
00063 /*  Specifically, */
00064 
00065 /*   RESULT = ||( A - U*S*V', B - U*T*V' )|| / (||( A, B )||*n*ulp ) */
00066 
00067 /*  Arguments */
00068 /*  ========= */
00069 
00070 /*  N       (input) INTEGER */
00071 /*          The size of the matrix.  If it is zero, DGET54 does nothing. */
00072 /*          It must be at least zero. */
00073 
00074 /*  A       (input) DOUBLE PRECISION array, dimension (LDA, N) */
00075 /*          The original (unfactored) matrix A. */
00076 
00077 /*  LDA     (input) INTEGER */
00078 /*          The leading dimension of A.  It must be at least 1 */
00079 /*          and at least N. */
00080 
00081 /*  B       (input) DOUBLE PRECISION array, dimension (LDB, N) */
00082 /*          The original (unfactored) matrix B. */
00083 
00084 /*  LDB     (input) INTEGER */
00085 /*          The leading dimension of B.  It must be at least 1 */
00086 /*          and at least N. */
00087 
00088 /*  S       (input) DOUBLE PRECISION array, dimension (LDS, N) */
00089 /*          The factored matrix S. */
00090 
00091 /*  LDS     (input) INTEGER */
00092 /*          The leading dimension of S.  It must be at least 1 */
00093 /*          and at least N. */
00094 
00095 /*  T       (input) DOUBLE PRECISION array, dimension (LDT, N) */
00096 /*          The factored matrix T. */
00097 
00098 /*  LDT     (input) INTEGER */
00099 /*          The leading dimension of T.  It must be at least 1 */
00100 /*          and at least N. */
00101 
00102 /*  U       (input) DOUBLE PRECISION array, dimension (LDU, N) */
00103 /*          The orthogonal matrix on the left-hand side in the */
00104 /*          decomposition. */
00105 
00106 /*  LDU     (input) INTEGER */
00107 /*          The leading dimension of U.  LDU must be at least N and */
00108 /*          at least 1. */
00109 
00110 /*  V       (input) DOUBLE PRECISION array, dimension (LDV, N) */
00111 /*          The orthogonal matrix on the left-hand side in the */
00112 /*          decomposition. */
00113 
00114 /*  LDV     (input) INTEGER */
00115 /*          The leading dimension of V.  LDV must be at least N and */
00116 /*          at least 1. */
00117 
00118 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (3*N**2) */
00119 
00120 /*  RESULT  (output) DOUBLE PRECISION */
00121 /*          The value RESULT, It is currently limited to 1/ulp, to */
00122 /*          avoid overflow. Errors are flagged by RESULT=10/ulp. */
00123 
00124 /*  ===================================================================== */
00125 
00126 /*     .. Parameters .. */
00127 /*     .. */
00128 /*     .. Local Scalars .. */
00129 /*     .. */
00130 /*     .. Local Arrays .. */
00131 /*     .. */
00132 /*     .. External Functions .. */
00133 /*     .. */
00134 /*     .. External Subroutines .. */
00135 /*     .. */
00136 /*     .. Intrinsic Functions .. */
00137 /*     .. */
00138 /*     .. Executable Statements .. */
00139 
00140     /* Parameter adjustments */
00141     a_dim1 = *lda;
00142     a_offset = 1 + a_dim1;
00143     a -= a_offset;
00144     b_dim1 = *ldb;
00145     b_offset = 1 + b_dim1;
00146     b -= b_offset;
00147     s_dim1 = *lds;
00148     s_offset = 1 + s_dim1;
00149     s -= s_offset;
00150     t_dim1 = *ldt;
00151     t_offset = 1 + t_dim1;
00152     t -= t_offset;
00153     u_dim1 = *ldu;
00154     u_offset = 1 + u_dim1;
00155     u -= u_offset;
00156     v_dim1 = *ldv;
00157     v_offset = 1 + v_dim1;
00158     v -= v_offset;
00159     --work;
00160 
00161     /* Function Body */
00162     *result = 0.;
00163     if (*n <= 0) {
00164         return 0;
00165     }
00166 
00167 /*     Constants */
00168 
00169     unfl = dlamch_("Safe minimum");
00170     ulp = dlamch_("Epsilon") * dlamch_("Base");
00171 
00172 /*     compute the norm of (A,B) */
00173 
00174     dlacpy_("Full", n, n, &a[a_offset], lda, &work[1], n);
00175     dlacpy_("Full", n, n, &b[b_offset], ldb, &work[*n * *n + 1], n)
00176             ;
00177 /* Computing MAX */
00178     i__1 = *n << 1;
00179     d__1 = dlange_("1", n, &i__1, &work[1], n, dum);
00180     abnorm = max(d__1,unfl);
00181 
00182 /*     Compute W1 = A - U*S*V', and put in the array WORK(1:N*N) */
00183 
00184     dlacpy_(" ", n, n, &a[a_offset], lda, &work[1], n);
00185     dgemm_("N", "N", n, n, n, &c_b11, &u[u_offset], ldu, &s[s_offset], lds, &
00186             c_b12, &work[*n * *n + 1], n);
00187 
00188     dgemm_("N", "C", n, n, n, &c_b15, &work[*n * *n + 1], n, &v[v_offset], 
00189             ldv, &c_b11, &work[1], n);
00190 
00191 /*     Compute W2 = B - U*T*V', and put in the workarray W(N*N+1:2*N*N) */
00192 
00193     dlacpy_(" ", n, n, &b[b_offset], ldb, &work[*n * *n + 1], n);
00194     dgemm_("N", "N", n, n, n, &c_b11, &u[u_offset], ldu, &t[t_offset], ldt, &
00195             c_b12, &work[(*n << 1) * *n + 1], n);
00196 
00197     dgemm_("N", "C", n, n, n, &c_b15, &work[(*n << 1) * *n + 1], n, &v[
00198             v_offset], ldv, &c_b11, &work[*n * *n + 1], n);
00199 
00200 /*     Compute norm(W)/ ( ulp*norm((A,B)) ) */
00201 
00202     i__1 = *n << 1;
00203     wnorm = dlange_("1", n, &i__1, &work[1], n, dum);
00204 
00205     if (abnorm > wnorm) {
00206         *result = wnorm / abnorm / ((*n << 1) * ulp);
00207     } else {
00208         if (abnorm < 1.) {
00209 /* Computing MIN */
00210             d__1 = wnorm, d__2 = (*n << 1) * abnorm;
00211             *result = min(d__1,d__2) / abnorm / ((*n << 1) * ulp);
00212         } else {
00213 /* Computing MIN */
00214             d__1 = wnorm / abnorm, d__2 = (doublereal) (*n << 1);
00215             *result = min(d__1,d__2) / ((*n << 1) * ulp);
00216         }
00217     }
00218 
00219     return 0;
00220 
00221 /*     End of DGET54 */
00222 
00223 } /* dget54_ */


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