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


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