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


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