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