ctzt02.c
Go to the documentation of this file.
00001 /* ctzt02.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 integer c__7 = 7;
00019 static complex c_b5 = {0.f,0.f};
00020 static complex c_b6 = {1.f,0.f};
00021 
00022 doublereal ctzt02_(integer *m, integer *n, complex *af, integer *lda, complex 
00023         *tau, complex *work, integer *lwork)
00024 {
00025     /* System generated locals */
00026     integer af_dim1, af_offset, i__1, i__2, i__3;
00027     real ret_val;
00028     complex q__1;
00029 
00030     /* Builtin functions */
00031     void r_cnjg(complex *, complex *);
00032 
00033     /* Local variables */
00034     integer i__;
00035     real rwork[1];
00036     extern doublereal clange_(char *, integer *, integer *, complex *, 
00037             integer *, real *), slamch_(char *);
00038     extern /* Subroutine */ int claset_(char *, integer *, integer *, complex 
00039             *, complex *, complex *, integer *), xerbla_(char *, 
00040             integer *), clatzm_(char *, integer *, integer *, complex 
00041             *, integer *, complex *, complex *, complex *, integer *, complex 
00042             *);
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 /*     .. Scalar Arguments .. */
00050 /*     .. */
00051 /*     .. Array Arguments .. */
00052 /*     .. */
00053 
00054 /*  Purpose */
00055 /*  ======= */
00056 
00057 /*  CTZT02 returns */
00058 /*       || I - Q'*Q || / ( M * eps) */
00059 /*  where the matrix Q is defined by the Householder transformations */
00060 /*  generated by CTZRQF. */
00061 
00062 /*  Arguments */
00063 /*  ========= */
00064 
00065 /*  M       (input) INTEGER */
00066 /*          The number of rows of the matrix AF. */
00067 
00068 /*  N       (input) INTEGER */
00069 /*          The number of columns of the matrix AF. */
00070 
00071 /*  AF      (input) COMPLEX array, dimension (LDA,N) */
00072 /*          The output of CTZRQF. */
00073 
00074 /*  LDA     (input) INTEGER */
00075 /*          The leading dimension of the array AF. */
00076 
00077 /*  TAU     (input) COMPLEX array, dimension (M) */
00078 /*          Details of the Householder transformations as returned by */
00079 /*          CTZRQF. */
00080 
00081 /*  WORK    (workspace) COMPLEX array, dimension (LWORK) */
00082 
00083 /*  LWORK   (input) INTEGER */
00084 /*          length of WORK array. Must be >= N*N+N */
00085 
00086 /*  ===================================================================== */
00087 
00088 /*     .. Parameters .. */
00089 /*     .. */
00090 /*     .. Local Scalars .. */
00091 /*     .. */
00092 /*     .. Local Arrays .. */
00093 /*     .. */
00094 /*     .. External Functions .. */
00095 /*     .. */
00096 /*     .. External Subroutines .. */
00097 /*     .. */
00098 /*     .. Intrinsic Functions .. */
00099 /*     .. */
00100 /*     .. Executable Statements .. */
00101 
00102     /* Parameter adjustments */
00103     af_dim1 = *lda;
00104     af_offset = 1 + af_dim1;
00105     af -= af_offset;
00106     --tau;
00107     --work;
00108 
00109     /* Function Body */
00110     ret_val = 0.f;
00111 
00112     if (*lwork < *n * *n + *n) {
00113         xerbla_("CTZT02", &c__7);
00114         return ret_val;
00115     }
00116 
00117 /*     Quick return if possible */
00118 
00119     if (*m <= 0 || *n <= 0) {
00120         return ret_val;
00121     }
00122 
00123 /*     Q := I */
00124 
00125     claset_("Full", n, n, &c_b5, &c_b6, &work[1], n);
00126 
00127 /*     Q := P(1) * ... * P(m) * Q */
00128 
00129     for (i__ = *m; i__ >= 1; --i__) {
00130         i__1 = *n - *m + 1;
00131         clatzm_("Left", &i__1, n, &af[i__ + (*m + 1) * af_dim1], lda, &tau[
00132                 i__], &work[i__], &work[*m + 1], n, &work[*n * *n + 1]);
00133 /* L10: */
00134     }
00135 
00136 /*     Q := P(m)' * ... * P(1)' * Q */
00137 
00138     i__1 = *m;
00139     for (i__ = 1; i__ <= i__1; ++i__) {
00140         i__2 = *n - *m + 1;
00141         r_cnjg(&q__1, &tau[i__]);
00142         clatzm_("Left", &i__2, n, &af[i__ + (*m + 1) * af_dim1], lda, &q__1, &
00143                 work[i__], &work[*m + 1], n, &work[*n * *n + 1]);
00144 /* L20: */
00145     }
00146 
00147 /*     Q := Q - I */
00148 
00149     i__1 = *n;
00150     for (i__ = 1; i__ <= i__1; ++i__) {
00151         i__2 = (i__ - 1) * *n + i__;
00152         i__3 = (i__ - 1) * *n + i__;
00153         q__1.r = work[i__3].r - 1.f, q__1.i = work[i__3].i;
00154         work[i__2].r = q__1.r, work[i__2].i = q__1.i;
00155 /* L30: */
00156     }
00157 
00158     ret_val = clange_("One-norm", n, n, &work[1], n, rwork) / (
00159             slamch_("Epsilon") * (real) max(*m,*n));
00160     return ret_val;
00161 
00162 /*     End of CTZT02 */
00163 
00164 } /* ctzt02_ */


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