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:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user