ztzt01.c
Go to the documentation of this file.
00001 /* ztzt01.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__8 = 8;
00019 static doublecomplex c_b6 = {0.,0.};
00020 static integer c__1 = 1;
00021 static doublecomplex c_b15 = {-1.,0.};
00022 
00023 doublereal ztzt01_(integer *m, integer *n, doublecomplex *a, doublecomplex *
00024         af, integer *lda, doublecomplex *tau, doublecomplex *work, integer *
00025         lwork)
00026 {
00027     /* System generated locals */
00028     integer a_dim1, a_offset, af_dim1, af_offset, i__1, i__2, i__3, i__4;
00029     doublereal ret_val;
00030 
00031     /* Local variables */
00032     integer i__, j;
00033     doublereal norma, rwork[1];
00034     extern /* Subroutine */ int zaxpy_(integer *, doublecomplex *, 
00035             doublecomplex *, integer *, doublecomplex *, integer *);
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 /*  ZTZT01 returns */
00059 /*       || A - R*Q || / ( M * eps * ||A|| ) */
00060 /*  for an upper trapezoidal A that was factored with ZTZRQF. */
00061 
00062 /*  Arguments */
00063 /*  ========= */
00064 
00065 /*  M       (input) INTEGER */
00066 /*          The number of rows of the matrices A and AF. */
00067 
00068 /*  N       (input) INTEGER */
00069 /*          The number of columns of the matrices A and AF. */
00070 
00071 /*  A       (input) COMPLEX*16 array, dimension (LDA,N) */
00072 /*          The original upper trapezoidal M by N matrix A. */
00073 
00074 /*  AF      (input) COMPLEX*16 array, dimension (LDA,N) */
00075 /*          The output of ZTZRQF for input matrix A. */
00076 /*          The lower triangle is not referenced. */
00077 
00078 /*  LDA     (input) INTEGER */
00079 /*          The leading dimension of the arrays A and AF. */
00080 
00081 /*  TAU     (input) COMPLEX*16 array, dimension (M) */
00082 /*          Details of the  Householder transformations as returned by */
00083 /*          ZTZRQF. */
00084 
00085 /*  WORK    (workspace) COMPLEX*16 array, dimension (LWORK) */
00086 
00087 /*  LWORK   (input) INTEGER */
00088 /*          The length of the array WORK.  LWORK >= m*n + m. */
00089 
00090 /*  ===================================================================== */
00091 
00092 /*     .. Parameters .. */
00093 /*     .. */
00094 /*     .. Local Scalars .. */
00095 /*     .. */
00096 /*     .. Local Arrays .. */
00097 /*     .. */
00098 /*     .. External Functions .. */
00099 /*     .. */
00100 /*     .. External Subroutines .. */
00101 /*     .. */
00102 /*     .. Intrinsic Functions .. */
00103 /*     .. */
00104 /*     .. Executable Statements .. */
00105 
00106     /* Parameter adjustments */
00107     af_dim1 = *lda;
00108     af_offset = 1 + af_dim1;
00109     af -= af_offset;
00110     a_dim1 = *lda;
00111     a_offset = 1 + a_dim1;
00112     a -= a_offset;
00113     --tau;
00114     --work;
00115 
00116     /* Function Body */
00117     ret_val = 0.;
00118 
00119     if (*lwork < *m * *n + *m) {
00120         xerbla_("ZTZT01", &c__8);
00121         return ret_val;
00122     }
00123 
00124 /*     Quick return if possible */
00125 
00126     if (*m <= 0 || *n <= 0) {
00127         return ret_val;
00128     }
00129 
00130     norma = zlange_("One-norm", m, n, &a[a_offset], lda, rwork);
00131 
00132 /*     Copy upper triangle R */
00133 
00134     zlaset_("Full", m, n, &c_b6, &c_b6, &work[1], m);
00135     i__1 = *m;
00136     for (j = 1; j <= i__1; ++j) {
00137         i__2 = j;
00138         for (i__ = 1; i__ <= i__2; ++i__) {
00139             i__3 = (j - 1) * *m + i__;
00140             i__4 = i__ + j * af_dim1;
00141             work[i__3].r = af[i__4].r, work[i__3].i = af[i__4].i;
00142 /* L10: */
00143         }
00144 /* L20: */
00145     }
00146 
00147 /*     R = R * P(1) * ... *P(m) */
00148 
00149     i__1 = *m;
00150     for (i__ = 1; i__ <= i__1; ++i__) {
00151         i__2 = *n - *m + 1;
00152         zlatzm_("Right", &i__, &i__2, &af[i__ + (*m + 1) * af_dim1], lda, &
00153                 tau[i__], &work[(i__ - 1) * *m + 1], &work[*m * *m + 1], m, &
00154                 work[*m * *n + 1]);
00155 /* L30: */
00156     }
00157 
00158 /*     R = R - A */
00159 
00160     i__1 = *n;
00161     for (i__ = 1; i__ <= i__1; ++i__) {
00162         zaxpy_(m, &c_b15, &a[i__ * a_dim1 + 1], &c__1, &work[(i__ - 1) * *m + 
00163                 1], &c__1);
00164 /* L40: */
00165     }
00166 
00167     ret_val = zlange_("One-norm", m, n, &work[1], m, rwork);
00168 
00169     ret_val /= dlamch_("Epsilon") * (doublereal) max(*m,*n);
00170     if (norma != 0.) {
00171         ret_val /= norma;
00172     }
00173 
00174     return ret_val;
00175 
00176 /*     End of ZTZT01 */
00177 
00178 } /* ztzt01_ */


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