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 cunmtr_(char *side, char *uplo, char *trans, integer *m,
00023 integer *n, complex *a, integer *lda, complex *tau, complex *c__,
00024 integer *ldc, complex *work, integer *lwork, integer *info)
00025 {
00026
00027 address a__1[2];
00028 integer a_dim1, a_offset, c_dim1, c_offset, i__1[2], i__2, i__3;
00029 char ch__1[2];
00030
00031
00032 int s_cat(char *, char **, integer *, integer *, ftnlen);
00033
00034
00035 integer i1, i2, nb, mi, ni, nq, nw;
00036 logical left;
00037 extern logical lsame_(char *, char *);
00038 integer iinfo;
00039 logical upper;
00040 extern int xerbla_(char *, integer *);
00041 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00042 integer *, integer *);
00043 extern int cunmql_(char *, char *, integer *, integer *,
00044 integer *, complex *, integer *, complex *, complex *, integer *,
00045 complex *, integer *, integer *), cunmqr_(char *,
00046 char *, integer *, integer *, integer *, complex *, integer *,
00047 complex *, complex *, integer *, complex *, integer *, integer *);
00048 integer lwkopt;
00049 logical lquery;
00050
00051
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 a_dim1 = *lda;
00160 a_offset = 1 + a_dim1;
00161 a -= a_offset;
00162 --tau;
00163 c_dim1 = *ldc;
00164 c_offset = 1 + c_dim1;
00165 c__ -= c_offset;
00166 --work;
00167
00168
00169 *info = 0;
00170 left = lsame_(side, "L");
00171 upper = lsame_(uplo, "U");
00172 lquery = *lwork == -1;
00173
00174
00175
00176 if (left) {
00177 nq = *m;
00178 nw = *n;
00179 } else {
00180 nq = *n;
00181 nw = *m;
00182 }
00183 if (! left && ! lsame_(side, "R")) {
00184 *info = -1;
00185 } else if (! upper && ! lsame_(uplo, "L")) {
00186 *info = -2;
00187 } else if (! lsame_(trans, "N") && ! lsame_(trans,
00188 "C")) {
00189 *info = -3;
00190 } else if (*m < 0) {
00191 *info = -4;
00192 } else if (*n < 0) {
00193 *info = -5;
00194 } else if (*lda < max(1,nq)) {
00195 *info = -7;
00196 } else if (*ldc < max(1,*m)) {
00197 *info = -10;
00198 } else if (*lwork < max(1,nw) && ! lquery) {
00199 *info = -12;
00200 }
00201
00202 if (*info == 0) {
00203 if (upper) {
00204 if (left) {
00205
00206 i__1[0] = 1, a__1[0] = side;
00207 i__1[1] = 1, a__1[1] = trans;
00208 s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2);
00209 i__2 = *m - 1;
00210 i__3 = *m - 1;
00211 nb = ilaenv_(&c__1, "CUNMQL", ch__1, &i__2, n, &i__3, &c_n1);
00212 } else {
00213
00214 i__1[0] = 1, a__1[0] = side;
00215 i__1[1] = 1, a__1[1] = trans;
00216 s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2);
00217 i__2 = *n - 1;
00218 i__3 = *n - 1;
00219 nb = ilaenv_(&c__1, "CUNMQL", ch__1, m, &i__2, &i__3, &c_n1);
00220 }
00221 } else {
00222 if (left) {
00223
00224 i__1[0] = 1, a__1[0] = side;
00225 i__1[1] = 1, a__1[1] = trans;
00226 s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2);
00227 i__2 = *m - 1;
00228 i__3 = *m - 1;
00229 nb = ilaenv_(&c__1, "CUNMQR", ch__1, &i__2, n, &i__3, &c_n1);
00230 } else {
00231
00232 i__1[0] = 1, a__1[0] = side;
00233 i__1[1] = 1, a__1[1] = trans;
00234 s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2);
00235 i__2 = *n - 1;
00236 i__3 = *n - 1;
00237 nb = ilaenv_(&c__1, "CUNMQR", ch__1, m, &i__2, &i__3, &c_n1);
00238 }
00239 }
00240 lwkopt = max(1,nw) * nb;
00241 work[1].r = (real) lwkopt, work[1].i = 0.f;
00242 }
00243
00244 if (*info != 0) {
00245 i__2 = -(*info);
00246 xerbla_("CUNMTR", &i__2);
00247 return 0;
00248 } else if (lquery) {
00249 return 0;
00250 }
00251
00252
00253
00254 if (*m == 0 || *n == 0 || nq == 1) {
00255 work[1].r = 1.f, work[1].i = 0.f;
00256 return 0;
00257 }
00258
00259 if (left) {
00260 mi = *m - 1;
00261 ni = *n;
00262 } else {
00263 mi = *m;
00264 ni = *n - 1;
00265 }
00266
00267 if (upper) {
00268
00269
00270
00271 i__2 = nq - 1;
00272 cunmql_(side, trans, &mi, &ni, &i__2, &a[(a_dim1 << 1) + 1], lda, &
00273 tau[1], &c__[c_offset], ldc, &work[1], lwork, &iinfo);
00274 } else {
00275
00276
00277
00278 if (left) {
00279 i1 = 2;
00280 i2 = 1;
00281 } else {
00282 i1 = 1;
00283 i2 = 2;
00284 }
00285 i__2 = nq - 1;
00286 cunmqr_(side, trans, &mi, &ni, &i__2, &a[a_dim1 + 2], lda, &tau[1], &
00287 c__[i1 + i2 * c_dim1], ldc, &work[1], lwork, &iinfo);
00288 }
00289 work[1].r = (real) lwkopt, work[1].i = 0.f;
00290 return 0;
00291
00292
00293
00294 }