36 const SymmetricSquareMatrix<Type>& matrix
39 const label
n = matrix.n();
43 for (label i = 0; i <
n; ++i)
45 inv(i, i) = 1.0/matrix(i, i);
47 for (label j = 0; j < i; ++j)
51 for (label
k = j;
k < i; ++
k)
56 inv(i, j) =
sum/matrix(i, i);
60 SymmetricSquareMatrix<Type> result(
n,
Foam::zero{});
62 for (label
k = 0;
k <
n; ++
k)
64 for (label i = 0; i <=
k; ++i)
66 for (label j = 0; j <=
k; ++j)
80 const SymmetricSquareMatrix<Type>& matrix
83 SymmetricSquareMatrix<Type> matrixTmp(matrix);
93 Type diagProduct = pTraits<Type>::one;
95 for (label i = 0; i < matrix.m(); ++i)
97 diagProduct *= matrix(i, i);
100 return sqr(diagProduct);
105Type
Foam::det(
const SymmetricSquareMatrix<Type>& matrix)
107 SymmetricSquareMatrix<Type> matrixTmp(matrix);
117template<
class AnyType>
122 for (label i=0; i < this->
n(); ++i)
124 this->operator()(i, i) = pTraits<Type>::one;
Templated identity and dual space identity tensors derived from SphericalTensor.
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
constexpr Matrix() noexcept
const Type & operator()(const label irow, const label jcol) const
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.
SymmetricSquareMatrix & operator=(const SymmetricSquareMatrix &)=default
Copy assignment.
A traits class, which is primarily used for primitives and vector-space.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
dimensionedScalar det(const dimensionedSphericalTensor &dt)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
scalar detDecomposed(const SquareMatrix< Type > &matrix, const label sign)
Return the determinant of the LU decomposed SquareMatrix.
SymmetricSquareMatrix< Type > invDecomposed(const SymmetricSquareMatrix< Type > &)
Return the LU decomposed SymmetricSquareMatrix inverse.