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 doublecomplex c_b1 = {1.,0.};
00019 static integer c__1 = 1;
00020 static integer c_n1 = -1;
00021 static doublereal c_b14 = -1.;
00022 static doublereal c_b15 = 1.;
00023
00024 int zpotrf_(char *uplo, integer *n, doublecomplex *a,
00025 integer *lda, integer *info)
00026 {
00027
00028 integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
00029 doublecomplex z__1;
00030
00031
00032 integer j, jb, nb;
00033 extern logical lsame_(char *, char *);
00034 extern int zgemm_(char *, char *, integer *, integer *,
00035 integer *, doublecomplex *, doublecomplex *, integer *,
00036 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00037 integer *), zherk_(char *, char *, integer *,
00038 integer *, doublereal *, doublecomplex *, integer *, doublereal *,
00039 doublecomplex *, integer *);
00040 logical upper;
00041 extern int ztrsm_(char *, char *, char *, char *,
00042 integer *, integer *, doublecomplex *, doublecomplex *, integer *,
00043 doublecomplex *, integer *),
00044 zpotf2_(char *, integer *, doublecomplex *, integer *, integer *), xerbla_(char *, integer *);
00045 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00046 integer *, integer *);
00047
00048
00049
00050
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 a_dim1 = *lda;
00121 a_offset = 1 + a_dim1;
00122 a -= a_offset;
00123
00124
00125 *info = 0;
00126 upper = lsame_(uplo, "U");
00127 if (! upper && ! lsame_(uplo, "L")) {
00128 *info = -1;
00129 } else if (*n < 0) {
00130 *info = -2;
00131 } else if (*lda < max(1,*n)) {
00132 *info = -4;
00133 }
00134 if (*info != 0) {
00135 i__1 = -(*info);
00136 xerbla_("ZPOTRF", &i__1);
00137 return 0;
00138 }
00139
00140
00141
00142 if (*n == 0) {
00143 return 0;
00144 }
00145
00146
00147
00148 nb = ilaenv_(&c__1, "ZPOTRF", uplo, n, &c_n1, &c_n1, &c_n1);
00149 if (nb <= 1 || nb >= *n) {
00150
00151
00152
00153 zpotf2_(uplo, n, &a[a_offset], lda, info);
00154 } else {
00155
00156
00157
00158 if (upper) {
00159
00160
00161
00162 i__1 = *n;
00163 i__2 = nb;
00164 for (j = 1; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
00165
00166
00167
00168
00169
00170 i__3 = nb, i__4 = *n - j + 1;
00171 jb = min(i__3,i__4);
00172 i__3 = j - 1;
00173 zherk_("Upper", "Conjugate transpose", &jb, &i__3, &c_b14, &a[
00174 j * a_dim1 + 1], lda, &c_b15, &a[j + j * a_dim1], lda);
00175 zpotf2_("Upper", &jb, &a[j + j * a_dim1], lda, info);
00176 if (*info != 0) {
00177 goto L30;
00178 }
00179 if (j + jb <= *n) {
00180
00181
00182
00183 i__3 = *n - j - jb + 1;
00184 i__4 = j - 1;
00185 z__1.r = -1., z__1.i = -0.;
00186 zgemm_("Conjugate transpose", "No transpose", &jb, &i__3,
00187 &i__4, &z__1, &a[j * a_dim1 + 1], lda, &a[(j + jb)
00188 * a_dim1 + 1], lda, &c_b1, &a[j + (j + jb) *
00189 a_dim1], lda);
00190 i__3 = *n - j - jb + 1;
00191 ztrsm_("Left", "Upper", "Conjugate transpose", "Non-unit",
00192 &jb, &i__3, &c_b1, &a[j + j * a_dim1], lda, &a[j
00193 + (j + jb) * a_dim1], lda);
00194 }
00195
00196 }
00197
00198 } else {
00199
00200
00201
00202 i__2 = *n;
00203 i__1 = nb;
00204 for (j = 1; i__1 < 0 ? j >= i__2 : j <= i__2; j += i__1) {
00205
00206
00207
00208
00209
00210 i__3 = nb, i__4 = *n - j + 1;
00211 jb = min(i__3,i__4);
00212 i__3 = j - 1;
00213 zherk_("Lower", "No transpose", &jb, &i__3, &c_b14, &a[j +
00214 a_dim1], lda, &c_b15, &a[j + j * a_dim1], lda);
00215 zpotf2_("Lower", &jb, &a[j + j * a_dim1], lda, info);
00216 if (*info != 0) {
00217 goto L30;
00218 }
00219 if (j + jb <= *n) {
00220
00221
00222
00223 i__3 = *n - j - jb + 1;
00224 i__4 = j - 1;
00225 z__1.r = -1., z__1.i = -0.;
00226 zgemm_("No transpose", "Conjugate transpose", &i__3, &jb,
00227 &i__4, &z__1, &a[j + jb + a_dim1], lda, &a[j +
00228 a_dim1], lda, &c_b1, &a[j + jb + j * a_dim1], lda);
00229 i__3 = *n - j - jb + 1;
00230 ztrsm_("Right", "Lower", "Conjugate transpose", "Non-unit"
00231 , &i__3, &jb, &c_b1, &a[j + j * a_dim1], lda, &a[
00232 j + jb + j * a_dim1], lda);
00233 }
00234
00235 }
00236 }
00237 }
00238 goto L40;
00239
00240 L30:
00241 *info = *info + j - 1;
00242
00243 L40:
00244 return 0;
00245
00246
00247
00248 }