LLTMatrix: Add support for updating the decomposition from a new matrix
This commit is contained in:
parent
1ec47384bb
commit
1fdcefb464
@ -25,12 +25,25 @@ License
|
||||
|
||||
#include "LLTMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::LLTMatrix<Type>::decompose()
|
||||
Foam::LLTMatrix<Type>::LLTMatrix(const SquareMatrix<Type>& M)
|
||||
{
|
||||
decompose(M);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::LLTMatrix<Type>::decompose(const SquareMatrix<Type>& M)
|
||||
{
|
||||
SquareMatrix<Type>& LLT = *this;
|
||||
|
||||
// Initialize the LLT decomposition matrix to M
|
||||
LLT = M;
|
||||
|
||||
const label m = LLT.m();
|
||||
|
||||
for (label i=0; i<m; i++)
|
||||
@ -70,19 +83,6 @@ void Foam::LLTMatrix<Type>::decompose()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::LLTMatrix<Type>::LLTMatrix(const SquareMatrix<Type>& M)
|
||||
:
|
||||
SquareMatrix<Type>(M)
|
||||
{
|
||||
decompose();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::LLTMatrix<Type>::solve
|
||||
(
|
||||
|
@ -56,10 +56,6 @@ class LLTMatrix
|
||||
:
|
||||
public SquareMatrix<Type>
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Perform the Cholesky decomposition of the matrix
|
||||
void decompose();
|
||||
|
||||
public:
|
||||
|
||||
@ -71,6 +67,9 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Perform the Cholesky decomposition of the matrix
|
||||
void decompose(const SquareMatrix<Type>& M);
|
||||
|
||||
//- Solve the linear system with the given source
|
||||
// and returning the solution in the Field argument x
|
||||
void solve(Field<Type>& x, const Field<Type>& source) const;
|
||||
|
Loading…
Reference in New Issue
Block a user