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