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


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