54 for (
label i=0; i<m; i++)
56 for (
label j=0; j<m; j++)
68 sum -= LLT(i,
k)*LLT(j,
k);
73 LLT(i, j) = sum/LLT(j, j);
77 LLT(i, i) =
sqrt(sum);
82 <<
"Cholesky decomposition failed, " 83 "matrix is not symmetric positive definite" 107 for (
label i=0; i<m; i++)
109 Type
sum = source[i];
111 for (
label j=0; j<i; j++)
113 sum = sum - LLT(i, j)*x[j];
116 x[i] = sum/LLT(i, i);
119 for (
int i=m - 1; i >= 0; i--)
123 for (
label j=i + 1; j<m; j++)
125 sum = sum - LLT(j, i)*x[j];
128 x[i] = sum/LLT(i, i);
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
T & ref() const
Return non-const reference or generate a fatal error.
dimensionedScalar sqrt(const dimensionedScalar &ds)
label k
Boltzmann constant.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Pre-declare SubField and related Field type.
void solve(Field< Type > &x, const Field< Type > &source) const
Solve the linear system with the given source.
errorManip< error > abort(error &err)
LLTMatrix()
Construct null.
label m() const
Return the number of rows.
A class for managing temporary objects.
void decompose(const SquareMatrix< Type > &M)
Perform the Cholesky decomposition of the matrix.
A templated 2D square matrix of objects of <T>, where the n x n matrix dimension is known and used fo...