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
00022 int cunmbr_(char *vect, char *side, char *trans, integer *m,
00023 integer *n, integer *k, complex *a, integer *lda, complex *tau,
00024 complex *c__, integer *ldc, complex *work, integer *lwork, integer *
00025 info)
00026 {
00027
00028 address a__1[2];
00029 integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3[2];
00030 char ch__1[2];
00031
00032
00033 int s_cat(char *, char **, integer *, integer *, ftnlen);
00034
00035
00036 integer i1, i2, nb, mi, ni, nq, nw;
00037 logical left;
00038 extern logical lsame_(char *, char *);
00039 integer iinfo;
00040 extern int xerbla_(char *, integer *);
00041 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00042 integer *, integer *);
00043 extern int cunmlq_(char *, char *, integer *, integer *,
00044 integer *, complex *, integer *, complex *, complex *, integer *,
00045 complex *, integer *, integer *);
00046 logical notran;
00047 extern int cunmqr_(char *, char *, integer *, integer *,
00048 integer *, complex *, integer *, complex *, complex *, integer *,
00049 complex *, integer *, integer *);
00050 logical applyq;
00051 char transt[1];
00052 integer lwkopt;
00053 logical lquery;
00054
00055
00056
00057
00058
00059
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
00184
00185 a_dim1 = *lda;
00186 a_offset = 1 + a_dim1;
00187 a -= a_offset;
00188 --tau;
00189 c_dim1 = *ldc;
00190 c_offset = 1 + c_dim1;
00191 c__ -= c_offset;
00192 --work;
00193
00194
00195 *info = 0;
00196 applyq = lsame_(vect, "Q");
00197 left = lsame_(side, "L");
00198 notran = lsame_(trans, "N");
00199 lquery = *lwork == -1;
00200
00201
00202
00203 if (left) {
00204 nq = *m;
00205 nw = *n;
00206 } else {
00207 nq = *n;
00208 nw = *m;
00209 }
00210 if (*m == 0 || *n == 0) {
00211 nw = 0;
00212 }
00213 if (! applyq && ! lsame_(vect, "P")) {
00214 *info = -1;
00215 } else if (! left && ! lsame_(side, "R")) {
00216 *info = -2;
00217 } else if (! notran && ! lsame_(trans, "C")) {
00218 *info = -3;
00219 } else if (*m < 0) {
00220 *info = -4;
00221 } else if (*n < 0) {
00222 *info = -5;
00223 } else if (*k < 0) {
00224 *info = -6;
00225 } else {
00226
00227 i__1 = 1, i__2 = min(nq,*k);
00228 if (applyq && *lda < max(1,nq) || ! applyq && *lda < max(i__1,i__2)) {
00229 *info = -8;
00230 } else if (*ldc < max(1,*m)) {
00231 *info = -11;
00232 } else if (*lwork < max(1,nw) && ! lquery) {
00233 *info = -13;
00234 }
00235 }
00236
00237 if (*info == 0) {
00238 if (nw > 0) {
00239 if (applyq) {
00240 if (left) {
00241
00242 i__3[0] = 1, a__1[0] = side;
00243 i__3[1] = 1, a__1[1] = trans;
00244 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)2);
00245 i__1 = *m - 1;
00246 i__2 = *m - 1;
00247 nb = ilaenv_(&c__1, "CUNMQR", ch__1, &i__1, n, &i__2, &
00248 c_n1);
00249 } else {
00250
00251 i__3[0] = 1, a__1[0] = side;
00252 i__3[1] = 1, a__1[1] = trans;
00253 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)2);
00254 i__1 = *n - 1;
00255 i__2 = *n - 1;
00256 nb = ilaenv_(&c__1, "CUNMQR", ch__1, m, &i__1, &i__2, &
00257 c_n1);
00258 }
00259 } else {
00260 if (left) {
00261
00262 i__3[0] = 1, a__1[0] = side;
00263 i__3[1] = 1, a__1[1] = trans;
00264 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)2);
00265 i__1 = *m - 1;
00266 i__2 = *m - 1;
00267 nb = ilaenv_(&c__1, "CUNMLQ", ch__1, &i__1, n, &i__2, &
00268 c_n1);
00269 } else {
00270
00271 i__3[0] = 1, a__1[0] = side;
00272 i__3[1] = 1, a__1[1] = trans;
00273 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)2);
00274 i__1 = *n - 1;
00275 i__2 = *n - 1;
00276 nb = ilaenv_(&c__1, "CUNMLQ", ch__1, m, &i__1, &i__2, &
00277 c_n1);
00278 }
00279 }
00280
00281 i__1 = 1, i__2 = nw * nb;
00282 lwkopt = max(i__1,i__2);
00283 } else {
00284 lwkopt = 1;
00285 }
00286 work[1].r = (real) lwkopt, work[1].i = 0.f;
00287 }
00288
00289 if (*info != 0) {
00290 i__1 = -(*info);
00291 xerbla_("CUNMBR", &i__1);
00292 return 0;
00293 } else if (lquery) {
00294 return 0;
00295 }
00296
00297
00298
00299 if (*m == 0 || *n == 0) {
00300 return 0;
00301 }
00302
00303 if (applyq) {
00304
00305
00306
00307 if (nq >= *k) {
00308
00309
00310
00311 cunmqr_(side, trans, m, n, k, &a[a_offset], lda, &tau[1], &c__[
00312 c_offset], ldc, &work[1], lwork, &iinfo);
00313 } else if (nq > 1) {
00314
00315
00316
00317 if (left) {
00318 mi = *m - 1;
00319 ni = *n;
00320 i1 = 2;
00321 i2 = 1;
00322 } else {
00323 mi = *m;
00324 ni = *n - 1;
00325 i1 = 1;
00326 i2 = 2;
00327 }
00328 i__1 = nq - 1;
00329 cunmqr_(side, trans, &mi, &ni, &i__1, &a[a_dim1 + 2], lda, &tau[1]
00330 , &c__[i1 + i2 * c_dim1], ldc, &work[1], lwork, &iinfo);
00331 }
00332 } else {
00333
00334
00335
00336 if (notran) {
00337 *(unsigned char *)transt = 'C';
00338 } else {
00339 *(unsigned char *)transt = 'N';
00340 }
00341 if (nq > *k) {
00342
00343
00344
00345 cunmlq_(side, transt, m, n, k, &a[a_offset], lda, &tau[1], &c__[
00346 c_offset], ldc, &work[1], lwork, &iinfo);
00347 } else if (nq > 1) {
00348
00349
00350
00351 if (left) {
00352 mi = *m - 1;
00353 ni = *n;
00354 i1 = 2;
00355 i2 = 1;
00356 } else {
00357 mi = *m;
00358 ni = *n - 1;
00359 i1 = 1;
00360 i2 = 2;
00361 }
00362 i__1 = nq - 1;
00363 cunmlq_(side, transt, &mi, &ni, &i__1, &a[(a_dim1 << 1) + 1], lda,
00364 &tau[1], &c__[i1 + i2 * c_dim1], ldc, &work[1], lwork, &
00365 iinfo);
00366 }
00367 }
00368 work[1].r = (real) lwkopt, work[1].i = 0.f;
00369 return 0;
00370
00371
00372
00373 }