aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-01-11 20:48:56 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-01-11 20:48:56 +0000
commita30b498ab449df1ab51fc389bc2d9f6334e31f84 (patch)
tree81b9618f9b4bf3c1b884dc51be176ed8e2828a6f /Eigen/src
parent28e15574df883e2f917d6fa0d2e099bb549ca54a (diff)
add cwise operator *= and /=.
Keir says hi!!
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Array/CwiseOperators.h37
-rw-r--r--Eigen/src/Core/Cwise.h6
2 files changed, 43 insertions, 0 deletions
diff --git a/Eigen/src/Array/CwiseOperators.h b/Eigen/src/Array/CwiseOperators.h
index 4b6346daa..81e51f8d9 100644
--- a/Eigen/src/Array/CwiseOperators.h
+++ b/Eigen/src/Array/CwiseOperators.h
@@ -418,6 +418,43 @@ inline ExpressionType& Cwise<ExpressionType>::operator+=(const Scalar& scalar)
return m_matrix.const_cast_derived() = *this + scalar;
}
+
+//=============
+
+/** \array_module
+ *
+ * Replaces this expression by its coefficient-wise product with \a other.
+ *
+ * Example: \include Cwise_times_equal.cpp
+ * Output: \verbinclude Cwise_times_equal.out
+ *
+ * \sa operator*(), operator/=()
+ */
+template<typename ExpressionType>
+template<typename OtherDerived>
+inline ExpressionType& Cwise<ExpressionType>::operator*=(const MatrixBase<OtherDerived> &other)
+{
+ return m_matrix.const_cast_derived() = *this * other;
+}
+
+/** \array_module
+ *
+ * Replaces this expression by its coefficient-wise quotient with \a other.
+ *
+ * Example: \include Cwise_slash_equal.cpp
+ * Output: \verbinclude Cwise_slash_equal.out
+ *
+ * \sa operator/(), operator*=()
+ */
+template<typename ExpressionType>
+template<typename OtherDerived>
+inline ExpressionType& Cwise<ExpressionType>::operator/=(const MatrixBase<OtherDerived> &other)
+{
+ return m_matrix.const_cast_derived() = *this / other;
+}
+
+//=============
+
/** \array_module
*
* \returns an expression of \c *this with each coeff decremented by the constant \a scalar
diff --git a/Eigen/src/Core/Cwise.h b/Eigen/src/Core/Cwise.h
index a04fff3db..eef7ef02c 100644
--- a/Eigen/src/Core/Cwise.h
+++ b/Eigen/src/Core/Cwise.h
@@ -128,6 +128,12 @@ template<typename ExpressionType> class Cwise
ExpressionType& operator-=(const Scalar& scalar);
+ template<typename OtherDerived>
+ inline ExpressionType& operator*=(const MatrixBase<OtherDerived> &other);
+
+ template<typename OtherDerived>
+ inline ExpressionType& operator/=(const MatrixBase<OtherDerived> &other);
+
template<typename OtherDerived> const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)
operator<(const MatrixBase<OtherDerived>& other) const;