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 dtrcon_(char *norm, char *uplo, char *diag, integer *n,
00021 doublereal *a, integer *lda, doublereal *rcond, doublereal *work,
00022 integer *iwork, integer *info)
00023 {
00024
00025 integer a_dim1, a_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 int xerbla_(char *, integer *);
00043 extern doublereal dlantr_(char *, char *, char *, integer *, integer *,
00044 doublereal *, integer *, doublereal *);
00045 doublereal ainvnm;
00046 extern int dlatrs_(char *, char *, char *, char *,
00047 integer *, doublereal *, integer *, doublereal *, doublereal *,
00048 doublereal *, integer *);
00049 logical onenrm;
00050 char normin[1];
00051 doublereal smlnum;
00052 logical nounit;
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 a_dim1 = *lda;
00142 a_offset = 1 + a_dim1;
00143 a -= a_offset;
00144 --work;
00145 --iwork;
00146
00147
00148 *info = 0;
00149 upper = lsame_(uplo, "U");
00150 onenrm = *(unsigned char *)norm == '1' || lsame_(norm, "O");
00151 nounit = lsame_(diag, "N");
00152
00153 if (! onenrm && ! lsame_(norm, "I")) {
00154 *info = -1;
00155 } else if (! upper && ! lsame_(uplo, "L")) {
00156 *info = -2;
00157 } else if (! nounit && ! lsame_(diag, "U")) {
00158 *info = -3;
00159 } else if (*n < 0) {
00160 *info = -4;
00161 } else if (*lda < max(1,*n)) {
00162 *info = -6;
00163 }
00164 if (*info != 0) {
00165 i__1 = -(*info);
00166 xerbla_("DTRCON", &i__1);
00167 return 0;
00168 }
00169
00170
00171
00172 if (*n == 0) {
00173 *rcond = 1.;
00174 return 0;
00175 }
00176
00177 *rcond = 0.;
00178 smlnum = dlamch_("Safe minimum") * (doublereal) max(1,*n);
00179
00180
00181
00182 anorm = dlantr_(norm, uplo, diag, n, n, &a[a_offset], lda, &work[1]);
00183
00184
00185
00186 if (anorm > 0.) {
00187
00188
00189
00190 ainvnm = 0.;
00191 *(unsigned char *)normin = 'N';
00192 if (onenrm) {
00193 kase1 = 1;
00194 } else {
00195 kase1 = 2;
00196 }
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 dlatrs_(uplo, "No transpose", diag, normin, n, &a[a_offset],
00206 lda, &work[1], &scale, &work[(*n << 1) + 1], info);
00207 } else {
00208
00209
00210
00211 dlatrs_(uplo, "Transpose", diag, normin, n, &a[a_offset], lda,
00212 &work[1], &scale, &work[(*n << 1) + 1], info);
00213 }
00214 *(unsigned char *)normin = 'Y';
00215
00216
00217
00218 if (scale != 1.) {
00219 ix = idamax_(n, &work[1], &c__1);
00220 xnorm = (d__1 = work[ix], abs(d__1));
00221 if (scale < xnorm * smlnum || scale == 0.) {
00222 goto L20;
00223 }
00224 drscl_(n, &scale, &work[1], &c__1);
00225 }
00226 goto L10;
00227 }
00228
00229
00230
00231 if (ainvnm != 0.) {
00232 *rcond = 1. / anorm / ainvnm;
00233 }
00234 }
00235
00236 L20:
00237 return 0;
00238
00239
00240
00241 }