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__1 = 1;
00019
00020 doublereal dla_gbrcond__(char *trans, integer *n, integer *kl, integer *ku,
00021 doublereal *ab, integer *ldab, doublereal *afb, integer *ldafb,
00022 integer *ipiv, integer *cmode, doublereal *c__, integer *info,
00023 doublereal *work, integer *iwork, ftnlen trans_len)
00024 {
00025
00026 integer ab_dim1, ab_offset, afb_dim1, afb_offset, i__1, i__2, i__3, i__4;
00027 doublereal ret_val, d__1;
00028
00029
00030 integer i__, j, kd, ke;
00031 doublereal tmp;
00032 integer kase;
00033 extern logical lsame_(char *, char *);
00034 integer isave[3];
00035 extern int dlacn2_(integer *, doublereal *, doublereal *,
00036 integer *, doublereal *, integer *, integer *), xerbla_(char *,
00037 integer *), dgbtrs_(char *, integer *, integer *, integer
00038 *, integer *, doublereal *, integer *, integer *, doublereal *,
00039 integer *, integer *);
00040 doublereal ainvnm;
00041 logical notrans;
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 ab_dim1 = *ldab;
00149 ab_offset = 1 + ab_dim1;
00150 ab -= ab_offset;
00151 afb_dim1 = *ldafb;
00152 afb_offset = 1 + afb_dim1;
00153 afb -= afb_offset;
00154 --ipiv;
00155 --c__;
00156 --work;
00157 --iwork;
00158
00159
00160 ret_val = 0.;
00161
00162 *info = 0;
00163 notrans = lsame_(trans, "N");
00164 if (! notrans && ! lsame_(trans, "T") && ! lsame_(
00165 trans, "C")) {
00166 *info = -1;
00167 } else if (*n < 0) {
00168 *info = -2;
00169 } else if (*kl < 0 || *kl > *n - 1) {
00170 *info = -3;
00171 } else if (*ku < 0 || *ku > *n - 1) {
00172 *info = -4;
00173 } else if (*ldab < *kl + *ku + 1) {
00174 *info = -6;
00175 } else if (*ldafb < (*kl << 1) + *ku + 1) {
00176 *info = -8;
00177 }
00178 if (*info != 0) {
00179 i__1 = -(*info);
00180 xerbla_("DLA_GBRCOND", &i__1);
00181 return ret_val;
00182 }
00183 if (*n == 0) {
00184 ret_val = 1.;
00185 return ret_val;
00186 }
00187
00188
00189
00190
00191 kd = *ku + 1;
00192 ke = *kl + 1;
00193 if (notrans) {
00194 i__1 = *n;
00195 for (i__ = 1; i__ <= i__1; ++i__) {
00196 tmp = 0.;
00197 if (*cmode == 1) {
00198
00199 i__2 = i__ - *kl;
00200
00201 i__4 = i__ + *ku;
00202 i__3 = min(i__4,*n);
00203 for (j = max(i__2,1); j <= i__3; ++j) {
00204 tmp += (d__1 = ab[kd + i__ - j + j * ab_dim1] * c__[j],
00205 abs(d__1));
00206 }
00207 } else if (*cmode == 0) {
00208
00209 i__3 = i__ - *kl;
00210
00211 i__4 = i__ + *ku;
00212 i__2 = min(i__4,*n);
00213 for (j = max(i__3,1); j <= i__2; ++j) {
00214 tmp += (d__1 = ab[kd + i__ - j + j * ab_dim1], abs(d__1));
00215 }
00216 } else {
00217
00218 i__2 = i__ - *kl;
00219
00220 i__4 = i__ + *ku;
00221 i__3 = min(i__4,*n);
00222 for (j = max(i__2,1); j <= i__3; ++j) {
00223 tmp += (d__1 = ab[kd + i__ - j + j * ab_dim1] / c__[j],
00224 abs(d__1));
00225 }
00226 }
00227 work[(*n << 1) + i__] = tmp;
00228 }
00229 } else {
00230 i__1 = *n;
00231 for (i__ = 1; i__ <= i__1; ++i__) {
00232 tmp = 0.;
00233 if (*cmode == 1) {
00234
00235 i__3 = i__ - *kl;
00236
00237 i__4 = i__ + *ku;
00238 i__2 = min(i__4,*n);
00239 for (j = max(i__3,1); j <= i__2; ++j) {
00240 tmp += (d__1 = ab[ke - i__ + j + i__ * ab_dim1] * c__[j],
00241 abs(d__1));
00242 }
00243 } else if (*cmode == 0) {
00244
00245 i__2 = i__ - *kl;
00246
00247 i__4 = i__ + *ku;
00248 i__3 = min(i__4,*n);
00249 for (j = max(i__2,1); j <= i__3; ++j) {
00250 tmp += (d__1 = ab[ke - i__ + j + i__ * ab_dim1], abs(d__1)
00251 );
00252 }
00253 } else {
00254
00255 i__3 = i__ - *kl;
00256
00257 i__4 = i__ + *ku;
00258 i__2 = min(i__4,*n);
00259 for (j = max(i__3,1); j <= i__2; ++j) {
00260 tmp += (d__1 = ab[ke - i__ + j + i__ * ab_dim1] / c__[j],
00261 abs(d__1));
00262 }
00263 }
00264 work[(*n << 1) + i__] = tmp;
00265 }
00266 }
00267
00268
00269
00270 ainvnm = 0.;
00271 kase = 0;
00272 L10:
00273 dlacn2_(n, &work[*n + 1], &work[1], &iwork[1], &ainvnm, &kase, isave);
00274 if (kase != 0) {
00275 if (kase == 2) {
00276
00277
00278
00279 i__1 = *n;
00280 for (i__ = 1; i__ <= i__1; ++i__) {
00281 work[i__] *= work[(*n << 1) + i__];
00282 }
00283 if (notrans) {
00284 dgbtrs_("No transpose", n, kl, ku, &c__1, &afb[afb_offset],
00285 ldafb, &ipiv[1], &work[1], n, info);
00286 } else {
00287 dgbtrs_("Transpose", n, kl, ku, &c__1, &afb[afb_offset],
00288 ldafb, &ipiv[1], &work[1], n, info);
00289 }
00290
00291
00292
00293 if (*cmode == 1) {
00294 i__1 = *n;
00295 for (i__ = 1; i__ <= i__1; ++i__) {
00296 work[i__] /= c__[i__];
00297 }
00298 } else if (*cmode == -1) {
00299 i__1 = *n;
00300 for (i__ = 1; i__ <= i__1; ++i__) {
00301 work[i__] *= c__[i__];
00302 }
00303 }
00304 } else {
00305
00306
00307
00308 if (*cmode == 1) {
00309 i__1 = *n;
00310 for (i__ = 1; i__ <= i__1; ++i__) {
00311 work[i__] /= c__[i__];
00312 }
00313 } else if (*cmode == -1) {
00314 i__1 = *n;
00315 for (i__ = 1; i__ <= i__1; ++i__) {
00316 work[i__] *= c__[i__];
00317 }
00318 }
00319 if (notrans) {
00320 dgbtrs_("Transpose", n, kl, ku, &c__1, &afb[afb_offset],
00321 ldafb, &ipiv[1], &work[1], n, info);
00322 } else {
00323 dgbtrs_("No transpose", n, kl, ku, &c__1, &afb[afb_offset],
00324 ldafb, &ipiv[1], &work[1], n, info);
00325 }
00326
00327
00328
00329 i__1 = *n;
00330 for (i__ = 1; i__ <= i__1; ++i__) {
00331 work[i__] *= work[(*n << 1) + i__];
00332 }
00333 }
00334 goto L10;
00335 }
00336
00337
00338
00339 if (ainvnm != 0.) {
00340 ret_val = 1. / ainvnm;
00341 }
00342
00343 return ret_val;
00344
00345 }