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