mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 11:19:02 +08:00
add operators *= and /= (bis)
This commit is contained in:
parent
39209edd71
commit
1837b65b28
@ -145,6 +145,9 @@ template<typename Derived> class ArrayBase
|
||||
template<typename OtherDerived>
|
||||
Derived& operator*=(const ArrayBase<OtherDerived>& other);
|
||||
|
||||
template<typename OtherDerived>
|
||||
Derived& operator/=(const ArrayBase<OtherDerived>& other);
|
||||
|
||||
template<typename OtherDerived>
|
||||
inline bool operator==(const ArrayBase<OtherDerived>& other) const
|
||||
{ return cwiseEqual(other).all(); }
|
||||
@ -162,7 +165,7 @@ template<typename Derived> class ArrayBase
|
||||
|
||||
protected:
|
||||
ArrayBase() : Base() {}
|
||||
|
||||
|
||||
private:
|
||||
explicit ArrayBase(int);
|
||||
ArrayBase(int,int);
|
||||
@ -197,4 +200,32 @@ ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
|
||||
return derived();
|
||||
}
|
||||
|
||||
/** replaces \c *this by \c *this * \a other coefficient wise.
|
||||
*
|
||||
* \returns a reference to \c *this
|
||||
*/
|
||||
template<typename Derived>
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE Derived &
|
||||
ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
|
||||
{
|
||||
SelfCwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived> tmp(derived());
|
||||
tmp = other.derived();
|
||||
return derived();
|
||||
}
|
||||
|
||||
/** replaces \c *this by \c *this / \a other coefficient wise.
|
||||
*
|
||||
* \returns a reference to \c *this
|
||||
*/
|
||||
template<typename Derived>
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE Derived &
|
||||
ArrayBase<Derived>::operator/=(const ArrayBase<OtherDerived>& other)
|
||||
{
|
||||
SelfCwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived> tmp(derived());
|
||||
tmp = other.derived();
|
||||
return derived();
|
||||
}
|
||||
|
||||
#endif // EIGEN_ARRAYBASE_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user