00001 /* cunmr3.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 cunmr3_(char *side, char *trans, integer *m, integer *n, 00017 integer *k, integer *l, complex *a, integer *lda, complex *tau, 00018 complex *c__, integer *ldc, complex *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 complex q__1; 00023 00024 /* Builtin functions */ 00025 void r_cnjg(complex *, complex *); 00026 00027 /* Local variables */ 00028 integer i__, i1, i2, i3, ja, ic, jc, mi, ni, nq; 00029 logical left; 00030 complex taui; 00031 extern logical lsame_(char *, char *); 00032 extern /* Subroutine */ int clarz_(char *, integer *, integer *, integer * 00033 , complex *, integer *, complex *, complex *, integer *, complex * 00034 ), xerbla_(char *, integer *); 00035 logical notran; 00036 00037 00038 /* -- LAPACK routine (version 3.2) -- */ 00039 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00040 /* November 2006 */ 00041 00042 /* .. Scalar Arguments .. */ 00043 /* .. */ 00044 /* .. Array Arguments .. */ 00045 /* .. */ 00046 00047 /* Purpose */ 00048 /* ======= */ 00049 00050 /* CUNMR3 overwrites the general complex m by n matrix C with */ 00051 00052 /* Q * C if SIDE = 'L' and TRANS = 'N', or */ 00053 00054 /* Q'* C if SIDE = 'L' and TRANS = 'C', or */ 00055 00056 /* C * Q if SIDE = 'R' and TRANS = 'N', or */ 00057 00058 /* C * Q' if SIDE = 'R' and TRANS = 'C', */ 00059 00060 /* where Q is a complex unitary matrix defined as the product of k */ 00061 /* elementary reflectors */ 00062 00063 /* Q = H(1) H(2) . . . H(k) */ 00064 00065 /* as returned by CTZRZF. Q is of order m if SIDE = 'L' and of order n */ 00066 /* if SIDE = 'R'. */ 00067 00068 /* Arguments */ 00069 /* ========= */ 00070 00071 /* SIDE (input) CHARACTER*1 */ 00072 /* = 'L': apply Q or Q' from the Left */ 00073 /* = 'R': apply Q or Q' from the Right */ 00074 00075 /* TRANS (input) CHARACTER*1 */ 00076 /* = 'N': apply Q (No transpose) */ 00077 /* = 'C': apply Q' (Conjugate transpose) */ 00078 00079 /* M (input) INTEGER */ 00080 /* The number of rows of the matrix C. M >= 0. */ 00081 00082 /* N (input) INTEGER */ 00083 /* The number of columns of the matrix C. N >= 0. */ 00084 00085 /* K (input) INTEGER */ 00086 /* The number of elementary reflectors whose product defines */ 00087 /* the matrix Q. */ 00088 /* If SIDE = 'L', M >= K >= 0; */ 00089 /* if SIDE = 'R', N >= K >= 0. */ 00090 00091 /* L (input) INTEGER */ 00092 /* The number of columns of the matrix A containing */ 00093 /* the meaningful part of the Householder reflectors. */ 00094 /* If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0. */ 00095 00096 /* A (input) COMPLEX array, dimension */ 00097 /* (LDA,M) if SIDE = 'L', */ 00098 /* (LDA,N) if SIDE = 'R' */ 00099 /* The i-th row must contain the vector which defines the */ 00100 /* elementary reflector H(i), for i = 1,2,...,k, as returned by */ 00101 /* CTZRZF in the last k rows of its array argument A. */ 00102 /* A is modified by the routine but restored on exit. */ 00103 00104 /* LDA (input) INTEGER */ 00105 /* The leading dimension of the array A. LDA >= max(1,K). */ 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 CTZRZF. */ 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 /* Further Details */ 00127 /* =============== */ 00128 00129 /* Based on contributions by */ 00130 /* A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA */ 00131 00132 /* ===================================================================== */ 00133 00134 /* .. Local Scalars .. */ 00135 /* .. */ 00136 /* .. External Functions .. */ 00137 /* .. */ 00138 /* .. External Subroutines .. */ 00139 /* .. */ 00140 /* .. Intrinsic Functions .. */ 00141 /* .. */ 00142 /* .. Executable Statements .. */ 00143 00144 /* Test the input arguments */ 00145 00146 /* Parameter adjustments */ 00147 a_dim1 = *lda; 00148 a_offset = 1 + a_dim1; 00149 a -= a_offset; 00150 --tau; 00151 c_dim1 = *ldc; 00152 c_offset = 1 + c_dim1; 00153 c__ -= c_offset; 00154 --work; 00155 00156 /* Function Body */ 00157 *info = 0; 00158 left = lsame_(side, "L"); 00159 notran = lsame_(trans, "N"); 00160 00161 /* NQ is the order of Q */ 00162 00163 if (left) { 00164 nq = *m; 00165 } else { 00166 nq = *n; 00167 } 00168 if (! left && ! lsame_(side, "R")) { 00169 *info = -1; 00170 } else if (! notran && ! lsame_(trans, "C")) { 00171 *info = -2; 00172 } else if (*m < 0) { 00173 *info = -3; 00174 } else if (*n < 0) { 00175 *info = -4; 00176 } else if (*k < 0 || *k > nq) { 00177 *info = -5; 00178 } else if (*l < 0 || left && *l > *m || ! left && *l > *n) { 00179 *info = -6; 00180 } else if (*lda < max(1,*k)) { 00181 *info = -8; 00182 } else if (*ldc < max(1,*m)) { 00183 *info = -11; 00184 } 00185 if (*info != 0) { 00186 i__1 = -(*info); 00187 xerbla_("CUNMR3", &i__1); 00188 return 0; 00189 } 00190 00191 /* Quick return if possible */ 00192 00193 if (*m == 0 || *n == 0 || *k == 0) { 00194 return 0; 00195 } 00196 00197 if (left && ! notran || ! left && notran) { 00198 i1 = 1; 00199 i2 = *k; 00200 i3 = 1; 00201 } else { 00202 i1 = *k; 00203 i2 = 1; 00204 i3 = -1; 00205 } 00206 00207 if (left) { 00208 ni = *n; 00209 ja = *m - *l + 1; 00210 jc = 1; 00211 } else { 00212 mi = *m; 00213 ja = *n - *l + 1; 00214 ic = 1; 00215 } 00216 00217 i__1 = i2; 00218 i__2 = i3; 00219 for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { 00220 if (left) { 00221 00222 /* H(i) or H(i)' is applied to C(i:m,1:n) */ 00223 00224 mi = *m - i__ + 1; 00225 ic = i__; 00226 } else { 00227 00228 /* H(i) or H(i)' is applied to C(1:m,i:n) */ 00229 00230 ni = *n - i__ + 1; 00231 jc = i__; 00232 } 00233 00234 /* Apply H(i) or H(i)' */ 00235 00236 if (notran) { 00237 i__3 = i__; 00238 taui.r = tau[i__3].r, taui.i = tau[i__3].i; 00239 } else { 00240 r_cnjg(&q__1, &tau[i__]); 00241 taui.r = q__1.r, taui.i = q__1.i; 00242 } 00243 clarz_(side, &mi, &ni, l, &a[i__ + ja * a_dim1], lda, &taui, &c__[ic 00244 + jc * c_dim1], ldc, &work[1]); 00245 00246 /* L10: */ 00247 } 00248 00249 return 0; 00250 00251 /* End of CUNMR3 */ 00252 00253 } /* cunmr3_ */