Dfactir. Function to compute the determinant from a square matrix ($\det(A)$) of dimension $idim$ and order $n$. A working area $ir$ is returned which is needed by the Dfinv routine.
38{
39
40#ifdef XXX
41 if (idim < n || n <= 0) {
42 return false;
43 }
44#endif
45
46
47
48 typename Matrix::value_type*
a = rhs.Array();
49
50
51 static unsigned int nxch, i, j, k, l;
52 static typename Matrix::value_type
p,
q, tf;
53
54
56 --ir;
57
58
59
60
61 nxch = 0;
62 det = 1.;
63 for (j = 1; j <= n; ++j) {
64 const unsigned int ji = j * idim;
65 const unsigned int jj = j + ji;
66
67 k = j;
69
70 if (j != n) {
71 for (i = j + 1; i <= n; ++i) {
74 k = i;
76 }
77 }
78
79 if (k != j) {
80 for (l = 1; l <= n; ++l) {
81 const unsigned int li = l*idim;
82 const unsigned int jli = j + li;
83 const unsigned int kli = k + li;
87 }
88 ++nxch;
89 ir[nxch] = (j << 12) + k;
90 }
91 }
92
94 det = 0;
95 return false;
96 }
97
99#ifdef XXX
101 if (t < 1e-19 || t > 1e19) {
102 det = 0;
103 return false;
104 }
105#endif
106
108 if (j == n) {
109 continue;
110 }
111
112 const unsigned int jm1 = j - 1;
113 const unsigned int jpi = (j + 1) * idim;
114 const unsigned int jjpi = j + jpi;
115
116 for (k = j + 1; k <= n; ++k) {
117 const unsigned int ki = k * idim;
118 const unsigned int jki = j + ki;
119 const unsigned int kji = k + jpi;
120 if (j != 1) {
121 for (i = 1; i <= jm1; ++i) {
122 const unsigned int ii = i * idim;
123 a[jki] -=
a[i + ki] *
a[j + ii];
124 a[kji] -=
a[i + jpi] *
a[k + ii];
125 }
126 }
128 a[kji] -=
a[jjpi] *
a[k + ji];
129 }
130 }
131
132 if (nxch % 2 != 0) {
133 det = -(det);
134 }
135 ir[n] = nxch;
136 return true;
137}
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
TTree * t
Definition: check_shower.C:4
q
Definition: testBGReduction_AllMethods.C:55
p
Definition: testBGReduction_AllMethods.C:8