ArrayCwiseBinaryOps.h
Go to the documentation of this file.
1 
6 template<typename OtherDerived>
7 EIGEN_DEVICE_FUNC
9 operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
10 {
11  return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)(derived(), other.derived());
12 }
13 
18 template<typename OtherDerived>
19 EIGEN_DEVICE_FUNC
20 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar,typename OtherDerived::Scalar>, const Derived, const OtherDerived>
21 operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
22 {
23  return CwiseBinaryOp<internal::scalar_quotient_op<Scalar,typename OtherDerived::Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
24 }
25 
34 
35 
39 EIGEN_DEVICE_FUNC
40 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar>, const Derived,
41  const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
42 #ifdef EIGEN_PARSED_BY_DOXYGEN
43 min
44 #else
45 (min)
46 #endif
47 (const Scalar &other) const
48 {
49  return (min)(Derived::PlainObject::Constant(rows(), cols(), other));
50 }
51 
60 
61 
65 EIGEN_DEVICE_FUNC
66 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar>, const Derived,
67  const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
68 #ifdef EIGEN_PARSED_BY_DOXYGEN
69 max
70 #else
71 (max)
72 #endif
73 (const Scalar &other) const
74 {
75  return (max)(Derived::PlainObject::Constant(rows(), cols(), other));
76 }
77 
86 
87 #ifndef EIGEN_PARSED_BY_DOXYGEN
89 #else
90 
102 template<typename T>
103 const CwiseBinaryOp<internal::scalar_pow_op<Scalar,T>,Derived,Constant<T> > pow(const T& exponent) const;
104 #endif
105 
106 
107 // TODO code generating macros could be moved to Macros.h and could include generation of documentation
108 #define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR) \
109 template<typename OtherDerived> \
110 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_cmp_op<Scalar, typename OtherDerived::Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const OtherDerived> \
111 OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
112 { \
113  return CwiseBinaryOp<internal::scalar_cmp_op<Scalar, typename OtherDerived::Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const OtherDerived>(derived(), other.derived()); \
114 }\
115 typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > Cmp ## COMPARATOR ## ReturnType; \
116 typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,Scalar, internal::cmp_ ## COMPARATOR>, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject>, const Derived > RCmp ## COMPARATOR ## ReturnType; \
117 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Cmp ## COMPARATOR ## ReturnType \
118 OP(const Scalar& s) const { \
119  return this->OP(Derived::PlainObject::Constant(rows(), cols(), s)); \
120 } \
121 EIGEN_DEVICE_FUNC friend EIGEN_STRONG_INLINE const RCmp ## COMPARATOR ## ReturnType \
122 OP(const Scalar& s, const Derived& d) { \
123  return Derived::PlainObject::Constant(d.rows(), d.cols(), s).OP(d); \
124 }
125 
126 #define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR) \
127 template<typename OtherDerived> \
128 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_cmp_op<typename OtherDerived::Scalar, Scalar, internal::cmp_##RCOMPARATOR>, const OtherDerived, const Derived> \
129 OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
130 { \
131  return CwiseBinaryOp<internal::scalar_cmp_op<typename OtherDerived::Scalar, Scalar, internal::cmp_##RCOMPARATOR>, const OtherDerived, const Derived>(other.derived(), derived()); \
132 } \
133 EIGEN_DEVICE_FUNC \
134 inline const RCmp ## RCOMPARATOR ## ReturnType \
135 OP(const Scalar& s) const { \
136  return Derived::PlainObject::Constant(rows(), cols(), s).R_OP(*this); \
137 } \
138 friend inline const Cmp ## RCOMPARATOR ## ReturnType \
139 OP(const Scalar& s, const Derived& d) { \
140  return d.R_OP(Derived::PlainObject::Constant(d.rows(), d.cols(), s)); \
141 }
142 
143 
144 
152 EIGEN_MAKE_CWISE_COMP_OP(operator<, LT)
153 
154 
161 EIGEN_MAKE_CWISE_COMP_OP(operator<=, LE)
162 
170 EIGEN_MAKE_CWISE_COMP_R_OP(operator>, operator<, LT)
171 
179 EIGEN_MAKE_CWISE_COMP_R_OP(operator>=, operator<=, LE)
180 
193 EIGEN_MAKE_CWISE_COMP_OP(operator==, EQ)
194 
207 EIGEN_MAKE_CWISE_COMP_OP(operator!=, NEQ)
208 
209 
210 #undef EIGEN_MAKE_CWISE_COMP_OP
211 #undef EIGEN_MAKE_CWISE_COMP_R_OP
212 
213 // scalar addition
214 #ifndef EIGEN_PARSED_BY_DOXYGEN
216 #else
217 
226 template<typename T>
227 const CwiseBinaryOp<internal::scalar_sum_op<Scalar,T>,Derived,Constant<T> > operator+(const T& scalar) const;
232 template<typename T> friend
233 const CwiseBinaryOp<internal::scalar_sum_op<T,Scalar>,Constant<T>,Derived> operator+(const T& scalar, const StorageBaseType& expr);
234 #endif
235 
236 #ifndef EIGEN_PARSED_BY_DOXYGEN
237 EIGEN_MAKE_SCALAR_BINARY_OP(operator-,difference)
238 #else
239 
248 template<typename T>
249 const CwiseBinaryOp<internal::scalar_difference_op<Scalar,T>,Derived,Constant<T> > operator-(const T& scalar) const;
254 template<typename T> friend
255 const CwiseBinaryOp<internal::scalar_difference_op<T,Scalar>,Constant<T>,Derived> operator-(const T& scalar, const StorageBaseType& expr);
256 #endif
257 
258 
259 #ifndef EIGEN_PARSED_BY_DOXYGEN
260  EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(operator/,quotient)
261 #else
262 
267  template<typename T> friend
268  inline const CwiseBinaryOp<internal::scalar_quotient_op<T,Scalar>,Constant<T>,Derived>
269  operator/(const T& s,const StorageBaseType& a);
270 #endif
271 
281 template<typename OtherDerived>
282 EIGEN_DEVICE_FUNC
283 inline const CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>
284 operator^(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
285 {
287  THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
288  return CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>(derived(),other.derived());
289 }
290 
291 // NOTE disabled until we agree on argument order
292 #if 0
293 
303 template<typename DerivedN>
304 inline const CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>
305 polygamma(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedN> &n) const
306 {
307  return CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>(n.derived(), this->derived());
308 }
309 #endif
310 
327 template<typename DerivedQ>
328 inline const CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>
329 zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedQ> &q) const
330 {
331  return CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>(this->derived(), q.derived());
332 }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, product) operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
SCALAR Scalar
Definition: bench_gemm.cpp:33
#define max(a, b)
Definition: datatypes.h:20
#define EIGEN_STRONG_INLINE
Definition: Macros.h:494
EIGEN_DEVICE_FUNC const CwiseBinaryOp< internal::scalar_boolean_xor_op, const Derived, const OtherDerived > operator^(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
const CwiseBinaryOp< internal::scalar_zeta_op< Scalar >, const Derived, const DerivedQ > zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS< DerivedQ > &q) const
#define min(a, b)
Definition: datatypes.h:19
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp< internal::scalar_quotient_op< Scalar, typename OtherDerived::Scalar >, const Derived, const OtherDerived > operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
#define EIGEN_CURRENT_STORAGE_BASE_CLASS
Definition: ArrayBase.h:89
int n
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:124
#define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR)
Array33i a
internal::enable_if< !(internal::is_same< typename Derived::Scalar, ScalarExponent >::value)&&EIGEN_SCALAR_BINARY_SUPPORTED(pow, typename Derived::Scalar, ScalarExponent), const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived, ScalarExponent, pow) >::type pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)
#define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD, OPNAME)
Definition: Macros.h:941
#define EIGEN_MAKE_SCALAR_BINARY_OP(METHOD, OPNAME)
Definition: Macros.h:959
RealScalar s
const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t mode=mpreal::get_default_rnd())
Definition: mpreal.h:2381
EIGEN_DEVICE_FUNC const Scalar & q
#define EIGEN_MAKE_CWISE_BINARY_OP(METHOD, OPNAME)
Definition: Macros.h:915
Jet< T, N > operator-(const Jet< T, N > &f)
Definition: jet.h:258
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_polygamma_op< typename DerivedX::Scalar >, const DerivedN, const DerivedX > polygamma(const Eigen::ArrayBase< DerivedN > &n, const Eigen::ArrayBase< DerivedX > &x)
#define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD, OPNAME)
Definition: Macros.h:950
mxArray * scalar(mxClassID classid)
Definition: matlab.h:85
Jet< T, N > const & operator+(const Jet< T, N > &f)
Definition: jet.h:249
void product(const MatrixType &m)
Definition: product.h:20
#define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR)


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:38