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