21 lines
373 B
C++
21 lines
373 B
C++
#include "ABACUS.h"
|
|
using namespace std;
|
|
|
|
DP ABACUS::det_LU (SQMat_DP a)
|
|
{
|
|
// Returns the determinant of matrix a, through LU decomposition
|
|
// In order to preserve the original matrix, it is copied first.
|
|
|
|
Vect_INT indx(a.size());
|
|
|
|
SQMat_DP mat = a;
|
|
|
|
DP d;
|
|
|
|
ABACUS::ludcmp (mat, indx, d);
|
|
|
|
for (int j = 0; j < mat.size(); j++) d *= mat[j][j];
|
|
|
|
return(d);
|
|
}
|