45template <
unsigned int idim,
unsigned int n =
idim>
49 template <
class Matrix>
50 static bool Dinv(Matrix& rhs) {
53 if (n < 1 || n > idim) {
59 static unsigned int work[n];
60 for(
unsigned int i=0; i<n; ++i) work[i] = 0;
62 static typename Matrix::value_type det = 0;
67 if (Dfactir<Matrix,n,idim>(rhs,det,work) ==
false) {
68 cerr <<
"Dfactir failed!!" << endl;
71 return Dfinv<Matrix,n,idim>(rhs,work);
88 template <
class Matrix>
89 inline static bool Dinv(Matrix& rhs) {
return true; }
105 template <
class Matrix>
106 static bool Dinv(Matrix& rhs) {
107 typename Matrix::value_type*
a = rhs.Array();
130 template <
class Matrix>
131 static bool Dinv(Matrix& rhs) {
133 typename Matrix::value_type*
a = rhs.Array();
134 typename Matrix::value_type det =
a[0] *
a[3] -
a[2] *
a[1];
136 if (det == 0.) {
return false; }
138 typename Matrix::value_type
s = 1. / det;
139 typename Matrix::value_type c11 =
s *
a[3];
162 template <
class Matrix>
163 static bool Dinv(Matrix& rhs) {
165 typename Matrix::value_type*
a = rhs.Array();
167 static typename Matrix::value_type t1, t2, t3, temp,
s;
168 static typename Matrix::value_type c11, c12, c13, c21, c22, c23, c31, c32, c33, det;
172 c11 =
a[4] *
a[8] -
a[7] *
a[5];
173 c12 =
a[7] *
a[2] -
a[1] *
a[8];
174 c13 =
a[1] *
a[5] -
a[4] *
a[2];
175 c21 =
a[5] *
a[6] -
a[8] *
a[3];
176 c22 =
a[8] *
a[0] -
a[2] *
a[6];
177 c23 =
a[2] *
a[3] -
a[5] *
a[0];
178 c31 =
a[3] *
a[7] -
a[6] *
a[4];
179 c32 =
a[6] *
a[1] -
a[0] *
a[7];
180 c33 =
a[0] *
a[4] -
a[3] *
a[1];
191 det = c13 * c32 - c12 * c33;
195 det = c23 * c12 - c22 * c13;
201 det = c22 * c33 - c23 * c32;
205 det = c23 * c12 - c22 * c13;
Expr< UnaryOp< Fabs< T >, Expr< A, T, D >, T >, T, D > fabs(const Expr< A, T, D > &rhs)
Definition: UnaryOperators.hh:96
void a()
Definition: check_aligned.C:59
static bool Dinv(Matrix &rhs)
Definition: Dinv.hh:89
static bool Dinv(Matrix &rhs)
Definition: Dinv.hh:106
static bool Dinv(Matrix &rhs)
Definition: Dinv.hh:131
static bool Dinv(Matrix &rhs)
Definition: Dinv.hh:163
static bool Dinv(Matrix &rhs)
Definition: Dinv.hh:50
s
Definition: check_shower.C:55