From de22ad117cb5324e3e1d0700dde7466921fdf9ca Mon Sep 17 00:00:00 2001 From: Kibeom Kim Date: Thu, 17 Nov 2011 17:57:45 -0500 Subject: bug #157 - Implemented *= /= * / operations for VectorwiseOp (e.g. mat.colwise()) --- Eigen/src/Core/VectorwiseOp.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index 20f688157..b61234b57 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -444,6 +444,26 @@ template class VectorwiseOp return const_cast(m_matrix); } + /** Multiplies the vector \a other to each subvector of \c *this */ + template + ExpressionType& operator*=(const DenseBase& other) + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) + for(Index j=0; j(m_matrix); + } + + /** Divides the vector \a other to each subvector of \c *this */ + template + ExpressionType& operator/=(const DenseBase& other) + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) + for(Index j=0; j(m_matrix); + } + /** Returns the expression of the sum of the vector \a other to each subvector of \c *this */ template EIGEN_STRONG_INLINE CwiseBinaryOp, @@ -466,6 +486,28 @@ template class VectorwiseOp return m_matrix - extendedTo(other.derived()); } + /** Returns the expression of the multiplication of the vector \a other to each subvector of \c *this */ + template EIGEN_STRONG_INLINE + CwiseBinaryOp, + const ExpressionTypeNestedCleaned, + const typename ExtendedType::Type> + operator*(const DenseBase& other) const + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived); + return m_matrix * extendedTo(other.derived()); + } + + /** Returns the expression of the division between each subvector of \c *this and the vector \a other */ + template + CwiseBinaryOp, + const ExpressionTypeNestedCleaned, + const typename ExtendedType::Type> + operator/(const DenseBase& other) const + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived); + return m_matrix / extendedTo(other.derived()); + } + /////////// Geometry module /////////// #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS -- cgit v1.2.3