43 std::iota(
p.begin(),
p.end(), 0);
48 [&](label i, label j){ return compare((*this)(i,i), (*this)(j,j)); }
59 if (this->m() !=
p.size())
62 <<
"Attempt to column-reorder according to an uneven list: " <<
nl
63 <<
"SquareMatrix diagonal size = " << this->m() <<
nl
64 <<
"Permutation list size = " <<
p.size() <<
nl
72 for (
const label i :
p)
74 reordered.
subColumn(j) = this->subColumn(i);
78 this->transfer(reordered);
85template<
class AnyType>
90 for (label i = 0; i < this->
n(); ++i)
114 for (label i = 0; i < matrix.
m(); ++i)
116 diagProduct *= matrix(i, i);
119 return sign*diagProduct;
162 <<
"Attempt to column-reorder according to an uneven list: " <<
nl
163 <<
"SquareMatrix diagonal size = " << mat.
m() <<
nl
164 <<
"Permutation list size = " <<
p.
size() <<
nl
172 for (
const label i :
p)
Templated identity and dual space identity tensors derived from SphericalTensor.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
labelPair sizes() const
Return row/column sizes.
label m() const noexcept
The number of rows.
ConstMatrixBlock< mType > subColumn(const label colIndex, const label rowIndex=0, label len=-1) const
Return const column or column's subset of Matrix.
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
List< label > sortPermutation(CompOp &compare) const
void applyPermutation(const List< label > &p)
SquareMatrix & operator=(const SquareMatrix &)=default
Copy assignment.
void size(const label n)
Older name for setAddressableSize.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
SquareMatrix< Type > type
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
dimensionedScalar sign(const dimensionedScalar &ds)
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
errorManip< error > abort(error &err)
DiagonalMatrix< Type > applyPermutation(const DiagonalMatrix< Type > &mat, const List< label > &p)
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)