diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-02-18 10:52:00 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-02-18 10:52:00 +0100 |
commit | 2d136d3d7f0623189e42be44d45e1353d1cde93e (patch) | |
tree | 637fb123ed1bd6a82a6b86d37f78e6ea316decef /Eigen/src/Core/SelfCwiseBinaryOp.h | |
parent | 873401032bf91e092413cdd7b56848f7b485490a (diff) |
Get rid of SeflCwiseBinaryOp
Diffstat (limited to 'Eigen/src/Core/SelfCwiseBinaryOp.h')
-rw-r--r-- | Eigen/src/Core/SelfCwiseBinaryOp.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h index 65864adf8..ae7f9b887 100644 --- a/Eigen/src/Core/SelfCwiseBinaryOp.h +++ b/Eigen/src/Core/SelfCwiseBinaryOp.h @@ -12,6 +12,8 @@ namespace Eigen { +#ifndef EIGEN_TEST_EVALUATORS + /** \class SelfCwiseBinaryOp * \ingroup Core_Module * @@ -179,6 +181,51 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp SelfCwiseBinaryOp& operator=(const SelfCwiseBinaryOp&); }; +#endif // EIGEN_TEST_EVALUATORS + +#ifdef EIGEN_TEST_EVALUATORS +template<typename Derived> +inline Derived& DenseBase<Derived>::operator*=(const Scalar& other) +{ + typedef typename Derived::PlainObject PlainObject; + internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op<Scalar>()); + return derived(); +} + +template<typename Derived> +inline Derived& ArrayBase<Derived>::operator+=(const Scalar& other) +{ + typedef typename Derived::PlainObject PlainObject; + internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op<Scalar>()); + return derived(); +} + +template<typename Derived> +inline Derived& ArrayBase<Derived>::operator-=(const Scalar& other) +{ + typedef typename Derived::PlainObject PlainObject; + internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op<Scalar>()); + return derived(); +} + +template<typename Derived> +inline Derived& DenseBase<Derived>::operator/=(const Scalar& other) +{ + typedef typename Derived::PlainObject PlainObject; + + typedef typename internal::conditional<NumTraits<Scalar>::IsInteger, + internal::div_assign_op<Scalar>, + internal::mul_assign_op<Scalar> >::type AssignOp; + + Scalar actual_other; + if(NumTraits<Scalar>::IsInteger) actual_other = other; + else actual_other = Scalar(1)/other; + + internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),actual_other), AssignOp()); + + return derived(); +} +#else template<typename Derived> inline Derived& DenseBase<Derived>::operator*=(const Scalar& other) { @@ -220,6 +267,7 @@ inline Derived& DenseBase<Derived>::operator/=(const Scalar& other) tmp = PlainObject::Constant(rows(),cols(), actual_other); return derived(); } +#endif } // end namespace Eigen |