ArrayCwiseBinaryOps.h
Go to the documentation of this file.
1 
6 template<typename OtherDerived>
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>
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 
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 
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 
85 EIGEN_MAKE_CWISE_BINARY_OP(absolute_difference,absolute_difference)
86 
87 
92 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_absolute_difference_op<Scalar,Scalar>, const Derived,
93  const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
94 #ifdef EIGEN_PARSED_BY_DOXYGEN
95 absolute_difference
96 #else
97 (absolute_difference)
98 #endif
99 (const Scalar &other) const
100 {
101  return (absolute_difference)(Derived::PlainObject::Constant(rows(), cols(), other));
102 }
103 
112 
113 #ifndef EIGEN_PARSED_BY_DOXYGEN
115 #else
116 
128 template<typename T>
129 const CwiseBinaryOp<internal::scalar_pow_op<Scalar,T>,Derived,Constant<T> > pow(const T& exponent) const;
130 #endif
131 
132 
133 // TODO code generating macros could be moved to Macros.h and could include generation of documentation
134 #define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR) \
135 template<typename OtherDerived> \
136 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_cmp_op<Scalar, typename OtherDerived::Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const OtherDerived> \
137 OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
138 { \
139  return CwiseBinaryOp<internal::scalar_cmp_op<Scalar, typename OtherDerived::Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const OtherDerived>(derived(), other.derived()); \
140 }\
141 typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > Cmp ## COMPARATOR ## ReturnType; \
142 typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,Scalar, internal::cmp_ ## COMPARATOR>, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject>, const Derived > RCmp ## COMPARATOR ## ReturnType; \
143 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Cmp ## COMPARATOR ## ReturnType \
144 OP(const Scalar& s) const { \
145  return this->OP(Derived::PlainObject::Constant(rows(), cols(), s)); \
146 } \
147 EIGEN_DEVICE_FUNC friend EIGEN_STRONG_INLINE const RCmp ## COMPARATOR ## ReturnType \
148 OP(const Scalar& s, const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& d) { \
149  return Derived::PlainObject::Constant(d.rows(), d.cols(), s).OP(d); \
150 }
151 
152 #define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR) \
153 template<typename OtherDerived> \
154 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_cmp_op<typename OtherDerived::Scalar, Scalar, internal::cmp_##RCOMPARATOR>, const OtherDerived, const Derived> \
155 OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
156 { \
157  return CwiseBinaryOp<internal::scalar_cmp_op<typename OtherDerived::Scalar, Scalar, internal::cmp_##RCOMPARATOR>, const OtherDerived, const Derived>(other.derived(), derived()); \
158 } \
159 EIGEN_DEVICE_FUNC \
160 inline const RCmp ## RCOMPARATOR ## ReturnType \
161 OP(const Scalar& s) const { \
162  return Derived::PlainObject::Constant(rows(), cols(), s).R_OP(*this); \
163 } \
164 friend inline const Cmp ## RCOMPARATOR ## ReturnType \
165 OP(const Scalar& s, const Derived& d) { \
166  return d.R_OP(Derived::PlainObject::Constant(d.rows(), d.cols(), s)); \
167 }
168 
169 
170 
178 EIGEN_MAKE_CWISE_COMP_OP(operator<, LT)
179 
180 
187 EIGEN_MAKE_CWISE_COMP_OP(operator<=, LE)
188 
189 
196 EIGEN_MAKE_CWISE_COMP_R_OP(operator>, operator<, LT)
197 
198 
205 EIGEN_MAKE_CWISE_COMP_R_OP(operator>=, operator<=, LE)
206 
207 
219 EIGEN_MAKE_CWISE_COMP_OP(operator==, EQ)
220 
221 
233 EIGEN_MAKE_CWISE_COMP_OP(operator!=, NEQ)
234 
235 
236 #undef EIGEN_MAKE_CWISE_COMP_OP
237 #undef EIGEN_MAKE_CWISE_COMP_R_OP
238 
239 // scalar addition
240 #ifndef EIGEN_PARSED_BY_DOXYGEN
241 EIGEN_MAKE_SCALAR_BINARY_OP(operator+,sum)
242 #else
243 
252 template<typename T>
253 const CwiseBinaryOp<internal::scalar_sum_op<Scalar,T>,Derived,Constant<T> > operator+(const T& scalar) const;
258 template<typename T> friend
259 const CwiseBinaryOp<internal::scalar_sum_op<T,Scalar>,Constant<T>,Derived> operator+(const T& scalar, const StorageBaseType& expr);
260 #endif
261 
262 #ifndef EIGEN_PARSED_BY_DOXYGEN
263 EIGEN_MAKE_SCALAR_BINARY_OP(operator-,difference)
264 #else
265 
274 template<typename T>
275 const CwiseBinaryOp<internal::scalar_difference_op<Scalar,T>,Derived,Constant<T> > operator-(const T& scalar) const;
280 template<typename T> friend
281 const CwiseBinaryOp<internal::scalar_difference_op<T,Scalar>,Constant<T>,Derived> operator-(const T& scalar, const StorageBaseType& expr);
282 #endif
283 
284 
285 #ifndef EIGEN_PARSED_BY_DOXYGEN
286  EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(operator/,quotient)
287 #else
288 
293  template<typename T> friend
294  inline const CwiseBinaryOp<internal::scalar_quotient_op<T,Scalar>,Constant<T>,Derived>
295  operator/(const T& s,const StorageBaseType& a);
296 #endif
297 
307 template<typename OtherDerived>
309 inline const CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>
310 operator^(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
311 {
313  THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
314  return CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>(derived(),other.derived());
315 }
316 
317 // NOTE disabled until we agree on argument order
318 #if 0
319 
329 template<typename DerivedN>
330 inline const CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>
331 polygamma(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedN> &n) const
332 {
333  return CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>(n.derived(), this->derived());
334 }
335 #endif
336 
353 template<typename DerivedQ>
354 inline const CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>
355 zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedQ> &q) const
356 {
357  return CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>(this->derived(), q.derived());
358 }
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
operator^
const EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_boolean_xor_op, const Derived, const OtherDerived > operator^(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
Definition: ArrayCwiseBinaryOps.h:310
s
RealScalar s
Definition: level1_cplx_impl.h:126
EIGEN_MAKE_CWISE_COMP_R_OP
#define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR)
Definition: ArrayCwiseBinaryOps.h:152
ceres::operator-
Jet< T, N > operator-(const Jet< T, N > &f)
Definition: jet.h:258
EQ
static double EQ[4]
Definition: unity.c:99
ceres::operator+
Jet< T, N > const & operator+(const Jet< T, N > &f)
Definition: jet.h:249
EIGEN_MAKE_CWISE_BINARY_OP
#define EIGEN_MAKE_CWISE_BINARY_OP(METHOD, OPNAME)
Definition: Macros.h:1336
zeta
const CwiseBinaryOp< internal::scalar_zeta_op< Scalar >, const Derived, const DerivedQ > zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS< DerivedQ > &q) const
Definition: ArrayCwiseBinaryOps.h:355
rows
int rows
Definition: Tutorial_commainit_02.cpp:1
n
int n
Definition: BiCGSTAB_simple.cpp:1
Eigen::polygamma
const EIGEN_STRONG_INLINE 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)
Definition: SpecialFunctionsArrayAPI.h:112
Eigen::numext::q
EIGEN_DEVICE_FUNC const Scalar & q
Definition: SpecialFunctionsImpl.h:1984
scalar
mxArray * scalar(mxClassID classid)
Definition: matlab.h:82
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT
#define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD, OPNAME)
Definition: Macros.h:1371
Eigen::Triplet
A small structure to hold a non zero as a triplet (i,j,value).
Definition: SparseUtil.h:162
Eigen::ArrayBase::pow
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_pow_op< typename Derived::Scalar, typename ExponentDerived::Scalar >, const Derived, const ExponentDerived > pow(const Eigen::ArrayBase< Derived > &x, const Eigen::ArrayBase< ExponentDerived > &exponents)
Definition: GlobalFunctions.h:143
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
EIGEN_STATIC_ASSERT
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
operator/
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE CwiseBinaryOp< internal::scalar_quotient_op< Scalar, typename OtherDerived::Scalar >, const Derived, const OtherDerived > operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
Definition: ArrayCwiseBinaryOps.h:21
product
void product(const MatrixType &m)
Definition: product.h:20
min
#define min(a, b)
Definition: datatypes.h:19
cols
int cols
Definition: Tutorial_commainit_02.cpp:1
EIGEN_MAKE_SCALAR_BINARY_OP
#define EIGEN_MAKE_SCALAR_BINARY_OP(METHOD, OPNAME)
Definition: Macros.h:1380
max
#define max(a, b)
Definition: datatypes.h:20
EIGEN_CWISE_BINARY_RETURN_TYPE
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, product) operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
Definition: ArrayCwiseBinaryOps.h:8
EIGEN_MAKE_CWISE_COMP_OP
#define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR)
Definition: ArrayCwiseBinaryOps.h:134
test_callbacks.value
value
Definition: test_callbacks.py:160
pybind_wrapper_test_script.other
other
Definition: pybind_wrapper_test_script.py:42
EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT
#define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD, OPNAME)
Definition: Macros.h:1362
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46
Eigen::UniformScaling::operator*
operator*(const MatrixBase< Derived > &matrix, const UniformScaling< Scalar > &s)
Definition: Eigen/src/Geometry/Scaling.h:135


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:01:50