mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 19:59:05 +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>
|
template<typename OtherDerived>
|
||||||
Derived& operator*=(const ArrayBase<OtherDerived>& other);
|
Derived& operator*=(const ArrayBase<OtherDerived>& other);
|
||||||
|
|
||||||
|
template<typename OtherDerived>
|
||||||
|
Derived& operator/=(const ArrayBase<OtherDerived>& other);
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
inline bool operator==(const ArrayBase<OtherDerived>& other) const
|
inline bool operator==(const ArrayBase<OtherDerived>& other) const
|
||||||
{ return cwiseEqual(other).all(); }
|
{ return cwiseEqual(other).all(); }
|
||||||
@ -162,7 +165,7 @@ template<typename Derived> class ArrayBase
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ArrayBase() : Base() {}
|
ArrayBase() : Base() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ArrayBase(int);
|
explicit ArrayBase(int);
|
||||||
ArrayBase(int,int);
|
ArrayBase(int,int);
|
||||||
@ -197,4 +200,32 @@ ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
|
|||||||
return 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_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
|
#endif // EIGEN_ARRAYBASE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user