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__2 = 2;
00019 static real c_b32 = 1.f;
00020 static real c_b33 = 0.f;
00021 static integer c__1 = 1;
00022
00023 int slarhs_(char *path, char *xtype, char *uplo, char *trans,
00024 integer *m, integer *n, integer *kl, integer *ku, integer *nrhs,
00025 real *a, integer *lda, real *x, integer *ldx, real *b, integer *ldb,
00026 integer *iseed, integer *info)
00027 {
00028
00029 integer a_dim1, a_offset, b_dim1, b_offset, x_dim1, x_offset, i__1;
00030
00031
00032 int s_copy(char *, char *, ftnlen, ftnlen);
00033
00034
00035 integer j;
00036 char c1[1], c2[2];
00037 integer mb, nx;
00038 logical gen, tri, qrs, sym, band;
00039 char diag[1];
00040 logical tran;
00041 extern logical lsame_(char *, char *);
00042 extern int sgemm_(char *, char *, integer *, integer *,
00043 integer *, real *, real *, integer *, real *, integer *, real *,
00044 real *, integer *), sgbmv_(char *, integer *,
00045 integer *, integer *, integer *, real *, real *, integer *, real *
00046 , integer *, real *, real *, integer *), ssbmv_(char *,
00047 integer *, integer *, real *, real *, integer *, real *, integer *
00048 , real *, real *, integer *), stbmv_(char *, char *, char
00049 *, integer *, integer *, real *, integer *, real *, integer *), strmm_(char *, char *, char *, char *,
00050 integer *, integer *, real *, real *, integer *, real *, integer *
00051 ), sspmv_(char *, integer *, real
00052 *, real *, real *, integer *, real *, real *, integer *),
00053 ssymm_(char *, char *, integer *, integer *, real *, real *,
00054 integer *, real *, integer *, real *, real *, integer *), stpmv_(char *, char *, char *, integer *, real *, real *,
00055 integer *), xerbla_(char *, integer *);
00056 extern logical lsamen_(integer *, char *, char *);
00057 extern int slacpy_(char *, integer *, integer *, real *,
00058 integer *, real *, integer *);
00059 logical notran;
00060 extern int slarnv_(integer *, integer *, integer *, real
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
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 a_dim1 = *lda;
00203 a_offset = 1 + a_dim1;
00204 a -= a_offset;
00205 x_dim1 = *ldx;
00206 x_offset = 1 + x_dim1;
00207 x -= x_offset;
00208 b_dim1 = *ldb;
00209 b_offset = 1 + b_dim1;
00210 b -= b_offset;
00211 --iseed;
00212
00213
00214 *info = 0;
00215 *(unsigned char *)c1 = *(unsigned char *)path;
00216 s_copy(c2, path + 1, (ftnlen)2, (ftnlen)2);
00217 tran = lsame_(trans, "T") || lsame_(trans, "C");
00218 notran = ! tran;
00219 gen = lsame_(path + 1, "G");
00220 qrs = lsame_(path + 1, "Q") || lsame_(path + 2,
00221 "Q");
00222 sym = lsame_(path + 1, "P") || lsame_(path + 1,
00223 "S");
00224 tri = lsame_(path + 1, "T");
00225 band = lsame_(path + 2, "B");
00226 if (! lsame_(c1, "Single precision")) {
00227 *info = -1;
00228 } else if (! (lsame_(xtype, "N") || lsame_(xtype,
00229 "C"))) {
00230 *info = -2;
00231 } else if ((sym || tri) && ! (lsame_(uplo, "U") ||
00232 lsame_(uplo, "L"))) {
00233 *info = -3;
00234 } else if ((gen || qrs) && ! (tran || lsame_(trans, "N"))) {
00235 *info = -4;
00236 } else if (*m < 0) {
00237 *info = -5;
00238 } else if (*n < 0) {
00239 *info = -6;
00240 } else if (band && *kl < 0) {
00241 *info = -7;
00242 } else if (band && *ku < 0) {
00243 *info = -8;
00244 } else if (*nrhs < 0) {
00245 *info = -9;
00246 } else if (! band && *lda < max(1,*m) || band && (sym || tri) && *lda < *
00247 kl + 1 || band && gen && *lda < *kl + *ku + 1) {
00248 *info = -11;
00249 } else if (notran && *ldx < max(1,*n) || tran && *ldx < max(1,*m)) {
00250 *info = -13;
00251 } else if (notran && *ldb < max(1,*m) || tran && *ldb < max(1,*n)) {
00252 *info = -15;
00253 }
00254 if (*info != 0) {
00255 i__1 = -(*info);
00256 xerbla_("SLARHS", &i__1);
00257 return 0;
00258 }
00259
00260
00261
00262 if (tran) {
00263 nx = *m;
00264 mb = *n;
00265 } else {
00266 nx = *n;
00267 mb = *m;
00268 }
00269 if (! lsame_(xtype, "C")) {
00270 i__1 = *nrhs;
00271 for (j = 1; j <= i__1; ++j) {
00272 slarnv_(&c__2, &iseed[1], n, &x[j * x_dim1 + 1]);
00273
00274 }
00275 }
00276
00277
00278
00279
00280 if (lsamen_(&c__2, c2, "GE") || lsamen_(&c__2, c2,
00281 "QR") || lsamen_(&c__2, c2, "LQ") || lsamen_(&c__2, c2, "QL") ||
00282 lsamen_(&c__2, c2, "RQ")) {
00283
00284
00285
00286 sgemm_(trans, "N", &mb, nrhs, &nx, &c_b32, &a[a_offset], lda, &x[
00287 x_offset], ldx, &c_b33, &b[b_offset], ldb);
00288
00289 } else if (lsamen_(&c__2, c2, "PO") || lsamen_(&
00290 c__2, c2, "SY")) {
00291
00292
00293
00294 ssymm_("Left", uplo, n, nrhs, &c_b32, &a[a_offset], lda, &x[x_offset],
00295 ldx, &c_b33, &b[b_offset], ldb);
00296
00297 } else if (lsamen_(&c__2, c2, "GB")) {
00298
00299
00300
00301 i__1 = *nrhs;
00302 for (j = 1; j <= i__1; ++j) {
00303 sgbmv_(trans, &mb, &nx, kl, ku, &c_b32, &a[a_offset], lda, &x[j *
00304 x_dim1 + 1], &c__1, &c_b33, &b[j * b_dim1 + 1], &c__1);
00305
00306 }
00307
00308 } else if (lsamen_(&c__2, c2, "PB")) {
00309
00310
00311
00312 i__1 = *nrhs;
00313 for (j = 1; j <= i__1; ++j) {
00314 ssbmv_(uplo, n, kl, &c_b32, &a[a_offset], lda, &x[j * x_dim1 + 1],
00315 &c__1, &c_b33, &b[j * b_dim1 + 1], &c__1);
00316
00317 }
00318
00319 } else if (lsamen_(&c__2, c2, "PP") || lsamen_(&
00320 c__2, c2, "SP")) {
00321
00322
00323
00324 i__1 = *nrhs;
00325 for (j = 1; j <= i__1; ++j) {
00326 sspmv_(uplo, n, &c_b32, &a[a_offset], &x[j * x_dim1 + 1], &c__1, &
00327 c_b33, &b[j * b_dim1 + 1], &c__1);
00328
00329 }
00330
00331 } else if (lsamen_(&c__2, c2, "TR")) {
00332
00333
00334
00335
00336
00337 slacpy_("Full", n, nrhs, &x[x_offset], ldx, &b[b_offset], ldb);
00338 if (*ku == 2) {
00339 *(unsigned char *)diag = 'U';
00340 } else {
00341 *(unsigned char *)diag = 'N';
00342 }
00343 strmm_("Left", uplo, trans, diag, n, nrhs, &c_b32, &a[a_offset], lda,
00344 &b[b_offset], ldb)
00345 ;
00346
00347 } else if (lsamen_(&c__2, c2, "TP")) {
00348
00349
00350
00351 slacpy_("Full", n, nrhs, &x[x_offset], ldx, &b[b_offset], ldb);
00352 if (*ku == 2) {
00353 *(unsigned char *)diag = 'U';
00354 } else {
00355 *(unsigned char *)diag = 'N';
00356 }
00357 i__1 = *nrhs;
00358 for (j = 1; j <= i__1; ++j) {
00359 stpmv_(uplo, trans, diag, n, &a[a_offset], &b[j * b_dim1 + 1], &
00360 c__1);
00361
00362 }
00363
00364 } else if (lsamen_(&c__2, c2, "TB")) {
00365
00366
00367
00368 slacpy_("Full", n, nrhs, &x[x_offset], ldx, &b[b_offset], ldb);
00369 if (*ku == 2) {
00370 *(unsigned char *)diag = 'U';
00371 } else {
00372 *(unsigned char *)diag = 'N';
00373 }
00374 i__1 = *nrhs;
00375 for (j = 1; j <= i__1; ++j) {
00376 stbmv_(uplo, trans, diag, n, kl, &a[a_offset], lda, &b[j * b_dim1
00377 + 1], &c__1);
00378
00379 }
00380
00381 } else {
00382
00383
00384
00385 *info = -1;
00386 i__1 = -(*info);
00387 xerbla_("SLARHS", &i__1);
00388 }
00389
00390 return 0;
00391
00392
00393
00394 }