cleanup in Eval; instead introduce convenient typedefs in Matrix

for naming special related matrix types: RowType, ColumnType,
BlockType
This commit is contained in:
Benoit Jacob 2008-01-14 11:25:09 +00:00
parent 183bf54d27
commit e20aceb6eb
2 changed files with 22 additions and 7 deletions

View File

@ -55,13 +55,15 @@ template<typename Expression> class Eval : NoOperatorEquals,
{ {
public: public:
typedef typename Expression::Scalar Scalar; typedef typename Expression::Scalar Scalar;
typedef Matrix<Scalar, Expression::Traits::RowsAtCompileTime, Expression::Traits::ColsAtCompileTime, EIGEN_DEFAULT_MATRIX_STORAGE_ORDER, typedef Matrix<Scalar,
Expression::Traits::MaxRowsAtCompileTime, Expression::Traits::RowsAtCompileTime,
Expression::Traits::MaxColsAtCompileTime> MatrixType; Expression::Traits::ColsAtCompileTime,
typedef Expression Base; EIGEN_DEFAULT_MATRIX_STORAGE_ORDER,
friend class MatrixBase<Scalar, Expression>; Expression::Traits::MaxRowsAtCompileTime,
Expression::Traits::MaxColsAtCompileTime> Base;
Eval(const Expression& expression) : MatrixType(expression) {}
Eval() : Base() {}
explicit Eval(const Expression& other) : Base(other) {}
}; };
/** Evaluates *this, which can be any expression, and returns the obtained matrix. /** Evaluates *this, which can be any expression, and returns the obtained matrix.

View File

@ -149,6 +149,19 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols,
} }
public: public:
typedef Matrix<
Scalar,
RowsAtCompileTime == 1 ? 1 : Dynamic,
ColsAtCompileTime == 1 ? 1 : Dynamic,
StorageOrder,
RowsAtCompileTime == 1 ? 1 : MaxRowsAtCompileTime,
ColsAtCompileTime == 1 ? 1 : MaxColsAtCompileTime
> BlockType;
typedef Matrix<Scalar, RowsAtCompileTime, 1,
StorageOrder, MaxRowsAtCompileTime, 1> ColumnType;
typedef Matrix<Scalar, 1, ColsAtCompileTime,
StorageOrder, 1, MaxColsAtCompileTime> RowType;
/** \returns a const pointer to the data array of this matrix */ /** \returns a const pointer to the data array of this matrix */
const Scalar *data() const const Scalar *data() const
{ return m_array.data(); } { return m_array.data(); }