29#define CHECK_MATRIX_IS_SQUARE(a, b) \
32 FatalErrorInFunction \
33 << "Attempt to create a non-square matrix (" \
34 << a << ", " << b << ')' << nl << abort(FatalError); \
70template<
class AnyType>
79 for (label i = 0; i <
n; ++i)
87template<
class AnyType>
91 const Identity<AnyType>
94 Matrix<SquareMatrix<Type>, Type>(dims,
Foam::zero{})
98 for (label i = 0; i < dims.first(); ++i)
158template<
class MatrixType>
171template<
class MatrixType>
258 for (label
n = 0;
n < this->
n() - 1; ++n)
260 for (label m = this->m() - 1;
n < m; --m)
262 if (SMALL <
mag((*
this)(
n, m) - (*
this)(m,
n)))
275 for (label i = 0; i < this->m(); ++i)
277 for (label j = 0; j < this->
n(); ++j)
279 const Type& val = (*this)(i, j);
281 if ((i == j) || (i - 1 == j) || (i + 1 == j))
283 if (
mag(val) < SMALL)
288 else if (SMALL <
mag(val))
338 for (label i = 0; i < f1f2T.
m(); ++i)
340 for (label j = 0; j < f1f2T.
n(); ++j)
342 f1f2T(i, j) = f1[i]*f2[j];
357#undef CHECK_MATRIX_IS_SQUARE
#define CHECK_MATRIX_IS_SQUARE(a, b)
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Templated identity and dual space identity tensors derived from SphericalTensor.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A templated block of an (m x n) matrix of type <MatrixType>.
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
void transfer(Matrix< SquareMatrix< Type >, Type > &mat)
const T & first() const noexcept
Access the first element.
const T & second() const noexcept
Access the second element.
A templated (M x N) rectangular matrix of objects of <Type>, containing M*N elements,...
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
bool symmetric() const
Return true if the square matrix is effectively symmetric/Hermitian.
void resize_nocopy(const label n)
Resize the matrix without preserving existing content.
SquareMatrix()=default
Default construct.
autoPtr< SquareMatrix< Type > > clone() const
Clone.
bool tridiagonal() const
Return true if the square matrix is reduced tridiagonal.
void setSize(const label m)
Resize the matrix preserving the elements.
void shallowResize(const label m)
Resize the matrix without reallocating storage (unsafe).
SquareMatrix & operator=(const SquareMatrix &)=default
Copy assignment.
void resize(const label m)
Resize the matrix preserving the elements.
void size(const label n)
Older name for setAddressableSize.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
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 ...
patchWriters resize(patchIds.size())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Pair< label > labelPair
A pair of labels.
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.
Foam::SquareMatrix< Type > symmOuter(const Field< Type > &f1, const Field< Type > &f2)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...