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


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