Go to the documentation of this file.
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"
95 template<
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)
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);
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
Templated class to perform the Cholesky decomposition on a symmetric positive-definite matrix.
Generic templated field type.
void solve(List< Type > &x, const UList< Type > &source) const
LLTMatrix()
Construct null.
label size() const noexcept
The number of elements in the list.
errorManip< error > abort(error &err)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label m() const noexcept
The number of rows.
dimensionedScalar sqrt(const dimensionedScalar &ds)
label k
Boltzmann constant.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
void size(const label n)
Older name for setAddressableSize.
void decompose(const SquareMatrix< Type > &mat)
Copy matrix and perform Cholesky decomposition.