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

@ -39,6 +39,7 @@ SourceFiles
#define RectangularMatrix_H
#include "Matrix.H"
#include "SquareMatrix.H"
#include "Identity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,7 +68,12 @@ public:
inline RectangularMatrix(const label m, const label n);
//- Construct from a block of another matrix
inline RectangularMatrix(const typename RectangularMatrix::Block&);
template<class MatrixType>
inline RectangularMatrix(const ConstMatrixBlock<MatrixType>&);
//- Construct from a block of another matrix
template<class MatrixType>
inline RectangularMatrix(const MatrixBlock<MatrixType>&);
//- Construct with given number of rows and columns
// initializing all elements to zero
@ -81,6 +87,9 @@ public:
// and value for all elements.
inline RectangularMatrix(const label m, const label n, const Type&);
//- Construct as copy of a square matrix
inline RectangularMatrix(const SquareMatrix<Type>&);
//- Construct from Istream.
inline RectangularMatrix(Istream&);
@ -97,6 +106,31 @@ public:
// Global functions and operators
template<class Type>
class typeOfInnerProduct<Type, RectangularMatrix<Type>, RectangularMatrix<Type>>
{
public:
typedef RectangularMatrix<Type> type;
};
template<class Type>
class typeOfInnerProduct<Type, RectangularMatrix<Type>, SquareMatrix<Type>>
{
public:
typedef RectangularMatrix<Type> type;
};
template<class Type>
class typeOfInnerProduct<Type, SquareMatrix<Type>, RectangularMatrix<Type>>
{
public:
typedef RectangularMatrix<Type> type;
};
template<class Type>
RectangularMatrix<Type> outer(const Field<Type>& f1, const Field<Type>& f2);