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
00020 int zget03_(integer *n, doublecomplex *a, integer *lda,
00021 doublecomplex *ainv, integer *ldainv, doublecomplex *work, integer *
00022 ldwork, doublereal *rwork, doublereal *rcond, doublereal *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 doublecomplex z__1;
00028
00029
00030 integer i__;
00031 doublereal eps, anorm;
00032 extern int zgemm_(char *, char *, integer *, integer *,
00033 integer *, doublecomplex *, doublecomplex *, integer *,
00034 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00035 integer *);
00036 extern doublereal dlamch_(char *), zlange_(char *, integer *,
00037 integer *, doublecomplex *, integer *, doublereal *);
00038 doublereal 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.;
00120 *resid = 0.;
00121 return 0;
00122 }
00123
00124
00125
00126 eps = dlamch_("Epsilon");
00127 anorm = zlange_("1", n, n, &a[a_offset], lda, &rwork[1]);
00128 ainvnm = zlange_("1", n, n, &ainv[ainv_offset], ldainv, &rwork[1]);
00129 if (anorm <= 0. || ainvnm <= 0.) {
00130 *rcond = 0.;
00131 *resid = 1. / eps;
00132 return 0;
00133 }
00134 *rcond = 1. / anorm / ainvnm;
00135
00136
00137
00138 z__1.r = -1., z__1.i = -0.;
00139 zgemm_("No transpose", "No transpose", n, n, n, &z__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 z__1.r = work[i__3].r + 1., z__1.i = work[i__3].i + 0.;
00146 work[i__2].r = z__1.r, work[i__2].i = z__1.i;
00147
00148 }
00149
00150
00151
00152 *resid = zlange_("1", n, n, &work[work_offset], ldwork, &rwork[1]);
00153
00154 *resid = *resid * *rcond / eps / (doublereal) (*n);
00155
00156 return 0;
00157
00158
00159
00160 }