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 dtbcon_(char *norm, char *uplo, char *diag, integer *n,
00021 integer *kd, doublereal *ab, integer *ldab, doublereal *rcond,
00022 doublereal *work, integer *iwork, integer *info)
00023 {
00024
00025 integer ab_dim1, ab_offset, i__1;
00026 doublereal d__1;
00027
00028
00029 integer ix, kase, kase1;
00030 doublereal scale;
00031 extern logical lsame_(char *, char *);
00032 integer isave[3];
00033 extern int drscl_(integer *, doublereal *, doublereal *,
00034 integer *);
00035 doublereal anorm;
00036 logical upper;
00037 doublereal xnorm;
00038 extern int dlacn2_(integer *, doublereal *, doublereal *,
00039 integer *, doublereal *, integer *, integer *);
00040 extern doublereal dlamch_(char *);
00041 extern integer idamax_(integer *, doublereal *, integer *);
00042 extern doublereal dlantb_(char *, char *, char *, integer *, integer *,
00043 doublereal *, integer *, doublereal *);
00044 extern int dlatbs_(char *, char *, char *, char *,
00045 integer *, integer *, doublereal *, integer *, doublereal *,
00046 doublereal *, doublereal *, integer *), xerbla_(char *, integer *);
00047 doublereal ainvnm;
00048 logical onenrm;
00049 char normin[1];
00050 doublereal smlnum;
00051 logical nounit;
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 ab_dim1 = *ldab;
00144 ab_offset = 1 + ab_dim1;
00145 ab -= ab_offset;
00146 --work;
00147 --iwork;
00148
00149
00150 *info = 0;
00151 upper = lsame_(uplo, "U");
00152 onenrm = *(unsigned char *)norm == '1' || lsame_(norm, "O");
00153 nounit = lsame_(diag, "N");
00154
00155 if (! onenrm && ! lsame_(norm, "I")) {
00156 *info = -1;
00157 } else if (! upper && ! lsame_(uplo, "L")) {
00158 *info = -2;
00159 } else if (! nounit && ! lsame_(diag, "U")) {
00160 *info = -3;
00161 } else if (*n < 0) {
00162 *info = -4;
00163 } else if (*kd < 0) {
00164 *info = -5;
00165 } else if (*ldab < *kd + 1) {
00166 *info = -7;
00167 }
00168 if (*info != 0) {
00169 i__1 = -(*info);
00170 xerbla_("DTBCON", &i__1);
00171 return 0;
00172 }
00173
00174
00175
00176 if (*n == 0) {
00177 *rcond = 1.;
00178 return 0;
00179 }
00180
00181 *rcond = 0.;
00182 smlnum = dlamch_("Safe minimum") * (doublereal) max(1,*n);
00183
00184
00185
00186 anorm = dlantb_(norm, uplo, diag, n, kd, &ab[ab_offset], ldab, &work[1]);
00187
00188
00189
00190 if (anorm > 0.) {
00191
00192
00193
00194 ainvnm = 0.;
00195 *(unsigned char *)normin = 'N';
00196 if (onenrm) {
00197 kase1 = 1;
00198 } else {
00199 kase1 = 2;
00200 }
00201 kase = 0;
00202 L10:
00203 dlacn2_(n, &work[*n + 1], &work[1], &iwork[1], &ainvnm, &kase, isave);
00204 if (kase != 0) {
00205 if (kase == kase1) {
00206
00207
00208
00209 dlatbs_(uplo, "No transpose", diag, normin, n, kd, &ab[
00210 ab_offset], ldab, &work[1], &scale, &work[(*n << 1) +
00211 1], info)
00212 ;
00213 } else {
00214
00215
00216
00217 dlatbs_(uplo, "Transpose", diag, normin, n, kd, &ab[ab_offset]
00218 , ldab, &work[1], &scale, &work[(*n << 1) + 1], info);
00219 }
00220 *(unsigned char *)normin = 'Y';
00221
00222
00223
00224 if (scale != 1.) {
00225 ix = idamax_(n, &work[1], &c__1);
00226 xnorm = (d__1 = work[ix], abs(d__1));
00227 if (scale < xnorm * smlnum || scale == 0.) {
00228 goto L20;
00229 }
00230 drscl_(n, &scale, &work[1], &c__1);
00231 }
00232 goto L10;
00233 }
00234
00235
00236
00237 if (ainvnm != 0.) {
00238 *rcond = 1. / anorm / ainvnm;
00239 }
00240 }
00241
00242 L20:
00243 return 0;
00244
00245
00246
00247 }