zunmr2.c
Go to the documentation of this file.
00001 /* zunmr2.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 zunmr2_(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, 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 /*  ZUNMR2 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(1)' H(2)' . . . H(k)' */
00065 
00066 /*  as returned by ZGERQF. 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 /*          ZGERQF in the last 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 ZGERQF. */
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_("ZUNMR2", &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     } else {
00200         mi = *m;
00201     }
00202 
00203     i__1 = i2;
00204     i__2 = i3;
00205     for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00206         if (left) {
00207 
00208 /*           H(i) or H(i)' is applied to C(1:m-k+i,1:n) */
00209 
00210             mi = *m - *k + i__;
00211         } else {
00212 
00213 /*           H(i) or H(i)' is applied to C(1:m,1:n-k+i) */
00214 
00215             ni = *n - *k + i__;
00216         }
00217 
00218 /*        Apply H(i) or H(i)' */
00219 
00220         if (notran) {
00221             d_cnjg(&z__1, &tau[i__]);
00222             taui.r = z__1.r, taui.i = z__1.i;
00223         } else {
00224             i__3 = i__;
00225             taui.r = tau[i__3].r, taui.i = tau[i__3].i;
00226         }
00227         i__3 = nq - *k + i__ - 1;
00228         zlacgv_(&i__3, &a[i__ + a_dim1], lda);
00229         i__3 = i__ + (nq - *k + i__) * a_dim1;
00230         aii.r = a[i__3].r, aii.i = a[i__3].i;
00231         i__3 = i__ + (nq - *k + i__) * a_dim1;
00232         a[i__3].r = 1., a[i__3].i = 0.;
00233         zlarf_(side, &mi, &ni, &a[i__ + a_dim1], lda, &taui, &c__[c_offset], 
00234                 ldc, &work[1]);
00235         i__3 = i__ + (nq - *k + i__) * a_dim1;
00236         a[i__3].r = aii.r, a[i__3].i = aii.i;
00237         i__3 = nq - *k + i__ - 1;
00238         zlacgv_(&i__3, &a[i__ + a_dim1], lda);
00239 /* L10: */
00240     }
00241     return 0;
00242 
00243 /*     End of ZUNMR2 */
00244 
00245 } /* zunmr2_ */


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