62 for (Type& val : *
this)
75 for (Type& val : *
this)
79 if (
mag(val) > VSMALL)
88 template<
class CompOp>
94 List<label>
p(this->size());
95 std::iota(
p.begin(),
p.end(), 0);
100 [&](label i, label j){
return compare((*
this)[i], (*
this)[j]); }
111 if (this->size() !=
p.size())
114 <<
"Attempt to column-reorder according to an uneven list: " <<
nl 115 <<
"DiagonalMatrix diagonal size = " << this->size() <<
nl 116 <<
"Permutation list size = " <<
p.size() <<
nl 121 List<bool> pass(
p.size(),
false);
123 for (label i = 0; i <
p.size(); ++i)
134 Swap((*
this)[prev], (*
this)[j]);
158 Type* iter = Ainv.
begin();
160 for (
const Type& val : mat)
162 if (
mag(val) > VSMALL)
187 <<
"Attempt to column-reorder according to an uneven list: " <<
nl 188 <<
"DiagonalMatrix diagonal size = " << mat.
size() <<
nl 189 <<
"Permutation list size = " <<
p.
size() <<
nl 197 for (
const label i :
p)
199 reordered[j] = mat[i];
void size(const label n)
Older name for setAddressableSize.
DiagonalMatrix()=default
Default construct.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
constexpr char nl
The newline '\n' character (0x0a)
void applyPermutation(const List< label > &p)
Column-reorder this Matrix according to a given permutation labelList.
A templated (N x N) diagonal matrix of objects of <Type>, effectively containing N elements...
void sort(UList< T > &list)
Sort the list.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
iterator begin() noexcept
Return an iterator to begin traversing the UList.
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order: ...
void invert()
Return the matrix inverse into itself.
DiagonalMatrix< Type > applyPermutation(const DiagonalMatrix< Type > &mat, const List< label > &p)
Return Matrix column-reordered according to a given permutation labelList.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
List< label > sortPermutation(CompOp &compare) const
Return a sort permutation labelList according to a given comparison on the diagonal entries...
static constexpr const zero Zero
Global zero (0)