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


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