ArrayCwiseBinaryOps.h
1 
5 template<typename OtherDerived>
6 EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)
7 operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
8 {
9  return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived());
10 }
11 
16 template<typename OtherDerived>
17 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>
18 operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
19 {
20  return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
21 }
22 
30 EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op)
31 
32 
36 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived,
37  const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
38 (min)(const Scalar &other) const
39 {
40  return (min)(Derived::PlainObject::Constant(rows(), cols(), other));
41 }
42 
50 EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op)
51 
52 
56 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived,
57  const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
58 (max)(const Scalar &other) const
59 {
60  return (max)(Derived::PlainObject::Constant(rows(), cols(), other));
61 }
62 
70 EIGEN_MAKE_CWISE_BINARY_OP(operator<,std::less)
71 
72 
79 EIGEN_MAKE_CWISE_BINARY_OP(operator<=,std::less_equal)
80 
88 EIGEN_MAKE_CWISE_BINARY_OP(operator>,std::greater)
89 
97 EIGEN_MAKE_CWISE_BINARY_OP(operator>=,std::greater_equal)
98 
111 EIGEN_MAKE_CWISE_BINARY_OP(operator==,std::equal_to)
112 
125 EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to)
126 
127 // scalar addition
128 
136 inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
137 operator+(const Scalar& scalar) const
138 {
139  return CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>(derived(), internal::scalar_add_op<Scalar>(scalar));
140 }
141 
142 friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
143 operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
144 {
145  return other + scalar;
146 }
147 
155 inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
156 operator-(const Scalar& scalar) const
157 {
158  return *this + (-scalar);
159 }
160 
161 friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived> >
162 operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
163 {
164  return (-other) + scalar;
165 }
166 
176 template<typename OtherDerived>
177 inline const CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived>
178 operator&&(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
179 {
180  EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value),
181  THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
182  return CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived>(derived(),other.derived());
183 }
184 
194 template<typename OtherDerived>
195 inline const CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>
196 operator||(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
197 {
198  EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value),
199  THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
200  return CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>(derived(),other.derived());
201 }