Go to the documentation of this file.
29 #define CHECK_MATRIX_IS_SQUARE(a, b) \
32 FatalErrorInFunction \
33 << "Attempt to create a non-square matrix (" \
34 << a << ", " << b << ')' << nl << abort(FatalError); \
70 template<
class AnyType>
79 for (label i = 0; i <
n; ++i)
87 template<
class AnyType>
98 for (label i = 0; i < dims.first(); ++i)
158 template<
class MatrixType>
171 template<
class MatrixType>
251 for (label
n = 0;
n < this->
n() - 1; ++
n)
253 for (label m = this->m() - 1;
n < m; --m)
255 if (SMALL <
mag((*
this)(
n, m) - (*
this)(m,
n)))
268 for (label i = 0; i < this->m(); ++i)
270 for (label j = 0; j < this->
n(); ++j)
272 const Type& val = (*this)(i, j);
274 if ((i == j) || (i - 1 == j) || (i + 1 == j))
276 if (
mag(val) < SMALL)
281 else if (SMALL <
mag(val))
324 for (label i = 0; i < f1f2T.m(); ++i)
326 for (label j = 0; j < f1f2T.n(); ++j)
328 f1f2T(i, j) = f1[i]*f2[j];
343 #undef CHECK_MATRIX_IS_SQUARE
Foam::SquareMatrix< Type > symmOuter(const Field< Type > &f1, const Field< Type > &f2)
const T & second() const noexcept
Return second element, which is also the last element.
autoPtr< SquareMatrix< Type > > clone() const
Clone.
label n() const noexcept
The number of columns.
static constexpr const zero Zero
Global zero (0)
void resize(const label m)
Resize the matrix preserving the elements.
SquareMatrix()=default
Default construct.
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
patchWriters resize(patchIds.size())
Generic templated field type.
Templated identity and dual space identity tensors derived from SphericalTensor.
A templated block of an (m x n) matrix of type <MatrixType>.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool symmetric() const
Return true if the square matrix is effectively symmetric/Hermitian.
A templated (M x N) rectangular matrix of objects of <Type>, containing M*N elements,...
bool tridiagonal() const
Return true if the square matrix is reduced tridiagonal.
errorManip< error > abort(error &err)
SquareMatrix & operator=(const SquareMatrix &)=default
Copy assignment.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
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.
A traits class, which is primarily used for primitives.
#define CHECK_MATRIX_IS_SQUARE(a, b)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void setSize(const label m)
Resize the matrix preserving the elements.
void shallowResize(const label m)
Resize the matrix without reallocating storage (unsafe)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...