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>
91 const Identity<AnyType>
94 Matrix<SquareMatrix<Type>, Type>(dims,
Zero)
98 for (label i = 0; i < dims.first(); ++i)
111 Matrix<SquareMatrix<Type>, Type>(dims)
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))
331 for (label i = 0; i < f1f2T.m(); ++i)
333 for (label j = 0; j < f1f2T.n(); ++j)
335 f1f2T(i, j) = f1[i]*f2[j];
350 #undef CHECK_MATRIX_IS_SQUARE const T & first() const noexcept
Access the first element.
void size(const label n)
Older name for setAddressableSize.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
patchWriters resize(patchIds.size())
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.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
autoPtr< SquareMatrix< Type > > clone() const
Clone.
label n() const noexcept
The number of columns.
A traits class, which is primarily used for primitives.
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.
A templated block of an (m x n) matrix of type <MatrixType>.
bool symmetric() const
Return true if the square matrix is effectively symmetric/Hermitian.
void shallowResize(const label m)
Resize the matrix without reallocating storage (unsafe)
Generic templated field type.
A templated (M x N) rectangular matrix of objects of <Type>, containing M*N elements, derived from Matrix.
errorManip< error > abort(error &err)
label m() const noexcept
The number of rows.
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order: ...
SquareMatrix()=default
Default construct.
#define CHECK_MATRIX_IS_SQUARE(a, b)
Pair< label > labelPair
A pair of labels.
void setSize(const label m)
Resize the matrix preserving the elements.
void resize(const label m)
Resize the matrix preserving the elements.
Foam::SquareMatrix< Type > symmOuter(const Field< Type > &f1, const Field< Type > &f2)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Templated identity and dual space identity tensors derived from SphericalTensor.
SquareMatrix & operator=(const SquareMatrix &)=default
Copy assignment.
const T & second() const noexcept
Access the second element.
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix...
bool tridiagonal() const
Return true if the square matrix is reduced tridiagonal.
static constexpr const zero Zero
Global zero (0)