zunmr3.c
Go to the documentation of this file.
00001 /* zunmr3.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 zunmr3_(char *side, char *trans, integer *m, integer *n, 
00017         integer *k, integer *l, doublecomplex *a, integer *lda, doublecomplex 
00018         *tau, doublecomplex *c__, integer *ldc, doublecomplex *work, integer *
00019         info)
00020 {
00021     /* System generated locals */
00022     integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3;
00023     doublecomplex z__1;
00024 
00025     /* Builtin functions */
00026     void d_cnjg(doublecomplex *, doublecomplex *);
00027 
00028     /* Local variables */
00029     integer i__, i1, i2, i3, ja, ic, jc, mi, ni, nq;
00030     logical left;
00031     doublecomplex taui;
00032     extern logical lsame_(char *, char *);
00033     extern /* Subroutine */ int zlarz_(char *, integer *, integer *, integer *
00034 , doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00035             integer *, doublecomplex *), xerbla_(char *, 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 /*  ZUNMR3 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 ZTZRZF. 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 /*  L       (input) INTEGER */
00093 /*          The number of columns of the matrix A containing */
00094 /*          the meaningful part of the Householder reflectors. */
00095 /*          If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0. */
00096 
00097 /*  A       (input) COMPLEX*16 array, dimension */
00098 /*                               (LDA,M) if SIDE = 'L', */
00099 /*                               (LDA,N) if SIDE = 'R' */
00100 /*          The i-th row must contain the vector which defines the */
00101 /*          elementary reflector H(i), for i = 1,2,...,k, as returned by */
00102 /*          ZTZRZF in the last k rows of its array argument A. */
00103 /*          A is modified by the routine but restored on exit. */
00104 
00105 /*  LDA     (input) INTEGER */
00106 /*          The leading dimension of the array A. LDA >= max(1,K). */
00107 
00108 /*  TAU     (input) COMPLEX*16 array, dimension (K) */
00109 /*          TAU(i) must contain the scalar factor of the elementary */
00110 /*          reflector H(i), as returned by ZTZRZF. */
00111 
00112 /*  C       (input/output) COMPLEX*16 array, dimension (LDC,N) */
00113 /*          On entry, the m-by-n matrix C. */
00114 /*          On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. */
00115 
00116 /*  LDC     (input) INTEGER */
00117 /*          The leading dimension of the array C. LDC >= max(1,M). */
00118 
00119 /*  WORK    (workspace) COMPLEX*16 array, dimension */
00120 /*                                   (N) if SIDE = 'L', */
00121 /*                                   (M) if SIDE = 'R' */
00122 
00123 /*  INFO    (output) INTEGER */
00124 /*          = 0: successful exit */
00125 /*          < 0: if INFO = -i, the i-th argument had an illegal value */
00126 
00127 /*  Further Details */
00128 /*  =============== */
00129 
00130 /*  Based on contributions by */
00131 /*    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA */
00132 
00133 /*  ===================================================================== */
00134 
00135 /*     .. Local Scalars .. */
00136 /*     .. */
00137 /*     .. External Functions .. */
00138 /*     .. */
00139 /*     .. External Subroutines .. */
00140 /*     .. */
00141 /*     .. Intrinsic Functions .. */
00142 /*     .. */
00143 /*     .. Executable Statements .. */
00144 
00145 /*     Test the input arguments */
00146 
00147     /* Parameter adjustments */
00148     a_dim1 = *lda;
00149     a_offset = 1 + a_dim1;
00150     a -= a_offset;
00151     --tau;
00152     c_dim1 = *ldc;
00153     c_offset = 1 + c_dim1;
00154     c__ -= c_offset;
00155     --work;
00156 
00157     /* Function Body */
00158     *info = 0;
00159     left = lsame_(side, "L");
00160     notran = lsame_(trans, "N");
00161 
00162 /*     NQ is the order of Q */
00163 
00164     if (left) {
00165         nq = *m;
00166     } else {
00167         nq = *n;
00168     }
00169     if (! left && ! lsame_(side, "R")) {
00170         *info = -1;
00171     } else if (! notran && ! lsame_(trans, "C")) {
00172         *info = -2;
00173     } else if (*m < 0) {
00174         *info = -3;
00175     } else if (*n < 0) {
00176         *info = -4;
00177     } else if (*k < 0 || *k > nq) {
00178         *info = -5;
00179     } else if (*l < 0 || left && *l > *m || ! left && *l > *n) {
00180         *info = -6;
00181     } else if (*lda < max(1,*k)) {
00182         *info = -8;
00183     } else if (*ldc < max(1,*m)) {
00184         *info = -11;
00185     }
00186     if (*info != 0) {
00187         i__1 = -(*info);
00188         xerbla_("ZUNMR3", &i__1);
00189         return 0;
00190     }
00191 
00192 /*     Quick return if possible */
00193 
00194     if (*m == 0 || *n == 0 || *k == 0) {
00195         return 0;
00196     }
00197 
00198     if (left && ! notran || ! left && notran) {
00199         i1 = 1;
00200         i2 = *k;
00201         i3 = 1;
00202     } else {
00203         i1 = *k;
00204         i2 = 1;
00205         i3 = -1;
00206     }
00207 
00208     if (left) {
00209         ni = *n;
00210         ja = *m - *l + 1;
00211         jc = 1;
00212     } else {
00213         mi = *m;
00214         ja = *n - *l + 1;
00215         ic = 1;
00216     }
00217 
00218     i__1 = i2;
00219     i__2 = i3;
00220     for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00221         if (left) {
00222 
00223 /*           H(i) or H(i)' is applied to C(i:m,1:n) */
00224 
00225             mi = *m - i__ + 1;
00226             ic = i__;
00227         } else {
00228 
00229 /*           H(i) or H(i)' is applied to C(1:m,i:n) */
00230 
00231             ni = *n - i__ + 1;
00232             jc = i__;
00233         }
00234 
00235 /*        Apply H(i) or H(i)' */
00236 
00237         if (notran) {
00238             i__3 = i__;
00239             taui.r = tau[i__3].r, taui.i = tau[i__3].i;
00240         } else {
00241             d_cnjg(&z__1, &tau[i__]);
00242             taui.r = z__1.r, taui.i = z__1.i;
00243         }
00244         zlarz_(side, &mi, &ni, l, &a[i__ + ja * a_dim1], lda, &taui, &c__[ic 
00245                 + jc * c_dim1], ldc, &work[1]);
00246 
00247 /* L10: */
00248     }
00249 
00250     return 0;
00251 
00252 /*     End of ZUNMR3 */
00253 
00254 } /* zunmr3_ */


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