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


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