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