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 doublereal c_b8 = 0.;
00020
00021 int dlarft_(char *direct, char *storev, integer *n, integer *
00022 k, doublereal *v, integer *ldv, doublereal *tau, doublereal *t,
00023 integer *ldt)
00024 {
00025
00026 integer t_dim1, t_offset, v_dim1, v_offset, i__1, i__2, i__3;
00027 doublereal d__1;
00028
00029
00030 integer i__, j, prevlastv;
00031 doublereal vii;
00032 extern logical lsame_(char *, char *);
00033 extern int dgemv_(char *, integer *, integer *,
00034 doublereal *, doublereal *, integer *, doublereal *, integer *,
00035 doublereal *, doublereal *, integer *);
00036 integer lastv;
00037 extern int dtrmv_(char *, char *, char *, integer *,
00038 doublereal *, integer *, doublereal *, integer *);
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
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 v_dim1 = *ldv;
00154 v_offset = 1 + v_dim1;
00155 v -= v_offset;
00156 --tau;
00157 t_dim1 = *ldt;
00158 t_offset = 1 + t_dim1;
00159 t -= t_offset;
00160
00161
00162 if (*n == 0) {
00163 return 0;
00164 }
00165
00166 if (lsame_(direct, "F")) {
00167 prevlastv = *n;
00168 i__1 = *k;
00169 for (i__ = 1; i__ <= i__1; ++i__) {
00170 prevlastv = max(i__,prevlastv);
00171 if (tau[i__] == 0.) {
00172
00173
00174
00175 i__2 = i__;
00176 for (j = 1; j <= i__2; ++j) {
00177 t[j + i__ * t_dim1] = 0.;
00178
00179 }
00180 } else {
00181
00182
00183
00184 vii = v[i__ + i__ * v_dim1];
00185 v[i__ + i__ * v_dim1] = 1.;
00186 if (lsame_(storev, "C")) {
00187
00188 i__2 = i__ + 1;
00189 for (lastv = *n; lastv >= i__2; --lastv) {
00190 if (v[lastv + i__ * v_dim1] != 0.) {
00191 break;
00192 }
00193 }
00194 j = min(lastv,prevlastv);
00195
00196
00197
00198 i__2 = j - i__ + 1;
00199 i__3 = i__ - 1;
00200 d__1 = -tau[i__];
00201 dgemv_("Transpose", &i__2, &i__3, &d__1, &v[i__ + v_dim1],
00202 ldv, &v[i__ + i__ * v_dim1], &c__1, &c_b8, &t[
00203 i__ * t_dim1 + 1], &c__1);
00204 } else {
00205
00206 i__2 = i__ + 1;
00207 for (lastv = *n; lastv >= i__2; --lastv) {
00208 if (v[i__ + lastv * v_dim1] != 0.) {
00209 break;
00210 }
00211 }
00212 j = min(lastv,prevlastv);
00213
00214
00215
00216 i__2 = i__ - 1;
00217 i__3 = j - i__ + 1;
00218 d__1 = -tau[i__];
00219 dgemv_("No transpose", &i__2, &i__3, &d__1, &v[i__ *
00220 v_dim1 + 1], ldv, &v[i__ + i__ * v_dim1], ldv, &
00221 c_b8, &t[i__ * t_dim1 + 1], &c__1);
00222 }
00223 v[i__ + i__ * v_dim1] = vii;
00224
00225
00226
00227 i__2 = i__ - 1;
00228 dtrmv_("Upper", "No transpose", "Non-unit", &i__2, &t[
00229 t_offset], ldt, &t[i__ * t_dim1 + 1], &c__1);
00230 t[i__ + i__ * t_dim1] = tau[i__];
00231 if (i__ > 1) {
00232 prevlastv = max(prevlastv,lastv);
00233 } else {
00234 prevlastv = lastv;
00235 }
00236 }
00237
00238 }
00239 } else {
00240 prevlastv = 1;
00241 for (i__ = *k; i__ >= 1; --i__) {
00242 if (tau[i__] == 0.) {
00243
00244
00245
00246 i__1 = *k;
00247 for (j = i__; j <= i__1; ++j) {
00248 t[j + i__ * t_dim1] = 0.;
00249
00250 }
00251 } else {
00252
00253
00254
00255 if (i__ < *k) {
00256 if (lsame_(storev, "C")) {
00257 vii = v[*n - *k + i__ + i__ * v_dim1];
00258 v[*n - *k + i__ + i__ * v_dim1] = 1.;
00259
00260 i__1 = i__ - 1;
00261 for (lastv = 1; lastv <= i__1; ++lastv) {
00262 if (v[lastv + i__ * v_dim1] != 0.) {
00263 break;
00264 }
00265 }
00266 j = max(lastv,prevlastv);
00267
00268
00269
00270
00271 i__1 = *n - *k + i__ - j + 1;
00272 i__2 = *k - i__;
00273 d__1 = -tau[i__];
00274 dgemv_("Transpose", &i__1, &i__2, &d__1, &v[j + (i__
00275 + 1) * v_dim1], ldv, &v[j + i__ * v_dim1], &
00276 c__1, &c_b8, &t[i__ + 1 + i__ * t_dim1], &
00277 c__1);
00278 v[*n - *k + i__ + i__ * v_dim1] = vii;
00279 } else {
00280 vii = v[i__ + (*n - *k + i__) * v_dim1];
00281 v[i__ + (*n - *k + i__) * v_dim1] = 1.;
00282
00283 i__1 = i__ - 1;
00284 for (lastv = 1; lastv <= i__1; ++lastv) {
00285 if (v[i__ + lastv * v_dim1] != 0.) {
00286 break;
00287 }
00288 }
00289 j = max(lastv,prevlastv);
00290
00291
00292
00293
00294 i__1 = *k - i__;
00295 i__2 = *n - *k + i__ - j + 1;
00296 d__1 = -tau[i__];
00297 dgemv_("No transpose", &i__1, &i__2, &d__1, &v[i__ +
00298 1 + j * v_dim1], ldv, &v[i__ + j * v_dim1],
00299 ldv, &c_b8, &t[i__ + 1 + i__ * t_dim1], &c__1);
00300 v[i__ + (*n - *k + i__) * v_dim1] = vii;
00301 }
00302
00303
00304
00305 i__1 = *k - i__;
00306 dtrmv_("Lower", "No transpose", "Non-unit", &i__1, &t[i__
00307 + 1 + (i__ + 1) * t_dim1], ldt, &t[i__ + 1 + i__ *
00308 t_dim1], &c__1)
00309 ;
00310 if (i__ > 1) {
00311 prevlastv = min(prevlastv,lastv);
00312 } else {
00313 prevlastv = lastv;
00314 }
00315 }
00316 t[i__ + i__ * t_dim1] = tau[i__];
00317 }
00318
00319 }
00320 }
00321 return 0;
00322
00323
00324
00325 }