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 doublecomplex c_b1 = {1.,0.};
00019 static doublecomplex c_b2 = {0.,0.};
00020 static integer c__2 = 2;
00021 static integer c__1 = 1;
00022
00023 int zlarhs_(char *path, char *xtype, char *uplo, char *trans,
00024 integer *m, integer *n, integer *kl, integer *ku, integer *nrhs,
00025 doublecomplex *a, integer *lda, doublecomplex *x, integer *ldx,
00026 doublecomplex *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 logical lsame_(char *, char *);
00042 extern int zgemm_(char *, char *, integer *, integer *,
00043 integer *, doublecomplex *, doublecomplex *, integer *,
00044 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00045 integer *), zhemm_(char *, char *, integer *,
00046 integer *, doublecomplex *, doublecomplex *, integer *,
00047 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00048 integer *), zgbmv_(char *, integer *, integer *,
00049 integer *, integer *, doublecomplex *, doublecomplex *, integer *,
00050 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00051 integer *), zhbmv_(char *, integer *, integer *,
00052 doublecomplex *, doublecomplex *, integer *, doublecomplex *,
00053 integer *, doublecomplex *, doublecomplex *, integer *),
00054 zsbmv_(char *, integer *, integer *, doublecomplex *,
00055 doublecomplex *, integer *, doublecomplex *, integer *,
00056 doublecomplex *, doublecomplex *, integer *), ztbmv_(char
00057 *, char *, char *, integer *, integer *, doublecomplex *, integer
00058 *, doublecomplex *, integer *), zhpmv_(
00059 char *, integer *, doublecomplex *, doublecomplex *,
00060 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00061 integer *), ztrmm_(char *, char *, char *, char *,
00062 integer *, integer *, doublecomplex *, doublecomplex *, integer *,
00063 doublecomplex *, integer *),
00064 zspmv_(char *, integer *, doublecomplex *, doublecomplex *,
00065 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00066 integer *), zsymm_(char *, char *, integer *, integer *,
00067 doublecomplex *, doublecomplex *, integer *, doublecomplex *,
00068 integer *, doublecomplex *, doublecomplex *, integer *), ztpmv_(char *, char *, char *, integer *, doublecomplex *
00069 , doublecomplex *, integer *), xerbla_(
00070 char *, integer *);
00071 extern logical lsamen_(integer *, char *, char *);
00072 logical notran;
00073 extern int zlacpy_(char *, integer *, integer *,
00074 doublecomplex *, integer *, doublecomplex *, integer *),
00075 zlarnv_(integer *, integer *, integer *, doublecomplex *);
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
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 a_dim1 = *lda;
00222 a_offset = 1 + a_dim1;
00223 a -= a_offset;
00224 x_dim1 = *ldx;
00225 x_offset = 1 + x_dim1;
00226 x -= x_offset;
00227 b_dim1 = *ldb;
00228 b_offset = 1 + b_dim1;
00229 b -= b_offset;
00230 --iseed;
00231
00232
00233 *info = 0;
00234 *(unsigned char *)c1 = *(unsigned char *)path;
00235 s_copy(c2, path + 1, (ftnlen)2, (ftnlen)2);
00236 tran = lsame_(trans, "T") || lsame_(trans, "C");
00237 notran = ! tran;
00238 gen = lsame_(path + 1, "G");
00239 qrs = lsame_(path + 1, "Q") || lsame_(path + 2,
00240 "Q");
00241 sym = lsame_(path + 1, "P") || lsame_(path + 1,
00242 "S") || lsame_(path + 1, "H");
00243 tri = lsame_(path + 1, "T");
00244 band = lsame_(path + 2, "B");
00245 if (! lsame_(c1, "Zomplex precision")) {
00246 *info = -1;
00247 } else if (! (lsame_(xtype, "N") || lsame_(xtype,
00248 "C"))) {
00249 *info = -2;
00250 } else if ((sym || tri) && ! (lsame_(uplo, "U") ||
00251 lsame_(uplo, "L"))) {
00252 *info = -3;
00253 } else if ((gen || qrs) && ! (tran || lsame_(trans, "N"))) {
00254 *info = -4;
00255 } else if (*m < 0) {
00256 *info = -5;
00257 } else if (*n < 0) {
00258 *info = -6;
00259 } else if (band && *kl < 0) {
00260 *info = -7;
00261 } else if (band && *ku < 0) {
00262 *info = -8;
00263 } else if (*nrhs < 0) {
00264 *info = -9;
00265 } else if (! band && *lda < max(1,*m) || band && (sym || tri) && *lda < *
00266 kl + 1 || band && gen && *lda < *kl + *ku + 1) {
00267 *info = -11;
00268 } else if (notran && *ldx < max(1,*n) || tran && *ldx < max(1,*m)) {
00269 *info = -13;
00270 } else if (notran && *ldb < max(1,*m) || tran && *ldb < max(1,*n)) {
00271 *info = -15;
00272 }
00273 if (*info != 0) {
00274 i__1 = -(*info);
00275 xerbla_("ZLARHS", &i__1);
00276 return 0;
00277 }
00278
00279
00280
00281 if (tran) {
00282 nx = *m;
00283 mb = *n;
00284 } else {
00285 nx = *n;
00286 mb = *m;
00287 }
00288 if (! lsame_(xtype, "C")) {
00289 i__1 = *nrhs;
00290 for (j = 1; j <= i__1; ++j) {
00291 zlarnv_(&c__2, &iseed[1], n, &x[j * x_dim1 + 1]);
00292
00293 }
00294 }
00295
00296
00297
00298
00299 if (lsamen_(&c__2, c2, "GE") || lsamen_(&c__2, c2,
00300 "QR") || lsamen_(&c__2, c2, "LQ") || lsamen_(&c__2, c2, "QL") ||
00301 lsamen_(&c__2, c2, "RQ")) {
00302
00303
00304
00305 zgemm_(trans, "N", &mb, nrhs, &nx, &c_b1, &a[a_offset], lda, &x[
00306 x_offset], ldx, &c_b2, &b[b_offset], ldb);
00307
00308 } else if (lsamen_(&c__2, c2, "PO") || lsamen_(&
00309 c__2, c2, "HE")) {
00310
00311
00312
00313 zhemm_("Left", uplo, n, nrhs, &c_b1, &a[a_offset], lda, &x[x_offset],
00314 ldx, &c_b2, &b[b_offset], ldb);
00315
00316 } else if (lsamen_(&c__2, c2, "SY")) {
00317
00318
00319
00320 zsymm_("Left", uplo, n, nrhs, &c_b1, &a[a_offset], lda, &x[x_offset],
00321 ldx, &c_b2, &b[b_offset], ldb);
00322
00323 } else if (lsamen_(&c__2, c2, "GB")) {
00324
00325
00326
00327 i__1 = *nrhs;
00328 for (j = 1; j <= i__1; ++j) {
00329 zgbmv_(trans, m, n, kl, ku, &c_b1, &a[a_offset], lda, &x[j *
00330 x_dim1 + 1], &c__1, &c_b2, &b[j * b_dim1 + 1], &c__1);
00331
00332 }
00333
00334 } else if (lsamen_(&c__2, c2, "PB") || lsamen_(&
00335 c__2, c2, "HB")) {
00336
00337
00338
00339 i__1 = *nrhs;
00340 for (j = 1; j <= i__1; ++j) {
00341 zhbmv_(uplo, n, kl, &c_b1, &a[a_offset], lda, &x[j * x_dim1 + 1],
00342 &c__1, &c_b2, &b[j * b_dim1 + 1], &c__1);
00343
00344 }
00345
00346 } else if (lsamen_(&c__2, c2, "SB")) {
00347
00348
00349
00350 i__1 = *nrhs;
00351 for (j = 1; j <= i__1; ++j) {
00352 zsbmv_(uplo, n, kl, &c_b1, &a[a_offset], lda, &x[j * x_dim1 + 1],
00353 &c__1, &c_b2, &b[j * b_dim1 + 1], &c__1);
00354
00355 }
00356
00357 } else if (lsamen_(&c__2, c2, "PP") || lsamen_(&
00358 c__2, c2, "HP")) {
00359
00360
00361
00362 i__1 = *nrhs;
00363 for (j = 1; j <= i__1; ++j) {
00364 zhpmv_(uplo, n, &c_b1, &a[a_offset], &x[j * x_dim1 + 1], &c__1, &
00365 c_b2, &b[j * b_dim1 + 1], &c__1);
00366
00367 }
00368
00369 } else if (lsamen_(&c__2, c2, "SP")) {
00370
00371
00372
00373 i__1 = *nrhs;
00374 for (j = 1; j <= i__1; ++j) {
00375 zspmv_(uplo, n, &c_b1, &a[a_offset], &x[j * x_dim1 + 1], &c__1, &
00376 c_b2, &b[j * b_dim1 + 1], &c__1);
00377
00378 }
00379
00380 } else if (lsamen_(&c__2, c2, "TR")) {
00381
00382
00383
00384
00385
00386 zlacpy_("Full", n, nrhs, &x[x_offset], ldx, &b[b_offset], ldb);
00387 if (*ku == 2) {
00388 *(unsigned char *)diag = 'U';
00389 } else {
00390 *(unsigned char *)diag = 'N';
00391 }
00392 ztrmm_("Left", uplo, trans, diag, n, nrhs, &c_b1, &a[a_offset], lda, &
00393 b[b_offset], ldb);
00394
00395 } else if (lsamen_(&c__2, c2, "TP")) {
00396
00397
00398
00399 zlacpy_("Full", n, nrhs, &x[x_offset], ldx, &b[b_offset], ldb);
00400 if (*ku == 2) {
00401 *(unsigned char *)diag = 'U';
00402 } else {
00403 *(unsigned char *)diag = 'N';
00404 }
00405 i__1 = *nrhs;
00406 for (j = 1; j <= i__1; ++j) {
00407 ztpmv_(uplo, trans, diag, n, &a[a_offset], &b[j * b_dim1 + 1], &
00408 c__1);
00409
00410 }
00411
00412 } else if (lsamen_(&c__2, c2, "TB")) {
00413
00414
00415
00416 zlacpy_("Full", n, nrhs, &x[x_offset], ldx, &b[b_offset], ldb);
00417 if (*ku == 2) {
00418 *(unsigned char *)diag = 'U';
00419 } else {
00420 *(unsigned char *)diag = 'N';
00421 }
00422 i__1 = *nrhs;
00423 for (j = 1; j <= i__1; ++j) {
00424 ztbmv_(uplo, trans, diag, n, kl, &a[a_offset], lda, &b[j * b_dim1
00425 + 1], &c__1);
00426
00427 }
00428
00429 } else {
00430
00431
00432
00433 *info = -1;
00434 i__1 = -(*info);
00435 xerbla_("ZLARHS", &i__1);
00436 }
00437
00438 return 0;
00439
00440
00441
00442 }