zhst01.c
Go to the documentation of this file.
00001 /* zhst01.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_b7 = {1.,0.};
00019 static doublecomplex c_b8 = {0.,0.};
00020 static doublecomplex c_b11 = {-1.,0.};
00021 
00022 /* Subroutine */ int zhst01_(integer *n, integer *ilo, integer *ihi, 
00023         doublecomplex *a, integer *lda, doublecomplex *h__, integer *ldh, 
00024         doublecomplex *q, integer *ldq, doublecomplex *work, integer *lwork, 
00025         doublereal *rwork, doublereal *result)
00026 {
00027     /* System generated locals */
00028     integer a_dim1, a_offset, h_dim1, h_offset, q_dim1, q_offset;
00029     doublereal d__1, d__2;
00030 
00031     /* Local variables */
00032     doublereal eps, unfl, ovfl, anorm;
00033     extern /* Subroutine */ int zgemm_(char *, char *, integer *, integer *, 
00034             integer *, doublecomplex *, doublecomplex *, integer *, 
00035             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00036             integer *), zunt01_(char *, integer *, integer *, 
00037             doublecomplex *, integer *, doublecomplex *, integer *, 
00038             doublereal *, doublereal *);
00039     doublereal wnorm;
00040     extern /* Subroutine */ int dlabad_(doublereal *, doublereal *);
00041     extern doublereal dlamch_(char *), zlange_(char *, integer *, 
00042             integer *, doublecomplex *, integer *, doublereal *);
00043     integer ldwork;
00044     extern /* Subroutine */ int zlacpy_(char *, integer *, integer *, 
00045             doublecomplex *, integer *, doublecomplex *, integer *);
00046     doublereal smlnum;
00047 
00048 
00049 /*  -- LAPACK test routine (version 3.1) -- */
00050 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00051 /*     November 2006 */
00052 
00053 /*     .. Scalar Arguments .. */
00054 /*     .. */
00055 /*     .. Array Arguments .. */
00056 /*     .. */
00057 
00058 /*  Purpose */
00059 /*  ======= */
00060 
00061 /*  ZHST01 tests the reduction of a general matrix A to upper Hessenberg */
00062 /*  form:  A = Q*H*Q'.  Two test ratios are computed; */
00063 
00064 /*  RESULT(1) = norm( A - Q*H*Q' ) / ( norm(A) * N * EPS ) */
00065 /*  RESULT(2) = norm( I - Q'*Q ) / ( N * EPS ) */
00066 
00067 /*  The matrix Q is assumed to be given explicitly as it would be */
00068 /*  following ZGEHRD + ZUNGHR. */
00069 
00070 /*  In this version, ILO and IHI are not used, but they could be used */
00071 /*  to save some work if this is desired. */
00072 
00073 /*  Arguments */
00074 /*  ========= */
00075 
00076 /*  N       (input) INTEGER */
00077 /*          The order of the matrix A.  N >= 0. */
00078 
00079 /*  ILO     (input) INTEGER */
00080 /*  IHI     (input) INTEGER */
00081 /*          A is assumed to be upper triangular in rows and columns */
00082 /*          1:ILO-1 and IHI+1:N, so Q differs from the identity only in */
00083 /*          rows and columns ILO+1:IHI. */
00084 
00085 /*  A       (input) COMPLEX*16 array, dimension (LDA,N) */
00086 /*          The original n by n matrix A. */
00087 
00088 /*  LDA     (input) INTEGER */
00089 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00090 
00091 /*  H       (input) COMPLEX*16 array, dimension (LDH,N) */
00092 /*          The upper Hessenberg matrix H from the reduction A = Q*H*Q' */
00093 /*          as computed by ZGEHRD.  H is assumed to be zero below the */
00094 /*          first subdiagonal. */
00095 
00096 /*  LDH     (input) INTEGER */
00097 /*          The leading dimension of the array H.  LDH >= max(1,N). */
00098 
00099 /*  Q       (input) COMPLEX*16 array, dimension (LDQ,N) */
00100 /*          The orthogonal matrix Q from the reduction A = Q*H*Q' as */
00101 /*          computed by ZGEHRD + ZUNGHR. */
00102 
00103 /*  LDQ     (input) INTEGER */
00104 /*          The leading dimension of the array Q.  LDQ >= max(1,N). */
00105 
00106 /*  WORK    (workspace) COMPLEX*16 array, dimension (LWORK) */
00107 
00108 /*  LWORK   (input) INTEGER */
00109 /*          The length of the array WORK.  LWORK >= 2*N*N. */
00110 
00111 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (N) */
00112 
00113 /*  RESULT  (output) DOUBLE PRECISION array, dimension (2) */
00114 /*          RESULT(1) = norm( A - Q*H*Q' ) / ( norm(A) * N * EPS ) */
00115 /*          RESULT(2) = norm( I - Q'*Q ) / ( N * EPS ) */
00116 
00117 /*  ===================================================================== */
00118 
00119 /*     .. Parameters .. */
00120 /*     .. */
00121 /*     .. Local Scalars .. */
00122 /*     .. */
00123 /*     .. External Functions .. */
00124 /*     .. */
00125 /*     .. External Subroutines .. */
00126 /*     .. */
00127 /*     .. Intrinsic Functions .. */
00128 /*     .. */
00129 /*     .. Executable Statements .. */
00130 
00131 /*     Quick return if possible */
00132 
00133     /* Parameter adjustments */
00134     a_dim1 = *lda;
00135     a_offset = 1 + a_dim1;
00136     a -= a_offset;
00137     h_dim1 = *ldh;
00138     h_offset = 1 + h_dim1;
00139     h__ -= h_offset;
00140     q_dim1 = *ldq;
00141     q_offset = 1 + q_dim1;
00142     q -= q_offset;
00143     --work;
00144     --rwork;
00145     --result;
00146 
00147     /* Function Body */
00148     if (*n <= 0) {
00149         result[1] = 0.;
00150         result[2] = 0.;
00151         return 0;
00152     }
00153 
00154     unfl = dlamch_("Safe minimum");
00155     eps = dlamch_("Precision");
00156     ovfl = 1. / unfl;
00157     dlabad_(&unfl, &ovfl);
00158     smlnum = unfl * *n / eps;
00159 
00160 /*     Test 1:  Compute norm( A - Q*H*Q' ) / ( norm(A) * N * EPS ) */
00161 
00162 /*     Copy A to WORK */
00163 
00164     ldwork = max(1,*n);
00165     zlacpy_(" ", n, n, &a[a_offset], lda, &work[1], &ldwork);
00166 
00167 /*     Compute Q*H */
00168 
00169     zgemm_("No transpose", "No transpose", n, n, n, &c_b7, &q[q_offset], ldq, 
00170             &h__[h_offset], ldh, &c_b8, &work[ldwork * *n + 1], &ldwork);
00171 
00172 /*     Compute A - Q*H*Q' */
00173 
00174     zgemm_("No transpose", "Conjugate transpose", n, n, n, &c_b11, &work[
00175             ldwork * *n + 1], &ldwork, &q[q_offset], ldq, &c_b7, &work[1], &
00176             ldwork);
00177 
00178 /* Computing MAX */
00179     d__1 = zlange_("1", n, n, &a[a_offset], lda, &rwork[1]);
00180     anorm = max(d__1,unfl);
00181     wnorm = zlange_("1", n, n, &work[1], &ldwork, &rwork[1]);
00182 
00183 /*     Note that RESULT(1) cannot overflow and is bounded by 1/(N*EPS) */
00184 
00185 /* Computing MAX */
00186     d__1 = smlnum, d__2 = anorm * eps;
00187     result[1] = min(wnorm,anorm) / max(d__1,d__2) / *n;
00188 
00189 /*     Test 2:  Compute norm( I - Q'*Q ) / ( N * EPS ) */
00190 
00191     zunt01_("Columns", n, n, &q[q_offset], ldq, &work[1], lwork, &rwork[1], &
00192             result[2]);
00193 
00194     return 0;
00195 
00196 /*     End of ZHST01 */
00197 
00198 } /* zhst01_ */


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