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 = {0.,0.};
00019 static doublecomplex c_b2 = {1.,0.};
00020
00021 int zsyt01_(char *uplo, integer *n, doublecomplex *a,
00022 integer *lda, doublecomplex *afac, integer *ldafac, integer *ipiv,
00023 doublecomplex *c__, integer *ldc, doublereal *rwork, doublereal *
00024 resid)
00025 {
00026
00027 integer a_dim1, a_offset, afac_dim1, afac_offset, c_dim1, c_offset, i__1,
00028 i__2, i__3, i__4, i__5;
00029 doublecomplex z__1;
00030
00031
00032 integer i__, j;
00033 doublereal eps;
00034 integer info;
00035 extern logical lsame_(char *, char *);
00036 doublereal anorm;
00037 extern doublereal dlamch_(char *);
00038 extern int zlaset_(char *, integer *, integer *,
00039 doublecomplex *, doublecomplex *, doublecomplex *, integer *);
00040 extern doublereal zlansy_(char *, char *, integer *, doublecomplex *,
00041 integer *, doublereal *);
00042 extern int zlavsy_(char *, char *, char *, integer *,
00043 integer *, doublecomplex *, integer *, integer *, doublecomplex *,
00044 integer *, integer *);
00045
00046
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
00121
00122
00123 a_dim1 = *lda;
00124 a_offset = 1 + a_dim1;
00125 a -= a_offset;
00126 afac_dim1 = *ldafac;
00127 afac_offset = 1 + afac_dim1;
00128 afac -= afac_offset;
00129 --ipiv;
00130 c_dim1 = *ldc;
00131 c_offset = 1 + c_dim1;
00132 c__ -= c_offset;
00133 --rwork;
00134
00135
00136 if (*n <= 0) {
00137 *resid = 0.;
00138 return 0;
00139 }
00140
00141
00142
00143 eps = dlamch_("Epsilon");
00144 anorm = zlansy_("1", uplo, n, &a[a_offset], lda, &rwork[1]);
00145
00146
00147
00148 zlaset_("Full", n, n, &c_b1, &c_b2, &c__[c_offset], ldc);
00149
00150
00151
00152 zlavsy_(uplo, "Transpose", "Non-unit", n, n, &afac[afac_offset], ldafac, &
00153 ipiv[1], &c__[c_offset], ldc, &info);
00154
00155
00156
00157 zlavsy_(uplo, "No transpose", "Unit", n, n, &afac[afac_offset], ldafac, &
00158 ipiv[1], &c__[c_offset], ldc, &info);
00159
00160
00161
00162 if (lsame_(uplo, "U")) {
00163 i__1 = *n;
00164 for (j = 1; j <= i__1; ++j) {
00165 i__2 = j;
00166 for (i__ = 1; i__ <= i__2; ++i__) {
00167 i__3 = i__ + j * c_dim1;
00168 i__4 = i__ + j * c_dim1;
00169 i__5 = i__ + j * a_dim1;
00170 z__1.r = c__[i__4].r - a[i__5].r, z__1.i = c__[i__4].i - a[
00171 i__5].i;
00172 c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
00173
00174 }
00175
00176 }
00177 } else {
00178 i__1 = *n;
00179 for (j = 1; j <= i__1; ++j) {
00180 i__2 = *n;
00181 for (i__ = j; i__ <= i__2; ++i__) {
00182 i__3 = i__ + j * c_dim1;
00183 i__4 = i__ + j * c_dim1;
00184 i__5 = i__ + j * a_dim1;
00185 z__1.r = c__[i__4].r - a[i__5].r, z__1.i = c__[i__4].i - a[
00186 i__5].i;
00187 c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
00188
00189 }
00190
00191 }
00192 }
00193
00194
00195
00196 *resid = zlansy_("1", uplo, n, &c__[c_offset], ldc, &rwork[1]);
00197
00198 if (anorm <= 0.) {
00199 if (*resid != 0.) {
00200 *resid = 1. / eps;
00201 }
00202 } else {
00203 *resid = *resid / (doublereal) (*n) / anorm / eps;
00204 }
00205
00206 return 0;
00207
00208
00209
00210 }