55 const label m = LLT.
m();
57 for (label i = 0; i < m; ++i)
59 for (label j = 0; j < m; ++j)
69 for (label
k = 0;
k < j; ++
k)
71 sum -= LLT(i,
k)*LLT(j,
k);
76 LLT(i, j) =
sum/LLT(j, j);
85 <<
"Cholesky decomposition failed, "
86 "matrix is not symmetric positive definite"
95template<
template<
typename>
class ListContainer>
99 const ListContainer<Type>& source
108 const SquareMatrix<Type>& LLT = *
this;
109 const label m = LLT.m();
111 for (label i = 0; i < m; ++i)
113 Type sum = source[i];
115 for (label j = 0; j < i; ++j)
117 sum = sum - LLT(i, j)*
x[j];
120 x[i] =
sum/LLT(i, i);
123 for (label i = m - 1; i >= 0; --i)
127 for (label j = i + 1; j < m; ++j)
132 x[i] =
sum/LLT(i, i);
144 solveImpl(
x, source);
156 solveImpl(
x, source);
167 solve(tresult.ref(), source);
182 solve(tresult.ref(), source);
Generic templated field type.
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
label size() const noexcept
The number of elements in the list.
Templated class to perform the Cholesky decomposition on a symmetric positive-definite matrix.
LLTMatrix()
Construct null.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label m() const noexcept
The number of rows.
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
A class for managing temporary objects.
bool decompose() const noexcept
Query the decompose flag (normally off)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
dimensionedScalar sqrt(const dimensionedScalar &ds)
errorManip< error > abort(error &err)