dsgt01.c
Go to the documentation of this file.
00001 /* dsgt01.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_b6 = 1.;
00019 static doublereal c_b7 = 0.;
00020 static integer c__1 = 1;
00021 static doublereal c_b12 = -1.;
00022 
00023 /* Subroutine */ int dsgt01_(integer *itype, char *uplo, integer *n, integer *
00024         m, doublereal *a, integer *lda, doublereal *b, integer *ldb, 
00025         doublereal *z__, integer *ldz, doublereal *d__, doublereal *work, 
00026         doublereal *result)
00027 {
00028     /* System generated locals */
00029     integer a_dim1, a_offset, b_dim1, b_offset, z_dim1, z_offset, i__1;
00030 
00031     /* Local variables */
00032     integer i__;
00033     doublereal ulp;
00034     extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, 
00035             integer *);
00036     doublereal anorm;
00037     extern /* Subroutine */ int dsymm_(char *, char *, integer *, integer *, 
00038             doublereal *, doublereal *, integer *, doublereal *, integer *, 
00039             doublereal *, doublereal *, integer *);
00040     extern doublereal dlamch_(char *), dlange_(char *, integer *, 
00041             integer *, doublereal *, integer *, doublereal *), 
00042             dlansy_(char *, char *, integer *, doublereal *, integer *, 
00043             doublereal *);
00044 
00045 
00046 /*  -- LAPACK test routine (version 3.1) -- */
00047 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00048 /*     November 2006 */
00049 
00050 /*     modified August 1997, a new parameter M is added to the calling */
00051 /*     sequence. */
00052 
00053 /*     .. Scalar Arguments .. */
00054 /*     .. */
00055 /*     .. Array Arguments .. */
00056 /*     .. */
00057 
00058 /*  Purpose */
00059 /*  ======= */
00060 
00061 /*  DDGT01 checks a decomposition of the form */
00062 
00063 /*     A Z   =  B Z D or */
00064 /*     A B Z =  Z D or */
00065 /*     B A Z =  Z D */
00066 
00067 /*  where A is a symmetric matrix, B is */
00068 /*  symmetric positive definite, Z is orthogonal, and D is diagonal. */
00069 
00070 /*  One of the following test ratios is computed: */
00071 
00072 /*  ITYPE = 1:  RESULT(1) = | A Z - B Z D | / ( |A| |Z| n ulp ) */
00073 
00074 /*  ITYPE = 2:  RESULT(1) = | A B Z - Z D | / ( |A| |Z| n ulp ) */
00075 
00076 /*  ITYPE = 3:  RESULT(1) = | B A Z - Z D | / ( |A| |Z| n ulp ) */
00077 
00078 /*  Arguments */
00079 /*  ========= */
00080 
00081 /*  ITYPE   (input) INTEGER */
00082 /*          The form of the symmetric generalized eigenproblem. */
00083 /*          = 1:  A*z = (lambda)*B*z */
00084 /*          = 2:  A*B*z = (lambda)*z */
00085 /*          = 3:  B*A*z = (lambda)*z */
00086 
00087 /*  UPLO    (input) CHARACTER*1 */
00088 /*          Specifies whether the upper or lower triangular part of the */
00089 /*          symmetric matrices A and B is stored. */
00090 /*          = 'U':  Upper triangular */
00091 /*          = 'L':  Lower triangular */
00092 
00093 /*  N       (input) INTEGER */
00094 /*          The order of the matrix A.  N >= 0. */
00095 
00096 /*  M       (input) INTEGER */
00097 /*          The number of eigenvalues found.  0 <= M <= N. */
00098 
00099 /*  A       (input) DOUBLE PRECISION array, dimension (LDA, N) */
00100 /*          The original symmetric matrix A. */
00101 
00102 /*  LDA     (input) INTEGER */
00103 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00104 
00105 /*  B       (input) DOUBLE PRECISION array, dimension (LDB, N) */
00106 /*          The original symmetric positive definite matrix B. */
00107 
00108 /*  LDB     (input) INTEGER */
00109 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00110 
00111 /*  Z       (input) DOUBLE PRECISION array, dimension (LDZ, M) */
00112 /*          The computed eigenvectors of the generalized eigenproblem. */
00113 
00114 /*  LDZ     (input) INTEGER */
00115 /*          The leading dimension of the array Z.  LDZ >= max(1,N). */
00116 
00117 /*  D       (input) DOUBLE PRECISION array, dimension (M) */
00118 /*          The computed eigenvalues of the generalized eigenproblem. */
00119 
00120 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (N*N) */
00121 
00122 /*  RESULT  (output) DOUBLE PRECISION array, dimension (1) */
00123 /*          The test ratio as described above. */
00124 
00125 /*  ===================================================================== */
00126 
00127 /*     .. Parameters .. */
00128 /*     .. */
00129 /*     .. Local Scalars .. */
00130 /*     .. */
00131 /*     .. External Functions .. */
00132 /*     .. */
00133 /*     .. External Subroutines .. */
00134 /*     .. */
00135 /*     .. Executable Statements .. */
00136 
00137     /* Parameter adjustments */
00138     a_dim1 = *lda;
00139     a_offset = 1 + a_dim1;
00140     a -= a_offset;
00141     b_dim1 = *ldb;
00142     b_offset = 1 + b_dim1;
00143     b -= b_offset;
00144     z_dim1 = *ldz;
00145     z_offset = 1 + z_dim1;
00146     z__ -= z_offset;
00147     --d__;
00148     --work;
00149     --result;
00150 
00151     /* Function Body */
00152     result[1] = 0.;
00153     if (*n <= 0) {
00154         return 0;
00155     }
00156 
00157     ulp = dlamch_("Epsilon");
00158 
00159 /*     Compute product of 1-norms of A and Z. */
00160 
00161     anorm = dlansy_("1", uplo, n, &a[a_offset], lda, &work[1]) * dlange_("1", n, m, &z__[z_offset], ldz, &work[1]);
00162     if (anorm == 0.) {
00163         anorm = 1.;
00164     }
00165 
00166     if (*itype == 1) {
00167 
00168 /*        Norm of AZ - BZD */
00169 
00170         dsymm_("Left", uplo, n, m, &c_b6, &a[a_offset], lda, &z__[z_offset], 
00171                 ldz, &c_b7, &work[1], n);
00172         i__1 = *m;
00173         for (i__ = 1; i__ <= i__1; ++i__) {
00174             dscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00175 /* L10: */
00176         }
00177         dsymm_("Left", uplo, n, m, &c_b6, &b[b_offset], ldb, &z__[z_offset], 
00178                 ldz, &c_b12, &work[1], n);
00179 
00180         result[1] = dlange_("1", n, m, &work[1], n, &work[1]) / 
00181                 anorm / (*n * ulp);
00182 
00183     } else if (*itype == 2) {
00184 
00185 /*        Norm of ABZ - ZD */
00186 
00187         dsymm_("Left", uplo, n, m, &c_b6, &b[b_offset], ldb, &z__[z_offset], 
00188                 ldz, &c_b7, &work[1], n);
00189         i__1 = *m;
00190         for (i__ = 1; i__ <= i__1; ++i__) {
00191             dscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00192 /* L20: */
00193         }
00194         dsymm_("Left", uplo, n, m, &c_b6, &a[a_offset], lda, &work[1], n, &
00195                 c_b12, &z__[z_offset], ldz);
00196 
00197         result[1] = dlange_("1", n, m, &z__[z_offset], ldz, &work[1]) / anorm / (*n * ulp);
00198 
00199     } else if (*itype == 3) {
00200 
00201 /*        Norm of BAZ - ZD */
00202 
00203         dsymm_("Left", uplo, n, m, &c_b6, &a[a_offset], lda, &z__[z_offset], 
00204                 ldz, &c_b7, &work[1], n);
00205         i__1 = *m;
00206         for (i__ = 1; i__ <= i__1; ++i__) {
00207             dscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00208 /* L30: */
00209         }
00210         dsymm_("Left", uplo, n, m, &c_b6, &b[b_offset], ldb, &work[1], n, &
00211                 c_b12, &z__[z_offset], ldz);
00212 
00213         result[1] = dlange_("1", n, m, &z__[z_offset], ldz, &work[1]) / anorm / (*n * ulp);
00214     }
00215 
00216     return 0;
00217 
00218 /*     End of DDGT01 */
00219 
00220 } /* dsgt01_ */


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