diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-09-10 23:10:01 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-09-10 23:10:01 +0200 |
commit | 2d90484450f3934db3f5db39ef37967fb9444263 (patch) | |
tree | f5acd8629e794fb555a7ff15833af28af5b02a78 /Eigen/src/Core/SelfCwiseBinaryOp.h | |
parent | 84a7ead059917964cc8719f372d7d153bb2cad53 (diff) |
mat/=scalar was transformed into mat*=(1/scalar) thus laking accuracy. This was also inconsistent with mat = mat/scalar.
Diffstat (limited to 'Eigen/src/Core/SelfCwiseBinaryOp.h')
-rw-r--r-- | Eigen/src/Core/SelfCwiseBinaryOp.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h index 65864adf8..8abdca4a5 100644 --- a/Eigen/src/Core/SelfCwiseBinaryOp.h +++ b/Eigen/src/Core/SelfCwiseBinaryOp.h @@ -209,15 +209,9 @@ inline Derived& ArrayBase<Derived>::operator-=(const Scalar& other) template<typename Derived> inline Derived& DenseBase<Derived>::operator/=(const Scalar& other) { - typedef typename internal::conditional<NumTraits<Scalar>::IsInteger, - internal::scalar_quotient_op<Scalar>, - internal::scalar_product_op<Scalar> >::type BinOp; typedef typename Derived::PlainObject PlainObject; - SelfCwiseBinaryOp<BinOp, Derived, typename PlainObject::ConstantReturnType> tmp(derived()); - Scalar actual_other; - if(NumTraits<Scalar>::IsInteger) actual_other = other; - else actual_other = Scalar(1)/other; - tmp = PlainObject::Constant(rows(),cols(), actual_other); + SelfCwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, typename PlainObject::ConstantReturnType> tmp(derived()); + tmp = PlainObject::Constant(rows(),cols(), other); return derived(); } |