35 template<
class CompOp>
46 [&](label i, label j){
return compare((*
this)(i,i), (*
this)(j,j)); }
57 if (this->m() !=
p.size())
60 <<
"Attempt to column-reorder according to an uneven list: " <<
nl 61 <<
"SquareMatrix diagonal size = " << this->m() <<
nl 62 <<
"Permutation list size = " <<
p.size() <<
nl 67 SquareMatrix<Type> reordered(this->sizes());
70 for (
const label i :
p)
72 reordered.subColumn(j) = this->subColumn(i);
76 this->transfer(reordered);
83 template<
class AnyType>
88 for (label i = 0; i < this->
n(); ++i)
90 this->operator()(i, i) = pTraits<Type>::one;
112 for (label i = 0; i < matrix.
m(); ++i)
114 diagProduct *= matrix(i, i);
117 return sign*diagProduct;
160 <<
"Attempt to column-reorder according to an uneven list: " <<
nl 161 <<
"SquareMatrix diagonal size = " << mat.
m() <<
nl 162 <<
"Permutation list size = " <<
p.
size() <<
nl 170 for (
const label i :
p)
183 class typeOfInnerProduct<Type, SquareMatrix<Type>, SquareMatrix<Type>>
dimensionedScalar sign(const dimensionedScalar &ds)
void size(const label n)
Older name for setAddressableSize.
ConstMatrixBlock< mType > subColumn(const label colIndex, const label rowIndex=0, label len=-1) const
Return const column or column's subset of Matrix.
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.
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
scalar detDecomposed(const SquareMatrix< Type > &matrix, const label sign)
Return the determinant of the LU decomposed SquareMatrix.
constexpr char nl
The newline '\n' character (0x0a)
A traits class, which is primarily used for primitives and vector-space.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
labelPair sizes() const
Return row/column sizes.
void sort(UList< T > &list)
Sort the list.
labelList sortPermutation(CompOp &compare) const
Return a sort permutation using the given comparison operator on the diagonal entries.
errorManip< error > abort(error &err)
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order: ...
label m() const noexcept
The number of rows.
DiagonalMatrix< Type > applyPermutation(const DiagonalMatrix< Type > &mat, const List< label > &p)
Return Matrix column-reordered according to a given permutation labelList.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Templated identity and dual space identity tensors derived from SphericalTensor.
SquareMatrix & operator=(const SquareMatrix &)=default
Copy assignment.
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix...
void applyPermutation(const labelUList &p)
Column-reorder this Matrix according to the given permutation.