* make sum and redux honor EvalBeforeNestingBit too

* fix MSVC issues (hopefully)
This commit is contained in:
Gael Guennebaud
2009-01-28 21:09:08 +00:00
parent cc6159743d
commit 42b237b83a
3 changed files with 25 additions and 38 deletions

View File

@@ -38,6 +38,27 @@ class DiagonalMatrixBase : ei_no_assignment_operator,
protected:
typedef typename ei_cleantype<CoeffsVectorType>::type _CoeffsVectorType;
template<typename OtherDerived,
bool IsVector = OtherDerived::IsVectorAtCompileTime,
bool IsDiagonal = (OtherDerived::Flags&Diagonal)==Diagonal>
struct construct_from_expression;
// = vector
template<typename OtherDerived>
struct construct_from_expression<OtherDerived,true,false>
{
static void run(Derived& dst, const OtherDerived& src)
{ dst.diagonal() = src; }
};
// = diagonal expression
template<typename OtherDerived, bool IsVector>
struct construct_from_expression<OtherDerived,IsVector,true>
{
static void run(Derived& dst, const OtherDerived& src)
{ dst.diagonal() = src.diagonal(); }
};
/** Default constructor without initialization */
inline DiagonalMatrixBase() {}
@@ -50,27 +71,6 @@ class DiagonalMatrixBase : ei_no_assignment_operator,
construct_from_expression<OtherDerived>::run(derived(),other.derived());
}
template<typename OtherDerived,
bool IsVector = OtherDerived::IsVectorAtCompileTime,
bool IsDiagonal = (OtherDerived::Flags&Diagonal)==Diagonal>
struct construct_from_expression;
// = vector
template<typename OtherDerived>
struct construct_from_expression<OtherDerived,true,false>
{
static void run(Derived& dst, const OtherDerived& src)
{ dst.m_coeffs = src; }
};
// = diagonal
template<typename OtherDerived, bool IsVector>
struct construct_from_expression<OtherDerived,IsVector,true>
{
static void run(Derived& dst, const OtherDerived& src)
{ dst.m_coeffs = src.diagonal(); }
};
public:
inline DiagonalMatrixBase(const _CoeffsVectorType& coeffs) : m_coeffs(coeffs)
@@ -79,21 +79,6 @@ class DiagonalMatrixBase : ei_no_assignment_operator,
ei_assert(coeffs.size() > 0);
}
template<typename OtherDerived, bool IsVector=OtherDerived::IsVectorAtCompileTime>
struct ei_diagonal_product_ctor {
static void run(DiagonalMatrixBase& dst, const OtherDerived& src)
{ dst.m_coeffs = src; }
};
template<typename OtherDerived>
struct ei_diagonal_product_ctor<OtherDerived,false> {
static void run(DiagonalMatrixBase& dst, const OtherDerived& src)
{
EIGEN_STATIC_ASSERT((OtherDerived::Flags&Diagonal)==Diagonal, THIS_METHOD_IS_ONLY_FOR_DIAGONAL_MATRIX);
dst.m_coeffs = src.diagonal();
}
};
template<typename NewType>
inline DiagonalMatrixWrapper<NestByValue<CwiseUnaryOp<ei_scalar_cast_op<Scalar, NewType>, _CoeffsVectorType> > > cast() const
{