ArrayCwiseBinaryOps.h
1
5template<typename OtherDerived>
6EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)
7operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
8{
9 return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived());
10}
11
16template<typename OtherDerived>
17EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>
18operator/(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
30EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op)
31
32
36EIGEN_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
50EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op)
51
52
56EIGEN_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
70EIGEN_MAKE_CWISE_BINARY_OP(operator<,std::less)
71
72
79EIGEN_MAKE_CWISE_BINARY_OP(operator<=,std::less_equal)
80
81
88EIGEN_MAKE_CWISE_BINARY_OP(operator>,std::greater)
89
90
97EIGEN_MAKE_CWISE_BINARY_OP(operator>=,std::greater_equal)
98
99
111EIGEN_MAKE_CWISE_BINARY_OP(operator==,std::equal_to)
112
113
125EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to)
126
127// scalar addition
128
129
136inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
137operator+(const Scalar& scalar) const
138{
139 return CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>(derived(), internal::scalar_add_op<Scalar>(scalar));
140}
141
142friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
143operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
144{
145 return other + scalar;
146}
147
155inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
156operator-(const Scalar& scalar) const
157{
158 return *this + (-scalar);
159}
160
161friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived> >
162operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
163{
164 return (-other) + scalar;
165}
166
176template<typename OtherDerived>
177inline const CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived>
178operator&&(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
194template<typename OtherDerived>
195inline const CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>
196operator||(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}