00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 static integer c__1 = 1;
00019 static integer c_n1 = -1;
00020 static integer c__2 = 2;
00021 static integer c__65 = 65;
00022
00023 int cunmrz_(char *side, char *trans, integer *m, integer *n,
00024 integer *k, integer *l, complex *a, integer *lda, complex *tau,
00025 complex *c__, integer *ldc, complex *work, integer *lwork, integer *
00026 info)
00027 {
00028
00029 address a__1[2];
00030 integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3[2], i__4,
00031 i__5;
00032 char ch__1[2];
00033
00034
00035 int s_cat(char *, char **, integer *, integer *, ftnlen);
00036
00037
00038 integer i__;
00039 complex t[4160] ;
00040 integer i1, i2, i3, ib, ic, ja, jc, nb, mi, ni, nq, nw, iws;
00041 logical left;
00042 extern logical lsame_(char *, char *);
00043 integer nbmin, iinfo;
00044 extern int cunmr3_(char *, char *, integer *, integer *,
00045 integer *, integer *, complex *, integer *, complex *, complex *,
00046 integer *, complex *, integer *), clarzb_(char *,
00047 char *, char *, char *, integer *, integer *, integer *, integer *
00048 , complex *, integer *, complex *, integer *, complex *, integer *
00049 , complex *, integer *);
00050 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00051 integer *, integer *);
00052 extern int xerbla_(char *, integer *), clarzt_(
00053 char *, char *, integer *, integer *, complex *, integer *,
00054 complex *, complex *, integer *);
00055 logical notran;
00056 integer ldwork;
00057 char transt[1];
00058 integer lwkopt;
00059 logical lquery;
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 a_dim1 = *lda;
00184 a_offset = 1 + a_dim1;
00185 a -= a_offset;
00186 --tau;
00187 c_dim1 = *ldc;
00188 c_offset = 1 + c_dim1;
00189 c__ -= c_offset;
00190 --work;
00191
00192
00193 *info = 0;
00194 left = lsame_(side, "L");
00195 notran = lsame_(trans, "N");
00196 lquery = *lwork == -1;
00197
00198
00199
00200 if (left) {
00201 nq = *m;
00202 nw = max(1,*n);
00203 } else {
00204 nq = *n;
00205 nw = max(1,*m);
00206 }
00207 if (! left && ! lsame_(side, "R")) {
00208 *info = -1;
00209 } else if (! notran && ! lsame_(trans, "C")) {
00210 *info = -2;
00211 } else if (*m < 0) {
00212 *info = -3;
00213 } else if (*n < 0) {
00214 *info = -4;
00215 } else if (*k < 0 || *k > nq) {
00216 *info = -5;
00217 } else if (*l < 0 || left && *l > *m || ! left && *l > *n) {
00218 *info = -6;
00219 } else if (*lda < max(1,*k)) {
00220 *info = -8;
00221 } else if (*ldc < max(1,*m)) {
00222 *info = -11;
00223 }
00224
00225 if (*info == 0) {
00226 if (*m == 0 || *n == 0) {
00227 lwkopt = 1;
00228 } else {
00229
00230
00231
00232
00233
00234
00235 i__3[0] = 1, a__1[0] = side;
00236 i__3[1] = 1, a__1[1] = trans;
00237 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)2);
00238 i__1 = 64, i__2 = ilaenv_(&c__1, "CUNMRQ", ch__1, m, n, k, &c_n1);
00239 nb = min(i__1,i__2);
00240 lwkopt = nw * nb;
00241 }
00242 work[1].r = (real) lwkopt, work[1].i = 0.f;
00243
00244 if (*lwork < max(1,nw) && ! lquery) {
00245 *info = -13;
00246 }
00247 }
00248
00249 if (*info != 0) {
00250 i__1 = -(*info);
00251 xerbla_("CUNMRZ", &i__1);
00252 return 0;
00253 } else if (lquery) {
00254 return 0;
00255 }
00256
00257
00258
00259 if (*m == 0 || *n == 0) {
00260 return 0;
00261 }
00262
00263
00264
00265
00266
00267
00268 i__3[0] = 1, a__1[0] = side;
00269 i__3[1] = 1, a__1[1] = trans;
00270 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)2);
00271 i__1 = 64, i__2 = ilaenv_(&c__1, "CUNMRQ", ch__1, m, n, k, &c_n1);
00272 nb = min(i__1,i__2);
00273 nbmin = 2;
00274 ldwork = nw;
00275 if (nb > 1 && nb < *k) {
00276 iws = nw * nb;
00277 if (*lwork < iws) {
00278 nb = *lwork / ldwork;
00279
00280
00281 i__3[0] = 1, a__1[0] = side;
00282 i__3[1] = 1, a__1[1] = trans;
00283 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)2);
00284 i__1 = 2, i__2 = ilaenv_(&c__2, "CUNMRQ", ch__1, m, n, k, &c_n1);
00285 nbmin = max(i__1,i__2);
00286 }
00287 } else {
00288 iws = nw;
00289 }
00290
00291 if (nb < nbmin || nb >= *k) {
00292
00293
00294
00295 cunmr3_(side, trans, m, n, k, l, &a[a_offset], lda, &tau[1], &c__[
00296 c_offset], ldc, &work[1], &iinfo);
00297 } else {
00298
00299
00300
00301 if (left && ! notran || ! left && notran) {
00302 i1 = 1;
00303 i2 = *k;
00304 i3 = nb;
00305 } else {
00306 i1 = (*k - 1) / nb * nb + 1;
00307 i2 = 1;
00308 i3 = -nb;
00309 }
00310
00311 if (left) {
00312 ni = *n;
00313 jc = 1;
00314 ja = *m - *l + 1;
00315 } else {
00316 mi = *m;
00317 ic = 1;
00318 ja = *n - *l + 1;
00319 }
00320
00321 if (notran) {
00322 *(unsigned char *)transt = 'C';
00323 } else {
00324 *(unsigned char *)transt = 'N';
00325 }
00326
00327 i__1 = i2;
00328 i__2 = i3;
00329 for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00330
00331 i__4 = nb, i__5 = *k - i__ + 1;
00332 ib = min(i__4,i__5);
00333
00334
00335
00336
00337 clarzt_("Backward", "Rowwise", l, &ib, &a[i__ + ja * a_dim1], lda,
00338 &tau[i__], t, &c__65);
00339
00340 if (left) {
00341
00342
00343
00344 mi = *m - i__ + 1;
00345 ic = i__;
00346 } else {
00347
00348
00349
00350 ni = *n - i__ + 1;
00351 jc = i__;
00352 }
00353
00354
00355
00356 clarzb_(side, transt, "Backward", "Rowwise", &mi, &ni, &ib, l, &a[
00357 i__ + ja * a_dim1], lda, t, &c__65, &c__[ic + jc * c_dim1]
00358 , ldc, &work[1], &ldwork);
00359
00360 }
00361
00362 }
00363
00364 work[1].r = (real) lwkopt, work[1].i = 0.f;
00365
00366 return 0;
00367
00368
00369
00370 }