add cwise operator *= and /=.

Keir says hi!!
This commit is contained in:
Benoit Jacob
2009-01-11 20:48:56 +00:00
parent 28e15574df
commit a30b498ab4
4 changed files with 51 additions and 0 deletions

View File

@@ -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