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