mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-05 19:46:07 +08:00
Backport change of operator/=(Scalar) to perform a true division
This commit is contained in:
parent
9ff967199a
commit
a7c2e62a52
@ -180,15 +180,9 @@ inline Derived& DenseBase<Derived>::operator*=(const Scalar& other)
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Derived& DenseBase<Derived>::operator/=(const Scalar& other)
|
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;
|
typedef typename Derived::PlainObject PlainObject;
|
||||||
SelfCwiseBinaryOp<BinOp, Derived, typename PlainObject::ConstantReturnType> tmp(derived());
|
SelfCwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, typename PlainObject::ConstantReturnType> tmp(derived());
|
||||||
Scalar actual_other;
|
tmp = PlainObject::Constant(rows(),cols(), other);
|
||||||
if(NumTraits<Scalar>::IsInteger) actual_other = other;
|
|
||||||
else actual_other = Scalar(1)/other;
|
|
||||||
tmp = PlainObject::Constant(rows(),cols(), actual_other);
|
|
||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user