dgeql2.c
Go to the documentation of this file.
00001 /* dgeql2.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__1 = 1;
00019 
00020 /* Subroutine */ int dgeql2_(integer *m, integer *n, doublereal *a, integer *
00021         lda, doublereal *tau, doublereal *work, integer *info)
00022 {
00023     /* System generated locals */
00024     integer a_dim1, a_offset, i__1, i__2;
00025 
00026     /* Local variables */
00027     integer i__, k;
00028     doublereal aii;
00029     extern /* Subroutine */ int dlarf_(char *, integer *, integer *, 
00030             doublereal *, integer *, doublereal *, doublereal *, integer *, 
00031             doublereal *), dlarfp_(integer *, doublereal *, 
00032             doublereal *, integer *, doublereal *), xerbla_(char *, integer *);
00033 
00034 
00035 /*  -- LAPACK routine (version 3.2) -- */
00036 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00037 /*     November 2006 */
00038 
00039 /*     .. Scalar Arguments .. */
00040 /*     .. */
00041 /*     .. Array Arguments .. */
00042 /*     .. */
00043 
00044 /*  Purpose */
00045 /*  ======= */
00046 
00047 /*  DGEQL2 computes a QL factorization of a real m by n matrix A: */
00048 /*  A = Q * L. */
00049 
00050 /*  Arguments */
00051 /*  ========= */
00052 
00053 /*  M       (input) INTEGER */
00054 /*          The number of rows of the matrix A.  M >= 0. */
00055 
00056 /*  N       (input) INTEGER */
00057 /*          The number of columns of the matrix A.  N >= 0. */
00058 
00059 /*  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
00060 /*          On entry, the m by n matrix A. */
00061 /*          On exit, if m >= n, the lower triangle of the subarray */
00062 /*          A(m-n+1:m,1:n) contains the n by n lower triangular matrix L; */
00063 /*          if m <= n, the elements on and below the (n-m)-th */
00064 /*          superdiagonal contain the m by n lower trapezoidal matrix L; */
00065 /*          the remaining elements, with the array TAU, represent the */
00066 /*          orthogonal matrix Q as a product of elementary reflectors */
00067 /*          (see Further Details). */
00068 
00069 /*  LDA     (input) INTEGER */
00070 /*          The leading dimension of the array A.  LDA >= max(1,M). */
00071 
00072 /*  TAU     (output) DOUBLE PRECISION array, dimension (min(M,N)) */
00073 /*          The scalar factors of the elementary reflectors (see Further */
00074 /*          Details). */
00075 
00076 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (N) */
00077 
00078 /*  INFO    (output) INTEGER */
00079 /*          = 0: successful exit */
00080 /*          < 0: if INFO = -i, the i-th argument had an illegal value */
00081 
00082 /*  Further Details */
00083 /*  =============== */
00084 
00085 /*  The matrix Q is represented as a product of elementary reflectors */
00086 
00087 /*     Q = H(k) . . . H(2) H(1), where k = min(m,n). */
00088 
00089 /*  Each H(i) has the form */
00090 
00091 /*     H(i) = I - tau * v * v' */
00092 
00093 /*  where tau is a real scalar, and v is a real vector with */
00094 /*  v(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in */
00095 /*  A(1:m-k+i-1,n-k+i), and tau in TAU(i). */
00096 
00097 /*  ===================================================================== */
00098 
00099 /*     .. Parameters .. */
00100 /*     .. */
00101 /*     .. Local Scalars .. */
00102 /*     .. */
00103 /*     .. External Subroutines .. */
00104 /*     .. */
00105 /*     .. Intrinsic Functions .. */
00106 /*     .. */
00107 /*     .. Executable Statements .. */
00108 
00109 /*     Test the input arguments */
00110 
00111     /* Parameter adjustments */
00112     a_dim1 = *lda;
00113     a_offset = 1 + a_dim1;
00114     a -= a_offset;
00115     --tau;
00116     --work;
00117 
00118     /* Function Body */
00119     *info = 0;
00120     if (*m < 0) {
00121         *info = -1;
00122     } else if (*n < 0) {
00123         *info = -2;
00124     } else if (*lda < max(1,*m)) {
00125         *info = -4;
00126     }
00127     if (*info != 0) {
00128         i__1 = -(*info);
00129         xerbla_("DGEQL2", &i__1);
00130         return 0;
00131     }
00132 
00133     k = min(*m,*n);
00134 
00135     for (i__ = k; i__ >= 1; --i__) {
00136 
00137 /*        Generate elementary reflector H(i) to annihilate */
00138 /*        A(1:m-k+i-1,n-k+i) */
00139 
00140         i__1 = *m - k + i__;
00141         dlarfp_(&i__1, &a[*m - k + i__ + (*n - k + i__) * a_dim1], &a[(*n - k 
00142                 + i__) * a_dim1 + 1], &c__1, &tau[i__]);
00143 
00144 /*        Apply H(i) to A(1:m-k+i,1:n-k+i-1) from the left */
00145 
00146         aii = a[*m - k + i__ + (*n - k + i__) * a_dim1];
00147         a[*m - k + i__ + (*n - k + i__) * a_dim1] = 1.;
00148         i__1 = *m - k + i__;
00149         i__2 = *n - k + i__ - 1;
00150         dlarf_("Left", &i__1, &i__2, &a[(*n - k + i__) * a_dim1 + 1], &c__1, &
00151                 tau[i__], &a[a_offset], lda, &work[1]);
00152         a[*m - k + i__ + (*n - k + i__) * a_dim1] = aii;
00153 /* L10: */
00154     }
00155     return 0;
00156 
00157 /*     End of DGEQL2 */
00158 
00159 } /* dgeql2_ */


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