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
00020 int cget03_(integer *n, complex *a, integer *lda, complex *
00021 ainv, integer *ldainv, complex *work, integer *ldwork, real *rwork,
00022 real *rcond, real *resid)
00023 {
00024
00025 integer a_dim1, a_offset, ainv_dim1, ainv_offset, work_dim1, work_offset,
00026 i__1, i__2, i__3;
00027 complex q__1;
00028
00029
00030 integer i__;
00031 real eps;
00032 extern int cgemm_(char *, char *, integer *, integer *,
00033 integer *, complex *, complex *, integer *, complex *, integer *,
00034 complex *, complex *, integer *);
00035 real anorm;
00036 extern doublereal clange_(char *, integer *, integer *, complex *,
00037 integer *, real *), slamch_(char *);
00038 real ainvnm;
00039
00040
00041
00042
00043
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 a_dim1 = *lda;
00107 a_offset = 1 + a_dim1;
00108 a -= a_offset;
00109 ainv_dim1 = *ldainv;
00110 ainv_offset = 1 + ainv_dim1;
00111 ainv -= ainv_offset;
00112 work_dim1 = *ldwork;
00113 work_offset = 1 + work_dim1;
00114 work -= work_offset;
00115 --rwork;
00116
00117
00118 if (*n <= 0) {
00119 *rcond = 1.f;
00120 *resid = 0.f;
00121 return 0;
00122 }
00123
00124
00125
00126 eps = slamch_("Epsilon");
00127 anorm = clange_("1", n, n, &a[a_offset], lda, &rwork[1]);
00128 ainvnm = clange_("1", n, n, &ainv[ainv_offset], ldainv, &rwork[1]);
00129 if (anorm <= 0.f || ainvnm <= 0.f) {
00130 *rcond = 0.f;
00131 *resid = 1.f / eps;
00132 return 0;
00133 }
00134 *rcond = 1.f / anorm / ainvnm;
00135
00136
00137
00138 q__1.r = -1.f, q__1.i = -0.f;
00139 cgemm_("No transpose", "No transpose", n, n, n, &q__1, &ainv[ainv_offset],
00140 ldainv, &a[a_offset], lda, &c_b1, &work[work_offset], ldwork);
00141 i__1 = *n;
00142 for (i__ = 1; i__ <= i__1; ++i__) {
00143 i__2 = i__ + i__ * work_dim1;
00144 i__3 = i__ + i__ * work_dim1;
00145 q__1.r = work[i__3].r + 1.f, q__1.i = work[i__3].i + 0.f;
00146 work[i__2].r = q__1.r, work[i__2].i = q__1.i;
00147
00148 }
00149
00150
00151
00152 *resid = clange_("1", n, n, &work[work_offset], ldwork, &rwork[1]);
00153
00154 *resid = *resid * *rcond / eps / (real) (*n);
00155
00156 return 0;
00157
00158
00159
00160 }