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


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