diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-12-22 17:45:37 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-12-22 17:45:37 -0500 |
commit | 75b7d98665dd144c44d7a113c6613f5f998be626 (patch) | |
tree | bc75d316e2ed8e679e744bc34f159dcb0f285243 /Eigen/src/Core/VectorwiseOp.h | |
parent | 3b6d97b51a7e7a4b0c69ae6be44b1c16d72c2e80 (diff) |
bug #54 - really fix const correctness except in Sparse
Diffstat (limited to 'Eigen/src/Core/VectorwiseOp.h')
-rw-r--r-- | Eigen/src/Core/VectorwiseOp.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index ab6089794..8e1a337ee 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -183,7 +183,8 @@ template<typename ExpressionType, int Direction> class VectorwiseOp typedef typename ExpressionType::RealScalar RealScalar; typedef typename ExpressionType::Index Index; typedef typename internal::conditional<internal::must_nest_by_value<ExpressionType>::ret, - ExpressionType, const ExpressionType&>::type ExpressionTypeNested; + ExpressionType, ExpressionType&>::type ExpressionTypeNested; + typedef typename internal::remove_all<ExpressionTypeNested>::type ExpressionTypeNestedCleaned; template<template<typename _Scalar> class Functor, typename Scalar=typename internal::traits<ExpressionType>::Scalar> struct ReturnType @@ -245,7 +246,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp public: - inline VectorwiseOp(const ExpressionType& matrix) : m_matrix(matrix) {} + inline VectorwiseOp(ExpressionType& matrix) : m_matrix(matrix) {} /** \internal */ inline const ExpressionType& _expression() const { return m_matrix; } @@ -444,9 +445,9 @@ template<typename ExpressionType, int Direction> class VectorwiseOp } /** Returns the expression of the sum of the vector \a other to each subvector of \c *this */ - template<typename OtherDerived> EIGEN_STRONG_INLINE + template<typename OtherDerived> EIGEN_STRONG_INLINE CwiseBinaryOp<internal::scalar_sum_op<Scalar>, - ExpressionType, + ExpressionTypeNestedCleaned, typename ExtendedType<OtherDerived>::Type> operator+(const DenseBase<OtherDerived>& other) const { @@ -457,7 +458,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp /** Returns the expression of the difference between each subvector of \c *this and the vector \a other */ template<typename OtherDerived> CwiseBinaryOp<internal::scalar_difference_op<Scalar>, - ExpressionType, + ExpressionTypeNestedCleaned, typename ExtendedType<OtherDerived>::Type> operator-(const DenseBase<OtherDerived>& other) const { @@ -478,13 +479,13 @@ template<typename ExpressionType, int Direction> class VectorwiseOp : internal::traits<ExpressionType>::ColsAtCompileTime, HNormalized_SizeMinusOne = HNormalized_Size==Dynamic ? Dynamic : HNormalized_Size-1 }; - typedef Block<ExpressionType, + typedef Block<const ExpressionType, Direction==Vertical ? int(HNormalized_SizeMinusOne) : int(internal::traits<ExpressionType>::RowsAtCompileTime), Direction==Horizontal ? int(HNormalized_SizeMinusOne) : int(internal::traits<ExpressionType>::ColsAtCompileTime)> HNormalized_Block; - typedef Block<ExpressionType, + typedef Block<const ExpressionType, Direction==Vertical ? 1 : int(internal::traits<ExpressionType>::RowsAtCompileTime), Direction==Horizontal ? 1 : int(internal::traits<ExpressionType>::ColsAtCompileTime)> HNormalized_Factors; @@ -495,7 +496,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp Direction==Horizontal ? HNormalized_SizeMinusOne : 1> > HNormalizedReturnType; - HNormalizedReturnType hnormalized() const; + const HNormalizedReturnType hnormalized() const; protected: ExpressionTypeNested m_matrix; @@ -509,7 +510,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp * \sa rowwise(), class VectorwiseOp */ template<typename Derived> -inline const VectorwiseOp<Derived,Vertical> +inline const typename DenseBase<Derived>::ConstColwiseReturnType DenseBase<Derived>::colwise() const { return derived(); @@ -520,7 +521,7 @@ DenseBase<Derived>::colwise() const * \sa rowwise(), class VectorwiseOp */ template<typename Derived> -inline VectorwiseOp<Derived,Vertical> +inline typename DenseBase<Derived>::ColwiseReturnType DenseBase<Derived>::colwise() { return derived(); @@ -534,7 +535,7 @@ DenseBase<Derived>::colwise() * \sa colwise(), class VectorwiseOp */ template<typename Derived> -inline const VectorwiseOp<Derived,Horizontal> +inline const typename DenseBase<Derived>::ConstRowwiseReturnType DenseBase<Derived>::rowwise() const { return derived(); @@ -545,7 +546,7 @@ DenseBase<Derived>::rowwise() const * \sa colwise(), class VectorwiseOp */ template<typename Derived> -inline VectorwiseOp<Derived,Horizontal> +inline typename DenseBase<Derived>::RowwiseReturnType DenseBase<Derived>::rowwise() { return derived(); |