SquareMatrix, RectangularMatrix: Updated block handling

Added 'typeOfInnerProduct' support to ensure the correct type is
returned from the matrix product operator.
This commit is contained in:
Henry Weller
2016-03-23 12:52:35 +00:00
parent 878866b16e
commit ecc608d1c5
6 changed files with 205 additions and 12 deletions

View File

@ -44,9 +44,21 @@ inline Foam::RectangularMatrix<Type>::RectangularMatrix
template<class Type>
template<class MatrixType>
inline Foam::RectangularMatrix<Type>::RectangularMatrix
(
const typename RectangularMatrix::Block& block
const ConstMatrixBlock<MatrixType>& block
)
:
Matrix<RectangularMatrix<Type>, Type>(block)
{}
template<class Type>
template<class MatrixType>
inline Foam::RectangularMatrix<Type>::RectangularMatrix
(
const MatrixBlock<MatrixType>& block
)
:
Matrix<RectangularMatrix<Type>, Type>(block)
@ -74,7 +86,7 @@ inline Foam::RectangularMatrix<Type>::RectangularMatrix
:
Matrix<RectangularMatrix<Type>, Type>(n, n, Zero)
{
for (label i = 0; i < n; ++i)
for (label i = 0; i < n; i++)
{
this->operator()(i, i) = I;
}
@ -93,6 +105,16 @@ inline Foam::RectangularMatrix<Type>::RectangularMatrix
{}
template<class Type>
inline Foam::RectangularMatrix<Type>::RectangularMatrix
(
const SquareMatrix<Type>& SM
)
:
Matrix<RectangularMatrix<Type>, Type>(SM)
{}
template<class Type>
inline Foam::RectangularMatrix<Type>::RectangularMatrix(Istream& is)
:
@ -136,9 +158,9 @@ inline Foam::RectangularMatrix<Type> outer
{
RectangularMatrix<Type> f1f2T(f1.size(), f2.size());
for (label i=0; i<f1f2T.m(); ++i)
for (label i=0; i<f1f2T.m(); i++)
{
for (label j=0; j<f1f2T.n(); ++j)
for (label j=0; j<f1f2T.n(); j++)
{
f1f2T(i, j) = f1[i]*f2[j];
}