ArrayCwiseBinaryOps.h
Go to the documentation of this file.
1 
5 template<typename 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, const ConstantReturnType>
37 (min)(const Scalar &other) const
38 {
39  return (min)(Derived::PlainObject::Constant(rows(), cols(), other));
40 }
41 
49 EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op)
50 
51 
55 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const ConstantReturnType>
56 (max)(const Scalar &other) const
57 {
58  return (max)(Derived::PlainObject::Constant(rows(), cols(), other));
59 }
60 
68 EIGEN_MAKE_CWISE_BINARY_OP(operator<,std::less)
69 
70 
77 EIGEN_MAKE_CWISE_BINARY_OP(operator<=,std::less_equal)
78 
86 EIGEN_MAKE_CWISE_BINARY_OP(operator>,std::greater)
87 
95 EIGEN_MAKE_CWISE_BINARY_OP(operator>=,std::greater_equal)
96 
109 EIGEN_MAKE_CWISE_BINARY_OP(operator==,std::equal_to)
110 
123 EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to)
124 
125 // scalar addition
126 
134 inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
135 operator+(const Scalar& scalar) const
136 {
137  return CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>(derived(), internal::scalar_add_op<Scalar>(scalar));
138 }
139 
140 friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
141 operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
142 {
143  return other + scalar;
144 }
145 
153 inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
154 operator-(const Scalar& scalar) const
155 {
156  return *this + (-scalar);
157 }
158 
159 friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived> >
160 operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
161 {
162  return (-other) + scalar;
163 }
164 
174 template<typename OtherDerived>
175 inline const CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived>
176 operator&&(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
177 {
178  EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value),
179  THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
180  return CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived>(derived(),other.derived());
181 }
182 
192 template<typename OtherDerived>
193 inline const CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>
194 operator||(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
195 {
196  EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value),
197  THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
198  return CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>(derived(),other.derived());
199 }