ENH: add identity matrix constructor to RectangularMatrix

This commit is contained in:
Kutalmis Bercin
2019-11-13 16:02:57 +00:00
parent 64614cfce8
commit 3a5ad7eed7
2 changed files with 22 additions and 0 deletions

View File

@ -80,6 +80,23 @@ inline Foam::RectangularMatrix<Type>::RectangularMatrix
{}
template<class Type>
template<class AnyType>
inline Foam::RectangularMatrix<Type>::RectangularMatrix
(
const labelPair& dims,
const Identity<AnyType>
)
:
Matrix<RectangularMatrix<Type>, Type>(dims.first(), dims.second(), Zero)
{
for (label i = 0; i < min(dims.first(), dims.second()); ++i)
{
this->operator()(i, i) = pTraits<Type>::one;
}
}
template<class Type>
inline Foam::RectangularMatrix<Type>::RectangularMatrix
(