RavEngine
Loading...
Searching...
No Matches
ArrayCwiseBinaryOps.h
1
6template<typename OtherDerived>
7EIGEN_DEVICE_FUNC
8EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)
9operator*(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
18template<typename OtherDerived>
19EIGEN_DEVICE_FUNC
20EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar,typename OtherDerived::Scalar>, const Derived, const OtherDerived>
21operator/(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
33template <int NaNPropagation, typename OtherDerived>
34EIGEN_DEVICE_FUNC
35EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>
36#ifdef EIGEN_PARSED_BY_DOXYGEN
37min
38#else
39(min)
40#endif
41(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
42{
43 return CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>(derived(), other.derived());
44}
45
46template <typename OtherDerived>
47EIGEN_DEVICE_FUNC
48EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,PropagateFast>, const Derived, const OtherDerived>
49#ifdef EIGEN_PARSED_BY_DOXYGEN
50min
51#else
52(min)
53#endif
54(const OtherDerived &other) const
55{
56 return (min<PropagateFast>)(other);
57}
58
63template <int NaNPropagation>
64EIGEN_DEVICE_FUNC
65EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived,
66 const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
67#ifdef EIGEN_PARSED_BY_DOXYGEN
68min
69#else
70(min)
71#endif
72(const Scalar &other) const
73{
74 return (min<NaNPropagation>)(Derived::PlainObject::Constant(rows(), cols(), other));
75}
76
77EIGEN_DEVICE_FUNC
78 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,PropagateFast>, const Derived,
79 const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
80#ifdef EIGEN_PARSED_BY_DOXYGEN
81min
82#else
83(min)
84#endif
85(const Scalar &other) const
86{
87 return (min<PropagateFast>)(Derived::PlainObject::Constant(rows(), cols(), other));
88}
89
97template <int NaNPropagation, typename OtherDerived>
98EIGEN_DEVICE_FUNC
99EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>
100#ifdef EIGEN_PARSED_BY_DOXYGEN
101max
102#else
103(max)
104#endif
105(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
106{
107 return CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>(derived(), other.derived());
108}
109
110template <typename OtherDerived>
111EIGEN_DEVICE_FUNC
112EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,PropagateFast>, const Derived, const OtherDerived>
113#ifdef EIGEN_PARSED_BY_DOXYGEN
114max
115#else
116(max)
117#endif
118(const OtherDerived &other) const
119{
120 return (max<PropagateFast>)(other);
121}
122
127template <int NaNPropagation>
128EIGEN_DEVICE_FUNC
129EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived,
130 const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
131#ifdef EIGEN_PARSED_BY_DOXYGEN
132max
133#else
134(max)
135#endif
136(const Scalar &other) const
137{
138 return (max<NaNPropagation>)(Derived::PlainObject::Constant(rows(), cols(), other));
139}
140
141EIGEN_DEVICE_FUNC
142EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,PropagateFast>, const Derived,
143 const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
144#ifdef EIGEN_PARSED_BY_DOXYGEN
145max
146#else
147(max)
148#endif
149(const Scalar &other) const
150{
151 return (max<PropagateFast>)(Derived::PlainObject::Constant(rows(), cols(), other));
152}
153
161EIGEN_MAKE_CWISE_BINARY_OP(absolute_difference,absolute_difference)
162
163
167EIGEN_DEVICE_FUNC
168EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_absolute_difference_op<Scalar,Scalar>, const Derived,
169 const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
170#ifdef EIGEN_PARSED_BY_DOXYGEN
171absolute_difference
172#else
173(absolute_difference)
174#endif
175(const Scalar &other) const
176{
177 return (absolute_difference)(Derived::PlainObject::Constant(rows(), cols(), other));
178}
179
187EIGEN_MAKE_CWISE_BINARY_OP(pow,pow)
188
189#ifndef EIGEN_PARSED_BY_DOXYGEN
190EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(pow,pow)
191#else
204template<typename T>
205const CwiseBinaryOp<internal::scalar_pow_op<Scalar,T>,Derived,Constant<T> > pow(const T& exponent) const;
206#endif
207
208
209// TODO code generating macros could be moved to Macros.h and could include generation of documentation
210#define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR) \
211template<typename OtherDerived> \
212EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_cmp_op<Scalar, typename OtherDerived::Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const OtherDerived> \
213OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
214{ \
215 return CwiseBinaryOp<internal::scalar_cmp_op<Scalar, typename OtherDerived::Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const OtherDerived>(derived(), other.derived()); \
216}\
217typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > Cmp ## COMPARATOR ## ReturnType; \
218typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,Scalar, internal::cmp_ ## COMPARATOR>, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject>, const Derived > RCmp ## COMPARATOR ## ReturnType; \
219EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Cmp ## COMPARATOR ## ReturnType \
220OP(const Scalar& s) const { \
221 return this->OP(Derived::PlainObject::Constant(rows(), cols(), s)); \
222} \
223EIGEN_DEVICE_FUNC friend EIGEN_STRONG_INLINE const RCmp ## COMPARATOR ## ReturnType \
224OP(const Scalar& s, const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& d) { \
225 return Derived::PlainObject::Constant(d.rows(), d.cols(), s).OP(d); \
226}
227
228#define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR) \
229template<typename OtherDerived> \
230EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_cmp_op<typename OtherDerived::Scalar, Scalar, internal::cmp_##RCOMPARATOR>, const OtherDerived, const Derived> \
231OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
232{ \
233 return CwiseBinaryOp<internal::scalar_cmp_op<typename OtherDerived::Scalar, Scalar, internal::cmp_##RCOMPARATOR>, const OtherDerived, const Derived>(other.derived(), derived()); \
234} \
235EIGEN_DEVICE_FUNC \
236inline const RCmp ## RCOMPARATOR ## ReturnType \
237OP(const Scalar& s) const { \
238 return Derived::PlainObject::Constant(rows(), cols(), s).R_OP(*this); \
239} \
240friend inline const Cmp ## RCOMPARATOR ## ReturnType \
241OP(const Scalar& s, const Derived& d) { \
242 return d.R_OP(Derived::PlainObject::Constant(d.rows(), d.cols(), s)); \
243}
244
245
246
254EIGEN_MAKE_CWISE_COMP_OP(operator<, LT)
255
256
263EIGEN_MAKE_CWISE_COMP_OP(operator<=, LE)
264
265
272EIGEN_MAKE_CWISE_COMP_R_OP(operator>, operator<, LT)
273
274
281EIGEN_MAKE_CWISE_COMP_R_OP(operator>=, operator<=, LE)
282
283
295EIGEN_MAKE_CWISE_COMP_OP(operator==, EQ)
296
297
309EIGEN_MAKE_CWISE_COMP_OP(operator!=, NEQ)
310
311
312#undef EIGEN_MAKE_CWISE_COMP_OP
313#undef EIGEN_MAKE_CWISE_COMP_R_OP
314
315// scalar addition
316#ifndef EIGEN_PARSED_BY_DOXYGEN
317EIGEN_MAKE_SCALAR_BINARY_OP(operator+,sum)
318#else
328template<typename T>
329const CwiseBinaryOp<internal::scalar_sum_op<Scalar,T>,Derived,Constant<T> > operator+(const T& scalar) const;
334template<typename T> friend
335const CwiseBinaryOp<internal::scalar_sum_op<T,Scalar>,Constant<T>,Derived> operator+(const T& scalar, const StorageBaseType& expr);
336#endif
337
338#ifndef EIGEN_PARSED_BY_DOXYGEN
339EIGEN_MAKE_SCALAR_BINARY_OP(operator-,difference)
340#else
350template<typename T>
351const CwiseBinaryOp<internal::scalar_difference_op<Scalar,T>,Derived,Constant<T> > operator-(const T& scalar) const;
356template<typename T> friend
357const CwiseBinaryOp<internal::scalar_difference_op<T,Scalar>,Constant<T>,Derived> operator-(const T& scalar, const StorageBaseType& expr);
358#endif
359
360
361#ifndef EIGEN_PARSED_BY_DOXYGEN
362 EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(operator/,quotient)
363#else
369 template<typename T> friend
370 inline const CwiseBinaryOp<internal::scalar_quotient_op<T,Scalar>,Constant<T>,Derived>
371 operator/(const T& s,const StorageBaseType& a);
372#endif
373
383template<typename OtherDerived>
384EIGEN_DEVICE_FUNC
385inline const CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>
386operator^(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
387{
388 EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value),
389 THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
390 return CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>(derived(),other.derived());
391}
392
393// NOTE disabled until we agree on argument order
394#if 0
405template<typename DerivedN>
406inline const CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>
407polygamma(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedN> &n) const
408{
409 return CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>(n.derived(), this->derived());
410}
411#endif
412
429template<typename DerivedQ>
430inline const CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>
431zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedQ> &q) const
432{
433 return CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>(this->derived(), q.derived());
434}
GLM_FUNC_QUALIFIER vec< L, T, Q > pow(vec< L, T, Q > const &base, vec< L, T, Q > const &exponent)
Definition func_exponential.inl:72