csgt01.c
Go to the documentation of this file.
00001 /* csgt01.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 complex c_b1 = {0.f,0.f};
00019 static complex c_b2 = {1.f,0.f};
00020 static integer c__1 = 1;
00021 
00022 /* Subroutine */ int csgt01_(integer *itype, char *uplo, integer *n, integer *
00023         m, complex *a, integer *lda, complex *b, integer *ldb, complex *z__, 
00024         integer *ldz, real *d__, complex *work, real *rwork, real *result)
00025 {
00026     /* System generated locals */
00027     integer a_dim1, a_offset, b_dim1, b_offset, z_dim1, z_offset, i__1;
00028     complex q__1;
00029 
00030     /* Local variables */
00031     integer i__;
00032     real ulp;
00033     extern /* Subroutine */ int chemm_(char *, char *, integer *, integer *, 
00034             complex *, complex *, integer *, complex *, integer *, complex *, 
00035             complex *, integer *);
00036     real anorm;
00037     extern doublereal clange_(char *, integer *, integer *, complex *, 
00038             integer *, real *), clanhe_(char *, char *, integer *, 
00039             complex *, integer *, real *), slamch_(char *);
00040     extern /* Subroutine */ int csscal_(integer *, real *, complex *, integer 
00041             *);
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 /*     modified August 1997, a new parameter M is added to the calling */
00049 /*     sequence. */
00050 
00051 /*     .. Scalar Arguments .. */
00052 /*     .. */
00053 /*     .. Array Arguments .. */
00054 /*     .. */
00055 
00056 /*  Purpose */
00057 /*  ======= */
00058 
00059 /*  CSGT01 checks a decomposition of the form */
00060 
00061 /*     A Z   =  B Z D or */
00062 /*     A B Z =  Z D or */
00063 /*     B A Z =  Z D */
00064 
00065 /*  where A is a Hermitian matrix, B is Hermitian positive definite, */
00066 /*  Z is unitary, and D is diagonal. */
00067 
00068 /*  One of the following test ratios is computed: */
00069 
00070 /*  ITYPE = 1:  RESULT(1) = | A Z - B Z D | / ( |A| |Z| n ulp ) */
00071 
00072 /*  ITYPE = 2:  RESULT(1) = | A B Z - Z D | / ( |A| |Z| n ulp ) */
00073 
00074 /*  ITYPE = 3:  RESULT(1) = | B A Z - Z D | / ( |A| |Z| n ulp ) */
00075 
00076 /*  Arguments */
00077 /*  ========= */
00078 
00079 /*  ITYPE   (input) INTEGER */
00080 /*          The form of the Hermitian generalized eigenproblem. */
00081 /*          = 1:  A*z = (lambda)*B*z */
00082 /*          = 2:  A*B*z = (lambda)*z */
00083 /*          = 3:  B*A*z = (lambda)*z */
00084 
00085 /*  UPLO    (input) CHARACTER*1 */
00086 /*          Specifies whether the upper or lower triangular part of the */
00087 /*          Hermitian matrices A and B is stored. */
00088 /*          = 'U':  Upper triangular */
00089 /*          = 'L':  Lower triangular */
00090 
00091 /*  N       (input) INTEGER */
00092 /*          The order of the matrix A.  N >= 0. */
00093 
00094 /*  M       (input) INTEGER */
00095 /*          The number of eigenvalues found.  M >= 0. */
00096 
00097 /*  A       (input) COMPLEX array, dimension (LDA, N) */
00098 /*          The original Hermitian matrix A. */
00099 
00100 /*  LDA     (input) INTEGER */
00101 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00102 
00103 /*  B       (input) COMPLEX array, dimension (LDB, N) */
00104 /*          The original Hermitian positive definite matrix B. */
00105 
00106 /*  LDB     (input) INTEGER */
00107 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00108 
00109 /*  Z       (input) COMPLEX array, dimension (LDZ, M) */
00110 /*          The computed eigenvectors of the generalized eigenproblem. */
00111 
00112 /*  LDZ     (input) INTEGER */
00113 /*          The leading dimension of the array Z.  LDZ >= max(1,N). */
00114 
00115 /*  D       (input) REAL array, dimension (M) */
00116 /*          The computed eigenvalues of the generalized eigenproblem. */
00117 
00118 /*  WORK    (workspace) COMPLEX array, dimension (N*N) */
00119 
00120 /*  RWORK   (workspace) REAL array, dimension (N) */
00121 
00122 /*  RESULT  (output) REAL 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     --rwork;
00150     --result;
00151 
00152     /* Function Body */
00153     result[1] = 0.f;
00154     if (*n <= 0) {
00155         return 0;
00156     }
00157 
00158     ulp = slamch_("Epsilon");
00159 
00160 /*     Compute product of 1-norms of A and Z. */
00161 
00162     anorm = clanhe_("1", uplo, n, &a[a_offset], lda, &rwork[1]) * clange_("1", n, m, &z__[z_offset], ldz, &rwork[1]);
00163     if (anorm == 0.f) {
00164         anorm = 1.f;
00165     }
00166 
00167     if (*itype == 1) {
00168 
00169 /*        Norm of AZ - BZD */
00170 
00171         chemm_("Left", uplo, n, m, &c_b2, &a[a_offset], lda, &z__[z_offset], 
00172                 ldz, &c_b1, &work[1], n);
00173         i__1 = *m;
00174         for (i__ = 1; i__ <= i__1; ++i__) {
00175             csscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00176 /* L10: */
00177         }
00178         q__1.r = -1.f, q__1.i = -0.f;
00179         chemm_("Left", uplo, n, m, &c_b2, &b[b_offset], ldb, &z__[z_offset], 
00180                 ldz, &q__1, &work[1], n);
00181 
00182         result[1] = clange_("1", n, m, &work[1], n, &rwork[1]) / 
00183                 anorm / (*n * ulp);
00184 
00185     } else if (*itype == 2) {
00186 
00187 /*        Norm of ABZ - ZD */
00188 
00189         chemm_("Left", uplo, n, m, &c_b2, &b[b_offset], ldb, &z__[z_offset], 
00190                 ldz, &c_b1, &work[1], n);
00191         i__1 = *m;
00192         for (i__ = 1; i__ <= i__1; ++i__) {
00193             csscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00194 /* L20: */
00195         }
00196         q__1.r = -1.f, q__1.i = -0.f;
00197         chemm_("Left", uplo, n, m, &c_b2, &a[a_offset], lda, &work[1], n, &
00198                 q__1, &z__[z_offset], ldz);
00199 
00200         result[1] = clange_("1", n, m, &z__[z_offset], ldz, &rwork[1]) / anorm / (*n * ulp);
00201 
00202     } else if (*itype == 3) {
00203 
00204 /*        Norm of BAZ - ZD */
00205 
00206         chemm_("Left", uplo, n, m, &c_b2, &a[a_offset], lda, &z__[z_offset], 
00207                 ldz, &c_b1, &work[1], n);
00208         i__1 = *m;
00209         for (i__ = 1; i__ <= i__1; ++i__) {
00210             csscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00211 /* L30: */
00212         }
00213         q__1.r = -1.f, q__1.i = -0.f;
00214         chemm_("Left", uplo, n, m, &c_b2, &b[b_offset], ldb, &work[1], n, &
00215                 q__1, &z__[z_offset], ldz);
00216 
00217         result[1] = clange_("1", n, m, &z__[z_offset], ldz, &rwork[1]) / anorm / (*n * ulp);
00218     }
00219 
00220     return 0;
00221 
00222 /*     End of CSGT01 */
00223 
00224 } /* csgt01_ */


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