mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add identity matrix constructor to RectangularMatrix
This commit is contained in:
@ -80,6 +80,11 @@ public:
|
|||||||
//- initializing all elements to the given value
|
//- initializing all elements to the given value
|
||||||
inline RectangularMatrix(const label m, const label n, const Type& val);
|
inline RectangularMatrix(const label m, const label n, const Type& val);
|
||||||
|
|
||||||
|
//- Construct for given number of rows/columns
|
||||||
|
//- initializing all elements to zero, and diagonal to one
|
||||||
|
template<class AnyType>
|
||||||
|
inline RectangularMatrix(const labelPair& dims, const Identity<AnyType>);
|
||||||
|
|
||||||
//- Construct given number of rows/columns
|
//- Construct given number of rows/columns
|
||||||
inline explicit RectangularMatrix(const labelPair& dims);
|
inline explicit RectangularMatrix(const labelPair& dims);
|
||||||
|
|
||||||
|
|||||||
@ -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>
|
template<class Type>
|
||||||
inline Foam::RectangularMatrix<Type>::RectangularMatrix
|
inline Foam::RectangularMatrix<Type>::RectangularMatrix
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user