mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: scalarMatrices: Add determinant calculation
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user