00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int dlasr_(char *side, char *pivot, char *direct, integer *m,
00017 integer *n, doublereal *c__, doublereal *s, doublereal *a, integer *
00018 lda)
00019 {
00020
00021 integer a_dim1, a_offset, i__1, i__2;
00022
00023
00024 integer i__, j, info;
00025 doublereal temp;
00026 extern logical lsame_(char *, char *);
00027 doublereal ctemp, stemp;
00028 extern int xerbla_(char *, integer *);
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
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
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 --c__;
00183 --s;
00184 a_dim1 = *lda;
00185 a_offset = 1 + a_dim1;
00186 a -= a_offset;
00187
00188
00189 info = 0;
00190 if (! (lsame_(side, "L") || lsame_(side, "R"))) {
00191 info = 1;
00192 } else if (! (lsame_(pivot, "V") || lsame_(pivot,
00193 "T") || lsame_(pivot, "B"))) {
00194 info = 2;
00195 } else if (! (lsame_(direct, "F") || lsame_(direct,
00196 "B"))) {
00197 info = 3;
00198 } else if (*m < 0) {
00199 info = 4;
00200 } else if (*n < 0) {
00201 info = 5;
00202 } else if (*lda < max(1,*m)) {
00203 info = 9;
00204 }
00205 if (info != 0) {
00206 xerbla_("DLASR ", &info);
00207 return 0;
00208 }
00209
00210
00211
00212 if (*m == 0 || *n == 0) {
00213 return 0;
00214 }
00215 if (lsame_(side, "L")) {
00216
00217
00218
00219 if (lsame_(pivot, "V")) {
00220 if (lsame_(direct, "F")) {
00221 i__1 = *m - 1;
00222 for (j = 1; j <= i__1; ++j) {
00223 ctemp = c__[j];
00224 stemp = s[j];
00225 if (ctemp != 1. || stemp != 0.) {
00226 i__2 = *n;
00227 for (i__ = 1; i__ <= i__2; ++i__) {
00228 temp = a[j + 1 + i__ * a_dim1];
00229 a[j + 1 + i__ * a_dim1] = ctemp * temp - stemp *
00230 a[j + i__ * a_dim1];
00231 a[j + i__ * a_dim1] = stemp * temp + ctemp * a[j
00232 + i__ * a_dim1];
00233
00234 }
00235 }
00236
00237 }
00238 } else if (lsame_(direct, "B")) {
00239 for (j = *m - 1; j >= 1; --j) {
00240 ctemp = c__[j];
00241 stemp = s[j];
00242 if (ctemp != 1. || stemp != 0.) {
00243 i__1 = *n;
00244 for (i__ = 1; i__ <= i__1; ++i__) {
00245 temp = a[j + 1 + i__ * a_dim1];
00246 a[j + 1 + i__ * a_dim1] = ctemp * temp - stemp *
00247 a[j + i__ * a_dim1];
00248 a[j + i__ * a_dim1] = stemp * temp + ctemp * a[j
00249 + i__ * a_dim1];
00250
00251 }
00252 }
00253
00254 }
00255 }
00256 } else if (lsame_(pivot, "T")) {
00257 if (lsame_(direct, "F")) {
00258 i__1 = *m;
00259 for (j = 2; j <= i__1; ++j) {
00260 ctemp = c__[j - 1];
00261 stemp = s[j - 1];
00262 if (ctemp != 1. || stemp != 0.) {
00263 i__2 = *n;
00264 for (i__ = 1; i__ <= i__2; ++i__) {
00265 temp = a[j + i__ * a_dim1];
00266 a[j + i__ * a_dim1] = ctemp * temp - stemp * a[
00267 i__ * a_dim1 + 1];
00268 a[i__ * a_dim1 + 1] = stemp * temp + ctemp * a[
00269 i__ * a_dim1 + 1];
00270
00271 }
00272 }
00273
00274 }
00275 } else if (lsame_(direct, "B")) {
00276 for (j = *m; j >= 2; --j) {
00277 ctemp = c__[j - 1];
00278 stemp = s[j - 1];
00279 if (ctemp != 1. || stemp != 0.) {
00280 i__1 = *n;
00281 for (i__ = 1; i__ <= i__1; ++i__) {
00282 temp = a[j + i__ * a_dim1];
00283 a[j + i__ * a_dim1] = ctemp * temp - stemp * a[
00284 i__ * a_dim1 + 1];
00285 a[i__ * a_dim1 + 1] = stemp * temp + ctemp * a[
00286 i__ * a_dim1 + 1];
00287
00288 }
00289 }
00290
00291 }
00292 }
00293 } else if (lsame_(pivot, "B")) {
00294 if (lsame_(direct, "F")) {
00295 i__1 = *m - 1;
00296 for (j = 1; j <= i__1; ++j) {
00297 ctemp = c__[j];
00298 stemp = s[j];
00299 if (ctemp != 1. || stemp != 0.) {
00300 i__2 = *n;
00301 for (i__ = 1; i__ <= i__2; ++i__) {
00302 temp = a[j + i__ * a_dim1];
00303 a[j + i__ * a_dim1] = stemp * a[*m + i__ * a_dim1]
00304 + ctemp * temp;
00305 a[*m + i__ * a_dim1] = ctemp * a[*m + i__ *
00306 a_dim1] - stemp * temp;
00307
00308 }
00309 }
00310
00311 }
00312 } else if (lsame_(direct, "B")) {
00313 for (j = *m - 1; j >= 1; --j) {
00314 ctemp = c__[j];
00315 stemp = s[j];
00316 if (ctemp != 1. || stemp != 0.) {
00317 i__1 = *n;
00318 for (i__ = 1; i__ <= i__1; ++i__) {
00319 temp = a[j + i__ * a_dim1];
00320 a[j + i__ * a_dim1] = stemp * a[*m + i__ * a_dim1]
00321 + ctemp * temp;
00322 a[*m + i__ * a_dim1] = ctemp * a[*m + i__ *
00323 a_dim1] - stemp * temp;
00324
00325 }
00326 }
00327
00328 }
00329 }
00330 }
00331 } else if (lsame_(side, "R")) {
00332
00333
00334
00335 if (lsame_(pivot, "V")) {
00336 if (lsame_(direct, "F")) {
00337 i__1 = *n - 1;
00338 for (j = 1; j <= i__1; ++j) {
00339 ctemp = c__[j];
00340 stemp = s[j];
00341 if (ctemp != 1. || stemp != 0.) {
00342 i__2 = *m;
00343 for (i__ = 1; i__ <= i__2; ++i__) {
00344 temp = a[i__ + (j + 1) * a_dim1];
00345 a[i__ + (j + 1) * a_dim1] = ctemp * temp - stemp *
00346 a[i__ + j * a_dim1];
00347 a[i__ + j * a_dim1] = stemp * temp + ctemp * a[
00348 i__ + j * a_dim1];
00349
00350 }
00351 }
00352
00353 }
00354 } else if (lsame_(direct, "B")) {
00355 for (j = *n - 1; j >= 1; --j) {
00356 ctemp = c__[j];
00357 stemp = s[j];
00358 if (ctemp != 1. || stemp != 0.) {
00359 i__1 = *m;
00360 for (i__ = 1; i__ <= i__1; ++i__) {
00361 temp = a[i__ + (j + 1) * a_dim1];
00362 a[i__ + (j + 1) * a_dim1] = ctemp * temp - stemp *
00363 a[i__ + j * a_dim1];
00364 a[i__ + j * a_dim1] = stemp * temp + ctemp * a[
00365 i__ + j * a_dim1];
00366
00367 }
00368 }
00369
00370 }
00371 }
00372 } else if (lsame_(pivot, "T")) {
00373 if (lsame_(direct, "F")) {
00374 i__1 = *n;
00375 for (j = 2; j <= i__1; ++j) {
00376 ctemp = c__[j - 1];
00377 stemp = s[j - 1];
00378 if (ctemp != 1. || stemp != 0.) {
00379 i__2 = *m;
00380 for (i__ = 1; i__ <= i__2; ++i__) {
00381 temp = a[i__ + j * a_dim1];
00382 a[i__ + j * a_dim1] = ctemp * temp - stemp * a[
00383 i__ + a_dim1];
00384 a[i__ + a_dim1] = stemp * temp + ctemp * a[i__ +
00385 a_dim1];
00386
00387 }
00388 }
00389
00390 }
00391 } else if (lsame_(direct, "B")) {
00392 for (j = *n; j >= 2; --j) {
00393 ctemp = c__[j - 1];
00394 stemp = s[j - 1];
00395 if (ctemp != 1. || stemp != 0.) {
00396 i__1 = *m;
00397 for (i__ = 1; i__ <= i__1; ++i__) {
00398 temp = a[i__ + j * a_dim1];
00399 a[i__ + j * a_dim1] = ctemp * temp - stemp * a[
00400 i__ + a_dim1];
00401 a[i__ + a_dim1] = stemp * temp + ctemp * a[i__ +
00402 a_dim1];
00403
00404 }
00405 }
00406
00407 }
00408 }
00409 } else if (lsame_(pivot, "B")) {
00410 if (lsame_(direct, "F")) {
00411 i__1 = *n - 1;
00412 for (j = 1; j <= i__1; ++j) {
00413 ctemp = c__[j];
00414 stemp = s[j];
00415 if (ctemp != 1. || stemp != 0.) {
00416 i__2 = *m;
00417 for (i__ = 1; i__ <= i__2; ++i__) {
00418 temp = a[i__ + j * a_dim1];
00419 a[i__ + j * a_dim1] = stemp * a[i__ + *n * a_dim1]
00420 + ctemp * temp;
00421 a[i__ + *n * a_dim1] = ctemp * a[i__ + *n *
00422 a_dim1] - stemp * temp;
00423
00424 }
00425 }
00426
00427 }
00428 } else if (lsame_(direct, "B")) {
00429 for (j = *n - 1; j >= 1; --j) {
00430 ctemp = c__[j];
00431 stemp = s[j];
00432 if (ctemp != 1. || stemp != 0.) {
00433 i__1 = *m;
00434 for (i__ = 1; i__ <= i__1; ++i__) {
00435 temp = a[i__ + j * a_dim1];
00436 a[i__ + j * a_dim1] = stemp * a[i__ + *n * a_dim1]
00437 + ctemp * temp;
00438 a[i__ + *n * a_dim1] = ctemp * a[i__ + *n *
00439 a_dim1] - stemp * temp;
00440
00441 }
00442 }
00443
00444 }
00445 }
00446 }
00447 }
00448
00449 return 0;
00450
00451
00452
00453 }