mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix bug #684: optimize vectorization of array-scalar and scalar-array
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user