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