stzt01.c
Go to the documentation of this file.
00001 /* stzt01.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 real c_b6 = 0.f;
00020 static real c_b13 = -1.f;
00021 static integer c__1 = 1;
00022 
00023 doublereal stzt01_(integer *m, integer *n, real *a, real *af, integer *lda, 
00024         real *tau, real *work, integer *lwork)
00025 {
00026     /* System generated locals */
00027     integer a_dim1, a_offset, af_dim1, af_offset, i__1, i__2;
00028     real ret_val;
00029 
00030     /* Local variables */
00031     integer i__, j;
00032     real norma, rwork[1];
00033     extern /* Subroutine */ int saxpy_(integer *, real *, real *, integer *, 
00034             real *, integer *);
00035     extern doublereal slamch_(char *), slange_(char *, integer *, 
00036             integer *, real *, integer *, real *);
00037     extern /* Subroutine */ int xerbla_(char *, integer *), slaset_(
00038             char *, integer *, integer *, real *, real *, real *, integer *), slatzm_(char *, integer *, integer *, real *, integer *, 
00039             real *, real *, real *, integer *, real *);
00040 
00041 
00042 /*  -- LAPACK test routine (version 3.1) -- */
00043 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00044 /*     November 2006 */
00045 
00046 /*     .. Scalar Arguments .. */
00047 /*     .. */
00048 /*     .. Array Arguments .. */
00049 /*     .. */
00050 
00051 /*  Purpose */
00052 /*  ======= */
00053 
00054 /*  STZT01 returns */
00055 /*       || A - R*Q || / ( M * eps * ||A|| ) */
00056 /*  for an upper trapezoidal A that was factored with STZRQF. */
00057 
00058 /*  Arguments */
00059 /*  ========= */
00060 
00061 /*  M       (input) INTEGER */
00062 /*          The number of rows of the matrices A and AF. */
00063 
00064 /*  N       (input) INTEGER */
00065 /*          The number of columns of the matrices A and AF. */
00066 
00067 /*  A       (input) REAL array, dimension (LDA,N) */
00068 /*          The original upper trapezoidal M by N matrix A. */
00069 
00070 /*  AF      (input) REAL array, dimension (LDA,N) */
00071 /*          The output of STZRQF for input matrix A. */
00072 /*          The lower triangle is not referenced. */
00073 
00074 /*  LDA     (input) INTEGER */
00075 /*          The leading dimension of the arrays A and AF. */
00076 
00077 /*  TAU     (input) REAL array, dimension (M) */
00078 /*          Details of the  Householder transformations as returned by */
00079 /*          STZRQF. */
00080 
00081 /*  WORK    (workspace) REAL array, dimension (LWORK) */
00082 
00083 /*  LWORK   (input) INTEGER */
00084 /*          The length of the array WORK.  LWORK >= m*n + m. */
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     a_dim1 = *lda;
00107     a_offset = 1 + a_dim1;
00108     a -= a_offset;
00109     --tau;
00110     --work;
00111 
00112     /* Function Body */
00113     ret_val = 0.f;
00114 
00115     if (*lwork < *m * *n + *m) {
00116         xerbla_("STZT01", &c__8);
00117         return ret_val;
00118     }
00119 
00120 /*     Quick return if possible */
00121 
00122     if (*m <= 0 || *n <= 0) {
00123         return ret_val;
00124     }
00125 
00126     norma = slange_("One-norm", m, n, &a[a_offset], lda, rwork);
00127 
00128 /*     Copy upper triangle R */
00129 
00130     slaset_("Full", m, n, &c_b6, &c_b6, &work[1], m);
00131     i__1 = *m;
00132     for (j = 1; j <= i__1; ++j) {
00133         i__2 = j;
00134         for (i__ = 1; i__ <= i__2; ++i__) {
00135             work[(j - 1) * *m + i__] = af[i__ + j * af_dim1];
00136 /* L10: */
00137         }
00138 /* L20: */
00139     }
00140 
00141 /*     R = R * P(1) * ... *P(m) */
00142 
00143     i__1 = *m;
00144     for (i__ = 1; i__ <= i__1; ++i__) {
00145         i__2 = *n - *m + 1;
00146         slatzm_("Right", &i__, &i__2, &af[i__ + (*m + 1) * af_dim1], lda, &
00147                 tau[i__], &work[(i__ - 1) * *m + 1], &work[*m * *m + 1], m, &
00148                 work[*m * *n + 1]);
00149 /* L30: */
00150     }
00151 
00152 /*     R = R - A */
00153 
00154     i__1 = *n;
00155     for (i__ = 1; i__ <= i__1; ++i__) {
00156         saxpy_(m, &c_b13, &a[i__ * a_dim1 + 1], &c__1, &work[(i__ - 1) * *m + 
00157                 1], &c__1);
00158 /* L40: */
00159     }
00160 
00161     ret_val = slange_("One-norm", m, n, &work[1], m, rwork);
00162 
00163     ret_val /= slamch_("Epsilon") * (real) max(*m,*n);
00164     if (norma != 0.f) {
00165         ret_val /= norma;
00166     }
00167 
00168     return ret_val;
00169 
00170 /*     End of STZT01 */
00171 
00172 } /* stzt01_ */


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