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