48template <
unsigned int n,
unsigned int idim = n>
56 if (idim <
n ||
n <= 0) {
67 unsigned int nxch, i, j, k,
l;
73 const int arrayOffset = -
int(idim+1);
80 for (j = 1; j <=
n; ++j) {
81 const unsigned int ji = j * idim;
82 const unsigned int jj = j + ji;
85 p = std::abs(rhs[jj + arrayOffset]);
88 for (i = j + 1; i <=
n; ++i) {
89 q = std::abs(rhs[i + ji + arrayOffset]);
96 for (
l = 1;
l <=
n; ++
l) {
97 const unsigned int li =
l*idim;
98 const unsigned int jli = j + li;
99 const unsigned int kli = k + li;
100 tf = rhs[jli + arrayOffset];
101 rhs[jli + arrayOffset] = rhs[kli + arrayOffset];
102 rhs[kli + arrayOffset] = tf;
113 det *= rhs[jj + arrayOffset];
116 if (t < 1e-19 || t > 1e19) {
122 rhs[jj + arrayOffset] = 1.0f / rhs[jj + arrayOffset];
127 const unsigned int jm1 = j - 1;
128 const unsigned int jpi = (j + 1) * idim;
129 const unsigned int jjpi = j + jpi;
131 for (k = j + 1; k <=
n; ++k) {
132 const unsigned int ki = k * idim;
133 const unsigned int jki = j + ki;
134 const unsigned int kji = k + jpi;
136 for (i = 1; i <= jm1; ++i) {
137 const unsigned int ii = i * idim;
138 rhs[jki + arrayOffset] -= rhs[i + ki + arrayOffset] * rhs[j + ii + arrayOffset];
139 rhs[kji + arrayOffset] -= rhs[i + jpi + arrayOffset] * rhs[k + ii + arrayOffset];
142 rhs[jki + arrayOffset] *= rhs[jj + arrayOffset];
143 rhs[kji + arrayOffset] -= rhs[jjpi + arrayOffset] * rhs[k + ji + arrayOffset];
161 for (
unsigned int i = 0; i<
n*
n; ++i)
winID h TVirtualViewer3D TVirtualGLPainter p
Detrminant for a general squared matrix Function to compute the determinant from a square matrix ( ) ...
static bool Dfact(MatRepStd< T, n, idim > &rhs, T &det)
static bool Dfact(MatRepSym< T, n > &rhs, T &det)
Expression wrapper class for Matrix objects.
MatRepSym Matrix storage representation for a symmetric matrix of dimension NxN This class is a templ...
Namespace for new Math classes and functions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...