dqrt11.c
Go to the documentation of this file.
00001 /* dqrt11.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 doublereal c_b5 = 0.;
00020 static doublereal c_b6 = 1.;
00021 
00022 doublereal dqrt11_(integer *m, integer *k, doublereal *a, integer *lda, 
00023         doublereal *tau, doublereal *work, integer *lwork)
00024 {
00025     /* System generated locals */
00026     integer a_dim1, a_offset, i__1;
00027     doublereal ret_val;
00028 
00029     /* Local variables */
00030     integer j, info;
00031     extern /* Subroutine */ int dorm2r_(char *, char *, integer *, integer *, 
00032             integer *, doublereal *, integer *, doublereal *, doublereal *, 
00033             integer *, doublereal *, integer *);
00034     extern doublereal dlamch_(char *), dlange_(char *, integer *, 
00035             integer *, doublereal *, integer *, doublereal *);
00036     extern /* Subroutine */ int dlaset_(char *, integer *, integer *, 
00037             doublereal *, doublereal *, doublereal *, integer *), 
00038             xerbla_(char *, integer *);
00039     doublereal rdummy[1];
00040 
00041 
00042 /*  -- LAPACK 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 /*  DQRT11 computes the test ratio */
00055 
00056 /*        || Q'*Q - I || / (eps * m) */
00057 
00058 /*  where the orthogonal matrix Q is represented as a product of */
00059 /*  elementary transformations.  Each transformation has the form */
00060 
00061 /*     H(k) = I - tau(k) v(k) v(k)' */
00062 
00063 /*  where tau(k) is stored in TAU(k) and v(k) is an m-vector of the form */
00064 /*  [ 0 ... 0 1 x(k) ]', where x(k) is a vector of length m-k stored */
00065 /*  in A(k+1:m,k). */
00066 
00067 /*  Arguments */
00068 /*  ========= */
00069 
00070 /*  M       (input) INTEGER */
00071 /*          The number of rows of the matrix A. */
00072 
00073 /*  K       (input) INTEGER */
00074 /*          The number of columns of A whose subdiagonal entries */
00075 /*          contain information about orthogonal transformations. */
00076 
00077 /*  A       (input) DOUBLE PRECISION array, dimension (LDA,K) */
00078 /*          The (possibly partial) output of a QR reduction routine. */
00079 
00080 /*  LDA     (input) INTEGER */
00081 /*          The leading dimension of the array A. */
00082 
00083 /*  TAU     (input) DOUBLE PRECISION array, dimension (K) */
00084 /*          The scaling factors tau for the elementary transformations as */
00085 /*          computed by the QR factorization routine. */
00086 
00087 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (LWORK) */
00088 
00089 /*  LWORK   (input) INTEGER */
00090 /*          The length of the array WORK.  LWORK >= M*M + M. */
00091 
00092 /*  ===================================================================== */
00093 
00094 /*     .. Parameters .. */
00095 /*     .. */
00096 /*     .. Local Scalars .. */
00097 /*     .. */
00098 /*     .. External Functions .. */
00099 /*     .. */
00100 /*     .. External Subroutines .. */
00101 /*     .. */
00102 /*     .. Intrinsic Functions .. */
00103 /*     .. */
00104 /*     .. Local Arrays .. */
00105 /*     .. */
00106 /*     .. Executable Statements .. */
00107 
00108     /* Parameter adjustments */
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 /*     Test for sufficient workspace */
00119 
00120     if (*lwork < *m * *m + *m) {
00121         xerbla_("DQRT11", &c__7);
00122         return ret_val;
00123     }
00124 
00125 /*     Quick return if possible */
00126 
00127     if (*m <= 0) {
00128         return ret_val;
00129     }
00130 
00131     dlaset_("Full", m, m, &c_b5, &c_b6, &work[1], m);
00132 
00133 /*     Form Q */
00134 
00135     dorm2r_("Left", "No transpose", m, m, k, &a[a_offset], lda, &tau[1], &
00136             work[1], m, &work[*m * *m + 1], &info);
00137 
00138 /*     Form Q'*Q */
00139 
00140     dorm2r_("Left", "Transpose", m, m, k, &a[a_offset], lda, &tau[1], &work[1]
00141 , m, &work[*m * *m + 1], &info);
00142 
00143     i__1 = *m;
00144     for (j = 1; j <= i__1; ++j) {
00145         work[(j - 1) * *m + j] += -1.;
00146 /* L10: */
00147     }
00148 
00149     ret_val = dlange_("One-norm", m, m, &work[1], m, rdummy) / ((
00150             doublereal) (*m) * dlamch_("Epsilon"));
00151 
00152     return ret_val;
00153 
00154 /*     End of DQRT11 */
00155 
00156 } /* dqrt11_ */


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