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


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