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)
141 const UList<Type>& source
144 solveImpl(
x, source);
156 solveImpl(
x, source);
167 solve(tresult.ref(), source);
182 solve(tresult.ref(), source);
void size(const label n)
Older name for setAddressableSize.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void decompose(const SquareMatrix< Type > &mat)
Copy matrix and perform Cholesky decomposition.
dimensionedScalar sqrt(const dimensionedScalar &ds)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
void solve(List< Type > &x, const UList< Type > &source) const
Solve the linear system with the given source and return the solution in the argument x...
label k
Boltzmann constant.
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
Generic templated field type.
label size() const noexcept
The number of elements in the list.
errorManip< error > abort(error &err)
label m() const noexcept
The number of rows.
LLTMatrix()
Construct null.
A class for managing temporary objects.
Templated class to perform the Cholesky decomposition on a symmetric positive-definite matrix...
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix...
static constexpr const zero Zero
Global zero (0)