ENH: scalarMatrices: Add determinant calculation

This commit is contained in:
laurence
2013-06-07 08:57:04 +01:00
parent c574abb243
commit f5bfc5d2e7
5 changed files with 126 additions and 7 deletions

View File

@ -116,17 +116,19 @@ int main(int argc, char *argv[])
squareMatrix[2][1] = -43;
squareMatrix[2][2] = 98;
const scalarSquareMatrix squareMatrixCopy = squareMatrix;
Info<< nl << "Square Matrix = " << squareMatrix << endl;
scalarDiagonalMatrix rhs(3, 0);
rhs[0] = 1;
rhs[1] = 2;
rhs[2] = 3;
Info<< "det = " << det(squareMatrixCopy) << endl;
LUsolve(squareMatrix, rhs);
labelList rhs(3, 0);
label sign;
LUDecompose(squareMatrix, rhs, sign);
Info<< "Decomposition = " << squareMatrix << endl;
Info<< "Solution = " << rhs << endl;
Info<< "Pivots = " << rhs << endl;
Info<< "Sign = " << sign << endl;
Info<< "det = " << detDecomposed(squareMatrix, sign) << endl;
}
Info<< "\nEnd\n" << endl;