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


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