remove MakeBase, use ei_dense_xpr_base instead

(yes, it was only used in dense xprs anyway)
This commit is contained in:
Benoit Jacob 2010-04-23 12:16:30 -04:00
parent a16ba80bfa
commit e3e34b5920
19 changed files with 52 additions and 52 deletions

View File

@ -54,8 +54,6 @@ template<typename Derived> class ArrayBase
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** The base class for a given storage type. */
typedef ArrayBase StorageBaseType;
/** Construct the base class type for the derived class OtherDerived */
template <typename OtherDerived> struct MakeBase { typedef ArrayBase<OtherDerived> Type; };
using ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>::operator*;

View File

@ -44,6 +44,7 @@ struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
{
typedef typename MatrixType::Scalar Scalar;
typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
typedef typename ei_traits<MatrixType>::XprKind XprKind;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
enum {
@ -65,11 +66,11 @@ struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
};
template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
: public MatrixType::template MakeBase< Replicate<MatrixType,RowFactor,ColFactor> >::Type
: public ei_dense_xpr_base< Replicate<MatrixType,RowFactor,ColFactor> >::type
{
public:
typedef typename MatrixType::template MakeBase< Replicate<MatrixType,RowFactor,ColFactor> >::Type Base;
typedef typename ei_dense_xpr_base<Replicate>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Replicate)
template<typename OriginalMatrixType>

View File

@ -47,6 +47,7 @@ struct ei_traits<Reverse<MatrixType, Direction> >
{
typedef typename MatrixType::Scalar Scalar;
typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
typedef typename ei_traits<MatrixType>::XprKind XprKind;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
enum {
@ -75,11 +76,11 @@ template<typename PacketScalar> struct ei_reverse_packet_cond<PacketScalar,false
};
template<typename MatrixType, int Direction> class Reverse
: public MatrixType::template MakeBase< Reverse<MatrixType, Direction> >::Type
: public ei_dense_xpr_base< Reverse<MatrixType, Direction> >::type
{
public:
typedef typename MatrixType::template MakeBase< Reverse<MatrixType, Direction> >::Type Base;
typedef typename ei_dense_xpr_base<Reverse>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Reverse)
using Base::IsRowMajor;

View File

@ -47,6 +47,7 @@ struct ei_traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
{
typedef typename ei_traits<ThenMatrixType>::Scalar Scalar;
typedef Dense StorageKind;
typedef typename ei_traits<ThenMatrixType>::XprKind XprKind;
typedef typename ConditionMatrixType::Nested ConditionMatrixNested;
typedef typename ThenMatrixType::Nested ThenMatrixNested;
typedef typename ElseMatrixType::Nested ElseMatrixNested;
@ -64,11 +65,11 @@ struct ei_traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
class Select : ei_no_assignment_operator,
public ThenMatrixType::template MakeBase< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::Type
public ei_dense_xpr_base< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::type
{
public:
typedef typename ThenMatrixType::template MakeBase< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::Type Base;
typedef typename ei_dense_xpr_base<Select>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Select)
Select(const ConditionMatrixType& conditionMatrix,

View File

@ -52,6 +52,7 @@ struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
{
typedef typename MemberOp::result_type Scalar;
typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
typedef typename ei_traits<MatrixType>::XprKind XprKind;
typedef typename MatrixType::Scalar InputScalar;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;
@ -76,11 +77,11 @@ struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
template< typename MatrixType, typename MemberOp, int Direction>
class PartialReduxExpr : ei_no_assignment_operator,
public MatrixType::template MakeBase< PartialReduxExpr<MatrixType, MemberOp, Direction> >::Type
public ei_dense_xpr_base< PartialReduxExpr<MatrixType, MemberOp, Direction> >::type
{
public:
typedef typename MatrixType::template MakeBase< PartialReduxExpr<MatrixType, MemberOp, Direction> >::Type Base;
typedef typename ei_dense_xpr_base<PartialReduxExpr>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(PartialReduxExpr)
typedef typename ei_traits<PartialReduxExpr>::MatrixTypeNested MatrixTypeNested;
typedef typename ei_traits<PartialReduxExpr>::_MatrixTypeNested _MatrixTypeNested;

View File

@ -104,7 +104,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool HasDirectAccess> c
{
public:
typedef typename XprType::template MakeBase<Block>::Type Base;
typedef typename ei_dense_xpr_base<Block>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Block)
class InnerIterator;

View File

@ -153,12 +153,12 @@ class CwiseBinaryOp : ei_no_assignment_operator,
template<typename BinaryOp, typename Lhs, typename Rhs>
class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Dense>
: public Lhs::template MakeBase< CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::Type
: public ei_dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type
{
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
public:
typedef typename Lhs::template MakeBase< CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::Type Base;
typedef typename ei_dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const

View File

@ -56,11 +56,11 @@ struct ei_traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : ei_traits<PlainO
template<typename NullaryOp, typename PlainObjectType>
class CwiseNullaryOp : ei_no_assignment_operator,
public PlainObjectType::template MakeBase< CwiseNullaryOp<NullaryOp, PlainObjectType> >::Type
public ei_dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type
{
public:
typedef typename PlainObjectType::template MakeBase< CwiseNullaryOp<NullaryOp, PlainObjectType> >::Type Base;
typedef typename ei_dense_xpr_base<CwiseNullaryOp>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp)
CwiseNullaryOp(int rows, int cols, const NullaryOp& func = NullaryOp())

View File

@ -99,13 +99,13 @@ class CwiseUnaryOp : ei_no_assignment_operator,
// It can be used for any expression types implementing the dense concept.
template<typename UnaryOp, typename XprType>
class CwiseUnaryOpImpl<UnaryOp,XprType,Dense>
: public XprType::template MakeBase< CwiseUnaryOp<UnaryOp, XprType> >::Type
: public ei_dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type
{
typedef CwiseUnaryOp<UnaryOp, XprType> Derived;
public:
typedef typename XprType::template MakeBase< CwiseUnaryOp<UnaryOp, XprType> >::Type Base;
typedef typename ei_dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const

View File

@ -91,13 +91,13 @@ class CwiseUnaryView : ei_no_assignment_operator,
template<typename ViewOp, typename MatrixType>
class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
: public MatrixType::template MakeBase< CwiseUnaryView<ViewOp, MatrixType> >::Type
: public ei_dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type
{
typedef CwiseUnaryView<ViewOp, MatrixType> Derived;
public:
typedef typename MatrixType::template MakeBase< CwiseUnaryView<ViewOp, MatrixType> >::Type Base;
typedef typename ei_dense_xpr_base<CwiseUnaryView<ViewOp, MatrixType> >::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const

View File

@ -50,24 +50,6 @@ struct ei_outer_stride_at_compile_time<Derived, false>
enum { ret = 0 };
};
template<typename Derived, typename XprKind = typename ei_traits<Derived>::XprKind>
struct ei_dense_xpr_base
{
/* ei_dense_xpr_base should only ever be used on dense expressions, thus falling either into the MatrixXpr or into the ArrayXpr cases */
};
template<typename Derived>
struct ei_dense_xpr_base<Derived, MatrixXpr>
{
typedef MatrixBase<Derived> type;
};
template<typename Derived>
struct ei_dense_xpr_base<Derived, ArrayXpr>
{
typedef ArrayBase<Derived> type;
};
/** \class DenseBase
*
* \brief Base class for all dense matrices, vectors, and arrays

View File

@ -64,7 +64,7 @@ struct ei_traits<Diagonal<MatrixType,Index> >
};
template<typename MatrixType, int Index> class Diagonal
: public MatrixType::template MakeBase< Diagonal<MatrixType,Index> >::Type
: public ei_dense_xpr_base< Diagonal<MatrixType,Index> >::type
{
// some compilers may fail to optimize std::max etc in case of compile-time constants...
EIGEN_STRONG_INLINE int absIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); }
@ -73,7 +73,7 @@ template<typename MatrixType, int Index> class Diagonal
public:
typedef typename MatrixType::template MakeBase<Diagonal>::Type Base;
typedef typename ei_dense_xpr_base<Diagonal>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal)
inline Diagonal(const MatrixType& matrix, int index = Index) : m_matrix(matrix), m_index(index) {}

View File

@ -41,11 +41,11 @@ struct ei_traits<ForceAlignedAccess<ExpressionType> > : public ei_traits<Express
{};
template<typename ExpressionType> class ForceAlignedAccess
: public ExpressionType::template MakeBase< ForceAlignedAccess<ExpressionType> >::Type
: public ei_dense_xpr_base< ForceAlignedAccess<ExpressionType> >::type
{
public:
typedef typename ExpressionType::template MakeBase<ForceAlignedAccess<ExpressionType> >::Type Base;
typedef typename ei_dense_xpr_base<ForceAlignedAccess>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}

View File

@ -58,8 +58,6 @@ template<typename Derived> class MatrixBase
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** The base class for a given storage type. */
typedef MatrixBase StorageBaseType;
/** Construct the base class type for the derived class OtherDerived */
template <typename OtherDerived> struct MakeBase { typedef MatrixBase<OtherDerived> Type; };
typedef typename ei_traits<Derived>::Scalar Scalar;
typedef typename ei_packet_traits<Scalar>::type PacketScalar;

View File

@ -42,11 +42,11 @@ struct ei_traits<NestByValue<ExpressionType> > : public ei_traits<ExpressionType
{};
template<typename ExpressionType> class NestByValue
: public ExpressionType::template MakeBase< NestByValue<ExpressionType> >::Type
: public ei_dense_xpr_base< NestByValue<ExpressionType> >::type
{
public:
typedef typename ExpressionType::template MakeBase<NestByValue<ExpressionType> >::Type Base;
typedef typename ei_dense_xpr_base<NestByValue>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}

View File

@ -2,7 +2,7 @@
// for linear algebra.
//
// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
// Copyright (C) 2009-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -53,11 +53,11 @@ struct ei_nested<ReturnByValue<Derived>, n, PlainObject>
};
template<typename Derived> class ReturnByValue
: public ei_traits<Derived>::ReturnType::template MakeBase<ReturnByValue<Derived> >::Type
: public ei_dense_xpr_base< ReturnByValue<Derived> >::type
{
public:
typedef typename ei_traits<Derived>::ReturnType ReturnType;
typedef typename ReturnType::template MakeBase<ReturnByValue<Derived> >::Type Base;
typedef typename ei_dense_xpr_base<ReturnByValue>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue)
template<typename Dest>

View File

@ -42,11 +42,11 @@ template<typename BinaryOp, typename MatrixType>
struct ei_traits<SelfCwiseBinaryOp<BinaryOp,MatrixType> > : ei_traits<MatrixType> {};
template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
: public MatrixType::template MakeBase< SelfCwiseBinaryOp<BinaryOp, MatrixType> >::Type
: public ei_dense_xpr_base< SelfCwiseBinaryOp<BinaryOp, MatrixType> >::type
{
public:
typedef typename MatrixType::template MakeBase< SelfCwiseBinaryOp<BinaryOp, MatrixType> >::Type Base;
typedef typename ei_dense_xpr_base<SelfCwiseBinaryOp>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(SelfCwiseBinaryOp)
typedef typename ei_packet_traits<Scalar>::type Packet;

View File

@ -35,11 +35,11 @@ template<typename ExpressionType>
struct ei_traits<SwapWrapper<ExpressionType> > : ei_traits<ExpressionType> {};
template<typename ExpressionType> class SwapWrapper
: public ExpressionType::template MakeBase<SwapWrapper<ExpressionType> >::Type
: public ei_dense_xpr_base<SwapWrapper<ExpressionType> >::type
{
public:
typedef typename ExpressionType::template MakeBase<SwapWrapper<ExpressionType> >::Type Base;
typedef typename ei_dense_xpr_base<SwapWrapper>::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper)
typedef typename ei_packet_traits<Scalar>::type Packet;

View File

@ -303,6 +303,24 @@ template<unsigned int Flags> struct ei_are_flags_consistent
enum { ret = true };
};
template<typename Derived, typename XprKind = typename ei_traits<Derived>::XprKind>
struct ei_dense_xpr_base
{
/* ei_dense_xpr_base should only ever be used on dense expressions, thus falling either into the MatrixXpr or into the ArrayXpr cases */
};
template<typename Derived>
struct ei_dense_xpr_base<Derived, MatrixXpr>
{
typedef MatrixBase<Derived> type;
};
template<typename Derived>
struct ei_dense_xpr_base<Derived, ArrayXpr>
{
typedef ArrayBase<Derived> type;
};
/** \internal Helper base class to add a scalar multiple operator
* overloads for complex types */
template<typename Derived,typename Scalar,typename OtherScalar,