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 integer c__1 = 1;
00020
00021 int zgbtrs_(char *trans, integer *n, integer *kl, integer *
00022 ku, integer *nrhs, doublecomplex *ab, integer *ldab, integer *ipiv,
00023 doublecomplex *b, integer *ldb, integer *info)
00024 {
00025
00026 integer ab_dim1, ab_offset, b_dim1, b_offset, i__1, i__2, i__3;
00027 doublecomplex z__1;
00028
00029
00030 integer i__, j, l, kd, lm;
00031 extern logical lsame_(char *, char *);
00032 logical lnoti;
00033 extern int zgemv_(char *, integer *, integer *,
00034 doublecomplex *, doublecomplex *, integer *, doublecomplex *,
00035 integer *, doublecomplex *, doublecomplex *, integer *),
00036 zgeru_(integer *, integer *, doublecomplex *, doublecomplex *,
00037 integer *, doublecomplex *, integer *, doublecomplex *, integer *)
00038 , zswap_(integer *, doublecomplex *, integer *, doublecomplex *,
00039 integer *), ztbsv_(char *, char *, char *, integer *, integer *,
00040 doublecomplex *, integer *, doublecomplex *, integer *), xerbla_(char *, integer *), zlacgv_(
00041 integer *, doublecomplex *, integer *);
00042 logical notran;
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 ab_dim1 = *ldab;
00127 ab_offset = 1 + ab_dim1;
00128 ab -= ab_offset;
00129 --ipiv;
00130 b_dim1 = *ldb;
00131 b_offset = 1 + b_dim1;
00132 b -= b_offset;
00133
00134
00135 *info = 0;
00136 notran = lsame_(trans, "N");
00137 if (! notran && ! lsame_(trans, "T") && ! lsame_(
00138 trans, "C")) {
00139 *info = -1;
00140 } else if (*n < 0) {
00141 *info = -2;
00142 } else if (*kl < 0) {
00143 *info = -3;
00144 } else if (*ku < 0) {
00145 *info = -4;
00146 } else if (*nrhs < 0) {
00147 *info = -5;
00148 } else if (*ldab < (*kl << 1) + *ku + 1) {
00149 *info = -7;
00150 } else if (*ldb < max(1,*n)) {
00151 *info = -10;
00152 }
00153 if (*info != 0) {
00154 i__1 = -(*info);
00155 xerbla_("ZGBTRS", &i__1);
00156 return 0;
00157 }
00158
00159
00160
00161 if (*n == 0 || *nrhs == 0) {
00162 return 0;
00163 }
00164
00165 kd = *ku + *kl + 1;
00166 lnoti = *kl > 0;
00167
00168 if (notran) {
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 if (lnoti) {
00180 i__1 = *n - 1;
00181 for (j = 1; j <= i__1; ++j) {
00182
00183 i__2 = *kl, i__3 = *n - j;
00184 lm = min(i__2,i__3);
00185 l = ipiv[j];
00186 if (l != j) {
00187 zswap_(nrhs, &b[l + b_dim1], ldb, &b[j + b_dim1], ldb);
00188 }
00189 z__1.r = -1., z__1.i = -0.;
00190 zgeru_(&lm, nrhs, &z__1, &ab[kd + 1 + j * ab_dim1], &c__1, &b[
00191 j + b_dim1], ldb, &b[j + 1 + b_dim1], ldb);
00192
00193 }
00194 }
00195
00196 i__1 = *nrhs;
00197 for (i__ = 1; i__ <= i__1; ++i__) {
00198
00199
00200
00201 i__2 = *kl + *ku;
00202 ztbsv_("Upper", "No transpose", "Non-unit", n, &i__2, &ab[
00203 ab_offset], ldab, &b[i__ * b_dim1 + 1], &c__1);
00204
00205 }
00206
00207 } else if (lsame_(trans, "T")) {
00208
00209
00210
00211 i__1 = *nrhs;
00212 for (i__ = 1; i__ <= i__1; ++i__) {
00213
00214
00215
00216 i__2 = *kl + *ku;
00217 ztbsv_("Upper", "Transpose", "Non-unit", n, &i__2, &ab[ab_offset],
00218 ldab, &b[i__ * b_dim1 + 1], &c__1);
00219
00220 }
00221
00222
00223
00224 if (lnoti) {
00225 for (j = *n - 1; j >= 1; --j) {
00226
00227 i__1 = *kl, i__2 = *n - j;
00228 lm = min(i__1,i__2);
00229 z__1.r = -1., z__1.i = -0.;
00230 zgemv_("Transpose", &lm, nrhs, &z__1, &b[j + 1 + b_dim1], ldb,
00231 &ab[kd + 1 + j * ab_dim1], &c__1, &c_b1, &b[j +
00232 b_dim1], ldb);
00233 l = ipiv[j];
00234 if (l != j) {
00235 zswap_(nrhs, &b[l + b_dim1], ldb, &b[j + b_dim1], ldb);
00236 }
00237
00238 }
00239 }
00240
00241 } else {
00242
00243
00244
00245 i__1 = *nrhs;
00246 for (i__ = 1; i__ <= i__1; ++i__) {
00247
00248
00249
00250 i__2 = *kl + *ku;
00251 ztbsv_("Upper", "Conjugate transpose", "Non-unit", n, &i__2, &ab[
00252 ab_offset], ldab, &b[i__ * b_dim1 + 1], &c__1);
00253
00254 }
00255
00256
00257
00258 if (lnoti) {
00259 for (j = *n - 1; j >= 1; --j) {
00260
00261 i__1 = *kl, i__2 = *n - j;
00262 lm = min(i__1,i__2);
00263 zlacgv_(nrhs, &b[j + b_dim1], ldb);
00264 z__1.r = -1., z__1.i = -0.;
00265 zgemv_("Conjugate transpose", &lm, nrhs, &z__1, &b[j + 1 +
00266 b_dim1], ldb, &ab[kd + 1 + j * ab_dim1], &c__1, &c_b1,
00267 &b[j + b_dim1], ldb);
00268 zlacgv_(nrhs, &b[j + b_dim1], ldb);
00269 l = ipiv[j];
00270 if (l != j) {
00271 zswap_(nrhs, &b[l + b_dim1], ldb, &b[j + b_dim1], ldb);
00272 }
00273
00274 }
00275 }
00276 }
00277 return 0;
00278
00279
00280
00281 }