4 #ifndef ROOT_Math_Dfact
5 #define ROOT_Math_Dfact
33 #ifndef ROOT_Math_MatrixRepresentationsStatic
50 template <
unsigned int n,
unsigned int idim = n>
58 if (idim <
n ||
n <= 0) {
69 unsigned int nxch, i, j, k,
l;
75 const int arrayOffset = - int(idim+1);
82 for (j = 1; j <=
n; ++j) {
83 const unsigned int ji = j * idim;
84 const unsigned int jj = j + ji;
90 for (i = j + 1; i <=
n; ++i) {
91 q =
std::abs(rhs[i + ji + arrayOffset]);
98 for (l = 1; l <=
n; ++
l) {
99 const unsigned int li = l*idim;
100 const unsigned int jli = j + li;
101 const unsigned int kli = k + li;
102 tf = rhs[jli + arrayOffset];
103 rhs[jli + arrayOffset] = rhs[kli + arrayOffset];
104 rhs[kli + arrayOffset] = tf;
115 det *= rhs[jj + arrayOffset];
118 if (t < 1e-19 || t > 1e19) {
124 rhs[jj + arrayOffset] = 1.0f / rhs[jj + arrayOffset];
129 const unsigned int jm1 = j - 1;
130 const unsigned int jpi = (j + 1) * idim;
131 const unsigned int jjpi = j + jpi;
133 for (k = j + 1; k <=
n; ++k) {
134 const unsigned int ki = k * idim;
135 const unsigned int jki = j + ki;
136 const unsigned int kji = k + jpi;
138 for (i = 1; i <= jm1; ++i) {
139 const unsigned int ii = i * idim;
140 rhs[jki + arrayOffset] -= rhs[i + ki + arrayOffset] * rhs[j + ii + arrayOffset];
141 rhs[kji + arrayOffset] -= rhs[i + jpi + arrayOffset] * rhs[k + ii + arrayOffset];
144 rhs[jki + arrayOffset] *= rhs[jj + arrayOffset];
145 rhs[kji + arrayOffset] -= rhs[jjpi + arrayOffset] * rhs[k + ji + arrayOffset];
163 for (
unsigned int i = 0; i<
n*
n; ++i)
Namespace for new ROOT classes and functions.
MatRepSym Matrix storage representation for a symmetric matrix of dimension NxN This class is a templ...
static bool Dfact(MatRepSym< T, n > &rhs, T &det)
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
Expression wrapper class for Matrix objects.
Detrminant for a general squared matrix Function to compute the determinant from a square matrix ( ) ...
Namespace for new Math classes and functions.
static bool Dfact(MatRepStd< T, n, idim > &rhs, T &det)