LLTMatrix: New matrix form to support Cholesky decomposition

of symmetric positive-definite matrices and the solution of associated
linear systems.
This commit is contained in:
Henry Weller
2016-03-23 15:33:03 +00:00
parent 536402d4f5
commit ddbd5f3d11
3 changed files with 258 additions and 0 deletions

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "scalarMatrices.H"
#include "LLTMatrix.H"
#include "vector.H"
#include "tensor.H"
#include "IFstream.H"
@ -139,6 +140,27 @@ int main(int argc, char *argv[])
Info<< "det = " << detDecomposed(squareMatrix, sign) << endl;
}
{
scalarSquareMatrix squareMatrix(3, Zero);
squareMatrix(0, 0) = 4;
squareMatrix(0, 1) = 12;
squareMatrix(0, 2) = -16;
squareMatrix(1, 0) = 12;
squareMatrix(1, 1) = 37;
squareMatrix(1, 2) = -43;
squareMatrix(2, 0) = -16;
squareMatrix(2, 1) = -43;
squareMatrix(2, 2) = 98;
scalarField source(3, 1);
LLTMatrix<scalar> LLT(squareMatrix);
scalarField x(LLT.solve(source));
Info<< "LLT solve residual " << (squareMatrix*x - source) << endl;
}
Info<< "\nEnd\n" << endl;
return 0;