cunm2l.c
Go to the documentation of this file.
00001 /* cunm2l.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 cunm2l_(char *side, char *trans, integer *m, integer *n, 
00021         integer *k, complex *a, integer *lda, complex *tau, complex *c__, 
00022         integer *ldc, complex *work, integer *info)
00023 {
00024     /* System generated locals */
00025     integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3;
00026     complex q__1;
00027 
00028     /* Builtin functions */
00029     void r_cnjg(complex *, complex *);
00030 
00031     /* Local variables */
00032     integer i__, i1, i2, i3, mi, ni, nq;
00033     complex aii;
00034     logical left;
00035     complex taui;
00036     extern /* Subroutine */ int clarf_(char *, integer *, integer *, complex *
00037 , integer *, complex *, complex *, integer *, complex *);
00038     extern logical lsame_(char *, char *);
00039     extern /* Subroutine */ int xerbla_(char *, integer *);
00040     logical notran;
00041 
00042 
00043 /*  -- LAPACK routine (version 3.2) -- */
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 /*  CUNM2L overwrites the general complex m-by-n matrix C with */
00056 
00057 /*        Q * C  if SIDE = 'L' and TRANS = 'N', or */
00058 
00059 /*        Q'* C  if SIDE = 'L' and TRANS = 'C', or */
00060 
00061 /*        C * Q  if SIDE = 'R' and TRANS = 'N', or */
00062 
00063 /*        C * Q' if SIDE = 'R' and TRANS = 'C', */
00064 
00065 /*  where Q is a complex unitary matrix defined as the product of k */
00066 /*  elementary reflectors */
00067 
00068 /*        Q = H(k) . . . H(2) H(1) */
00069 
00070 /*  as returned by CGEQLF. Q is of order m if SIDE = 'L' and of order n */
00071 /*  if SIDE = 'R'. */
00072 
00073 /*  Arguments */
00074 /*  ========= */
00075 
00076 /*  SIDE    (input) CHARACTER*1 */
00077 /*          = 'L': apply Q or Q' from the Left */
00078 /*          = 'R': apply Q or Q' from the Right */
00079 
00080 /*  TRANS   (input) CHARACTER*1 */
00081 /*          = 'N': apply Q  (No transpose) */
00082 /*          = 'C': apply Q' (Conjugate transpose) */
00083 
00084 /*  M       (input) INTEGER */
00085 /*          The number of rows of the matrix C. M >= 0. */
00086 
00087 /*  N       (input) INTEGER */
00088 /*          The number of columns of the matrix C. N >= 0. */
00089 
00090 /*  K       (input) INTEGER */
00091 /*          The number of elementary reflectors whose product defines */
00092 /*          the matrix Q. */
00093 /*          If SIDE = 'L', M >= K >= 0; */
00094 /*          if SIDE = 'R', N >= K >= 0. */
00095 
00096 /*  A       (input) COMPLEX array, dimension (LDA,K) */
00097 /*          The i-th column must contain the vector which defines the */
00098 /*          elementary reflector H(i), for i = 1,2,...,k, as returned by */
00099 /*          CGEQLF in the last k columns of its array argument A. */
00100 /*          A is modified by the routine but restored on exit. */
00101 
00102 /*  LDA     (input) INTEGER */
00103 /*          The leading dimension of the array A. */
00104 /*          If SIDE = 'L', LDA >= max(1,M); */
00105 /*          if SIDE = 'R', LDA >= max(1,N). */
00106 
00107 /*  TAU     (input) COMPLEX array, dimension (K) */
00108 /*          TAU(i) must contain the scalar factor of the elementary */
00109 /*          reflector H(i), as returned by CGEQLF. */
00110 
00111 /*  C       (input/output) COMPLEX array, dimension (LDC,N) */
00112 /*          On entry, the m-by-n matrix C. */
00113 /*          On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. */
00114 
00115 /*  LDC     (input) INTEGER */
00116 /*          The leading dimension of the array C. LDC >= max(1,M). */
00117 
00118 /*  WORK    (workspace) COMPLEX array, dimension */
00119 /*                                   (N) if SIDE = 'L', */
00120 /*                                   (M) if SIDE = 'R' */
00121 
00122 /*  INFO    (output) INTEGER */
00123 /*          = 0: successful exit */
00124 /*          < 0: if INFO = -i, the i-th argument had an illegal value */
00125 
00126 /*  ===================================================================== */
00127 
00128 /*     .. Parameters .. */
00129 /*     .. */
00130 /*     .. Local Scalars .. */
00131 /*     .. */
00132 /*     .. External Functions .. */
00133 /*     .. */
00134 /*     .. External Subroutines .. */
00135 /*     .. */
00136 /*     .. Intrinsic Functions .. */
00137 /*     .. */
00138 /*     .. Executable Statements .. */
00139 
00140 /*     Test the input arguments */
00141 
00142     /* Parameter adjustments */
00143     a_dim1 = *lda;
00144     a_offset = 1 + a_dim1;
00145     a -= a_offset;
00146     --tau;
00147     c_dim1 = *ldc;
00148     c_offset = 1 + c_dim1;
00149     c__ -= c_offset;
00150     --work;
00151 
00152     /* Function Body */
00153     *info = 0;
00154     left = lsame_(side, "L");
00155     notran = lsame_(trans, "N");
00156 
00157 /*     NQ is the order of Q */
00158 
00159     if (left) {
00160         nq = *m;
00161     } else {
00162         nq = *n;
00163     }
00164     if (! left && ! lsame_(side, "R")) {
00165         *info = -1;
00166     } else if (! notran && ! lsame_(trans, "C")) {
00167         *info = -2;
00168     } else if (*m < 0) {
00169         *info = -3;
00170     } else if (*n < 0) {
00171         *info = -4;
00172     } else if (*k < 0 || *k > nq) {
00173         *info = -5;
00174     } else if (*lda < max(1,nq)) {
00175         *info = -7;
00176     } else if (*ldc < max(1,*m)) {
00177         *info = -10;
00178     }
00179     if (*info != 0) {
00180         i__1 = -(*info);
00181         xerbla_("CUNM2L", &i__1);
00182         return 0;
00183     }
00184 
00185 /*     Quick return if possible */
00186 
00187     if (*m == 0 || *n == 0 || *k == 0) {
00188         return 0;
00189     }
00190 
00191     if (left && notran || ! left && ! notran) {
00192         i1 = 1;
00193         i2 = *k;
00194         i3 = 1;
00195     } else {
00196         i1 = *k;
00197         i2 = 1;
00198         i3 = -1;
00199     }
00200 
00201     if (left) {
00202         ni = *n;
00203     } else {
00204         mi = *m;
00205     }
00206 
00207     i__1 = i2;
00208     i__2 = i3;
00209     for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00210         if (left) {
00211 
00212 /*           H(i) or H(i)' is applied to C(1:m-k+i,1:n) */
00213 
00214             mi = *m - *k + i__;
00215         } else {
00216 
00217 /*           H(i) or H(i)' is applied to C(1:m,1:n-k+i) */
00218 
00219             ni = *n - *k + i__;
00220         }
00221 
00222 /*        Apply H(i) or H(i)' */
00223 
00224         if (notran) {
00225             i__3 = i__;
00226             taui.r = tau[i__3].r, taui.i = tau[i__3].i;
00227         } else {
00228             r_cnjg(&q__1, &tau[i__]);
00229             taui.r = q__1.r, taui.i = q__1.i;
00230         }
00231         i__3 = nq - *k + i__ + i__ * a_dim1;
00232         aii.r = a[i__3].r, aii.i = a[i__3].i;
00233         i__3 = nq - *k + i__ + i__ * a_dim1;
00234         a[i__3].r = 1.f, a[i__3].i = 0.f;
00235         clarf_(side, &mi, &ni, &a[i__ * a_dim1 + 1], &c__1, &taui, &c__[
00236                 c_offset], ldc, &work[1]);
00237         i__3 = nq - *k + i__ + i__ * a_dim1;
00238         a[i__3].r = aii.r, a[i__3].i = aii.i;
00239 /* L10: */
00240     }
00241     return 0;
00242 
00243 /*     End of CUNM2L */
00244 
00245 } /* cunm2l_ */


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