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


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