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 int dgbcon_(char *norm, integer *n, integer *kl, integer *ku,
00021 doublereal *ab, integer *ldab, integer *ipiv, doublereal *anorm,
00022 doublereal *rcond, doublereal *work, integer *iwork, integer *info)
00023 {
00024
00025 integer ab_dim1, ab_offset, i__1, i__2, i__3;
00026 doublereal d__1;
00027
00028
00029 integer j;
00030 doublereal t;
00031 integer kd, lm, jp, ix, kase;
00032 extern doublereal ddot_(integer *, doublereal *, integer *, doublereal *,
00033 integer *);
00034 integer kase1;
00035 doublereal scale;
00036 extern logical lsame_(char *, char *);
00037 integer isave[3];
00038 extern int drscl_(integer *, doublereal *, doublereal *,
00039 integer *);
00040 logical lnoti;
00041 extern int daxpy_(integer *, doublereal *, doublereal *,
00042 integer *, doublereal *, integer *), dlacn2_(integer *,
00043 doublereal *, doublereal *, integer *, doublereal *, integer *,
00044 integer *);
00045 extern doublereal dlamch_(char *);
00046 extern integer idamax_(integer *, doublereal *, integer *);
00047 extern int dlatbs_(char *, char *, char *, char *,
00048 integer *, integer *, doublereal *, integer *, doublereal *,
00049 doublereal *, doublereal *, integer *), xerbla_(char *, integer *);
00050 doublereal ainvnm;
00051 logical onenrm;
00052 char normin[1];
00053 doublereal smlnum;
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 ab_dim1 = *ldab;
00146 ab_offset = 1 + ab_dim1;
00147 ab -= ab_offset;
00148 --ipiv;
00149 --work;
00150 --iwork;
00151
00152
00153 *info = 0;
00154 onenrm = *(unsigned char *)norm == '1' || lsame_(norm, "O");
00155 if (! onenrm && ! lsame_(norm, "I")) {
00156 *info = -1;
00157 } else if (*n < 0) {
00158 *info = -2;
00159 } else if (*kl < 0) {
00160 *info = -3;
00161 } else if (*ku < 0) {
00162 *info = -4;
00163 } else if (*ldab < (*kl << 1) + *ku + 1) {
00164 *info = -6;
00165 } else if (*anorm < 0.) {
00166 *info = -8;
00167 }
00168 if (*info != 0) {
00169 i__1 = -(*info);
00170 xerbla_("DGBCON", &i__1);
00171 return 0;
00172 }
00173
00174
00175
00176 *rcond = 0.;
00177 if (*n == 0) {
00178 *rcond = 1.;
00179 return 0;
00180 } else if (*anorm == 0.) {
00181 return 0;
00182 }
00183
00184 smlnum = dlamch_("Safe minimum");
00185
00186
00187
00188 ainvnm = 0.;
00189 *(unsigned char *)normin = 'N';
00190 if (onenrm) {
00191 kase1 = 1;
00192 } else {
00193 kase1 = 2;
00194 }
00195 kd = *kl + *ku + 1;
00196 lnoti = *kl > 0;
00197 kase = 0;
00198 L10:
00199 dlacn2_(n, &work[*n + 1], &work[1], &iwork[1], &ainvnm, &kase, isave);
00200 if (kase != 0) {
00201 if (kase == kase1) {
00202
00203
00204
00205 if (lnoti) {
00206 i__1 = *n - 1;
00207 for (j = 1; j <= i__1; ++j) {
00208
00209 i__2 = *kl, i__3 = *n - j;
00210 lm = min(i__2,i__3);
00211 jp = ipiv[j];
00212 t = work[jp];
00213 if (jp != j) {
00214 work[jp] = work[j];
00215 work[j] = t;
00216 }
00217 d__1 = -t;
00218 daxpy_(&lm, &d__1, &ab[kd + 1 + j * ab_dim1], &c__1, &
00219 work[j + 1], &c__1);
00220
00221 }
00222 }
00223
00224
00225
00226 i__1 = *kl + *ku;
00227 dlatbs_("Upper", "No transpose", "Non-unit", normin, n, &i__1, &
00228 ab[ab_offset], ldab, &work[1], &scale, &work[(*n << 1) +
00229 1], info);
00230 } else {
00231
00232
00233
00234 i__1 = *kl + *ku;
00235 dlatbs_("Upper", "Transpose", "Non-unit", normin, n, &i__1, &ab[
00236 ab_offset], ldab, &work[1], &scale, &work[(*n << 1) + 1],
00237 info);
00238
00239
00240
00241 if (lnoti) {
00242 for (j = *n - 1; j >= 1; --j) {
00243
00244 i__1 = *kl, i__2 = *n - j;
00245 lm = min(i__1,i__2);
00246 work[j] -= ddot_(&lm, &ab[kd + 1 + j * ab_dim1], &c__1, &
00247 work[j + 1], &c__1);
00248 jp = ipiv[j];
00249 if (jp != j) {
00250 t = work[jp];
00251 work[jp] = work[j];
00252 work[j] = t;
00253 }
00254
00255 }
00256 }
00257 }
00258
00259
00260
00261 *(unsigned char *)normin = 'Y';
00262 if (scale != 1.) {
00263 ix = idamax_(n, &work[1], &c__1);
00264 if (scale < (d__1 = work[ix], abs(d__1)) * smlnum || scale == 0.)
00265 {
00266 goto L40;
00267 }
00268 drscl_(n, &scale, &work[1], &c__1);
00269 }
00270 goto L10;
00271 }
00272
00273
00274
00275 if (ainvnm != 0.) {
00276 *rcond = 1. / ainvnm / *anorm;
00277 }
00278
00279 L40:
00280 return 0;
00281
00282
00283
00284 }