aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/plugins/ArrayCwiseBinaryOps.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-10-18 14:56:36 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-10-18 14:56:36 +0200
commita0e8577b49693df630b9b35b0fee2c89a9ec12ad (patch)
tree153c1c4ae6b4a8bde7b1c5f265e05420460ed7d3 /Eigen/src/plugins/ArrayCwiseBinaryOps.h
parenta6bff116f92b7fc1ad000ebc46397310bc9db720 (diff)
Fix bug #684: optimize vectorization of array-scalar and scalar-array
Diffstat (limited to 'Eigen/src/plugins/ArrayCwiseBinaryOps.h')
-rw-r--r--Eigen/src/plugins/ArrayCwiseBinaryOps.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/Eigen/src/plugins/ArrayCwiseBinaryOps.h b/Eigen/src/plugins/ArrayCwiseBinaryOps.h
index 5c8c476ee..65d198749 100644
--- a/Eigen/src/plugins/ArrayCwiseBinaryOps.h
+++ b/Eigen/src/plugins/ArrayCwiseBinaryOps.h
@@ -162,16 +162,16 @@ operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>&
*
* \sa operator+(), operator-=()
*/
-inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
+inline const CwiseUnaryOp<internal::scalar_sub_op<Scalar>, const Derived>
operator-(const Scalar& scalar) const
{
- return *this + (-scalar);
+ return CwiseUnaryOp<internal::scalar_sub_op<Scalar>, const Derived>(derived(), internal::scalar_sub_op<Scalar>(scalar));;
}
-friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived> >
+friend inline const CwiseUnaryOp<internal::scalar_rsub_op<Scalar>, const Derived>
operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
{
- return (-other) + scalar;
+ return CwiseUnaryOp<internal::scalar_rsub_op<Scalar>, const Derived>(other.derived(), internal::scalar_rsub_op<Scalar>(scalar));;
}
/** \returns an expression of the coefficient-wise && operator of *this and \a other