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 zpocon_(char *uplo, integer *n, doublecomplex *a,
00021 integer *lda, doublereal *anorm, doublereal *rcond, doublecomplex *
00022 work, doublereal *rwork, integer *info)
00023 {
00024
00025 integer a_dim1, a_offset, i__1;
00026 doublereal d__1, d__2;
00027
00028
00029 double d_imag(doublecomplex *);
00030
00031
00032 integer ix, kase;
00033 doublereal scale;
00034 extern logical lsame_(char *, char *);
00035 integer isave[3];
00036 logical upper;
00037 extern int zlacn2_(integer *, doublecomplex *,
00038 doublecomplex *, doublereal *, integer *, integer *);
00039 extern doublereal dlamch_(char *);
00040 doublereal scalel, scaleu;
00041 extern int xerbla_(char *, integer *);
00042 doublereal ainvnm;
00043 extern integer izamax_(integer *, doublecomplex *, integer *);
00044 extern int zdrscl_(integer *, doublereal *,
00045 doublecomplex *, integer *);
00046 char normin[1];
00047 doublereal smlnum;
00048 extern int zlatrs_(char *, char *, char *, char *,
00049 integer *, doublecomplex *, integer *, doublecomplex *,
00050 doublereal *, doublereal *, integer *);
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 a_dim1 = *lda;
00131 a_offset = 1 + a_dim1;
00132 a -= a_offset;
00133 --work;
00134 --rwork;
00135
00136
00137 *info = 0;
00138 upper = lsame_(uplo, "U");
00139 if (! upper && ! lsame_(uplo, "L")) {
00140 *info = -1;
00141 } else if (*n < 0) {
00142 *info = -2;
00143 } else if (*lda < max(1,*n)) {
00144 *info = -4;
00145 } else if (*anorm < 0.) {
00146 *info = -5;
00147 }
00148 if (*info != 0) {
00149 i__1 = -(*info);
00150 xerbla_("ZPOCON", &i__1);
00151 return 0;
00152 }
00153
00154
00155
00156 *rcond = 0.;
00157 if (*n == 0) {
00158 *rcond = 1.;
00159 return 0;
00160 } else if (*anorm == 0.) {
00161 return 0;
00162 }
00163
00164 smlnum = dlamch_("Safe minimum");
00165
00166
00167
00168 kase = 0;
00169 *(unsigned char *)normin = 'N';
00170 L10:
00171 zlacn2_(n, &work[*n + 1], &work[1], &ainvnm, &kase, isave);
00172 if (kase != 0) {
00173 if (upper) {
00174
00175
00176
00177 zlatrs_("Upper", "Conjugate transpose", "Non-unit", normin, n, &a[
00178 a_offset], lda, &work[1], &scalel, &rwork[1], info);
00179 *(unsigned char *)normin = 'Y';
00180
00181
00182
00183 zlatrs_("Upper", "No transpose", "Non-unit", normin, n, &a[
00184 a_offset], lda, &work[1], &scaleu, &rwork[1], info);
00185 } else {
00186
00187
00188
00189 zlatrs_("Lower", "No transpose", "Non-unit", normin, n, &a[
00190 a_offset], lda, &work[1], &scalel, &rwork[1], info);
00191 *(unsigned char *)normin = 'Y';
00192
00193
00194
00195 zlatrs_("Lower", "Conjugate transpose", "Non-unit", normin, n, &a[
00196 a_offset], lda, &work[1], &scaleu, &rwork[1], info);
00197 }
00198
00199
00200
00201 scale = scalel * scaleu;
00202 if (scale != 1.) {
00203 ix = izamax_(n, &work[1], &c__1);
00204 i__1 = ix;
00205 if (scale < ((d__1 = work[i__1].r, abs(d__1)) + (d__2 = d_imag(&
00206 work[ix]), abs(d__2))) * smlnum || scale == 0.) {
00207 goto L20;
00208 }
00209 zdrscl_(n, &scale, &work[1], &c__1);
00210 }
00211 goto L10;
00212 }
00213
00214
00215
00216 if (ainvnm != 0.) {
00217 *rcond = 1. / ainvnm / *anorm;
00218 }
00219
00220 L20:
00221 return 0;
00222
00223
00224
00225 }