xref: /aosp_15_r20/external/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Li 
2*bf2c3715SXin Li /** \returns an expression of the coefficient wise product of \c *this and \a other
3*bf2c3715SXin Li   *
4*bf2c3715SXin Li   * \sa MatrixBase::cwiseProduct
5*bf2c3715SXin Li   */
6*bf2c3715SXin Li template<typename OtherDerived>
7*bf2c3715SXin Li EIGEN_DEVICE_FUNC
EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)8*bf2c3715SXin Li EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)
9*bf2c3715SXin Li operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
10*bf2c3715SXin Li {
11*bf2c3715SXin Li   return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)(derived(), other.derived());
12*bf2c3715SXin Li }
13*bf2c3715SXin Li 
14*bf2c3715SXin Li /** \returns an expression of the coefficient wise quotient of \c *this and \a other
15*bf2c3715SXin Li   *
16*bf2c3715SXin Li   * \sa MatrixBase::cwiseQuotient
17*bf2c3715SXin Li   */
18*bf2c3715SXin Li template<typename OtherDerived>
19*bf2c3715SXin Li EIGEN_DEVICE_FUNC
20*bf2c3715SXin Li EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar,typename OtherDerived::Scalar>, const Derived, const OtherDerived>
21*bf2c3715SXin Li operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
22*bf2c3715SXin Li {
23*bf2c3715SXin Li   return CwiseBinaryOp<internal::scalar_quotient_op<Scalar,typename OtherDerived::Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
24*bf2c3715SXin Li }
25*bf2c3715SXin Li 
26*bf2c3715SXin Li /** \returns an expression of the coefficient-wise min of \c *this and \a other
27*bf2c3715SXin Li   *
28*bf2c3715SXin Li   * Example: \include Cwise_min.cpp
29*bf2c3715SXin Li   * Output: \verbinclude Cwise_min.out
30*bf2c3715SXin Li   *
31*bf2c3715SXin Li   * \sa max()
32*bf2c3715SXin Li   */
EIGEN_MAKE_CWISE_BINARY_OP(min,min)33*bf2c3715SXin Li EIGEN_MAKE_CWISE_BINARY_OP(min,min)
34*bf2c3715SXin Li 
35*bf2c3715SXin Li /** \returns an expression of the coefficient-wise min of \c *this and scalar \a other
36*bf2c3715SXin Li   *
37*bf2c3715SXin Li   * \sa max()
38*bf2c3715SXin Li   */
39*bf2c3715SXin Li EIGEN_DEVICE_FUNC
40*bf2c3715SXin Li EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar>, const Derived,
41*bf2c3715SXin Li                                         const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
42*bf2c3715SXin Li #ifdef EIGEN_PARSED_BY_DOXYGEN
43*bf2c3715SXin Li min
44*bf2c3715SXin Li #else
45*bf2c3715SXin Li (min)
46*bf2c3715SXin Li #endif
47*bf2c3715SXin Li (const Scalar &other) const
48*bf2c3715SXin Li {
49*bf2c3715SXin Li   return (min)(Derived::PlainObject::Constant(rows(), cols(), other));
50*bf2c3715SXin Li }
51*bf2c3715SXin Li 
52*bf2c3715SXin Li /** \returns an expression of the coefficient-wise max of \c *this and \a other
53*bf2c3715SXin Li   *
54*bf2c3715SXin Li   * Example: \include Cwise_max.cpp
55*bf2c3715SXin Li   * Output: \verbinclude Cwise_max.out
56*bf2c3715SXin Li   *
57*bf2c3715SXin Li   * \sa min()
58*bf2c3715SXin Li   */
EIGEN_MAKE_CWISE_BINARY_OP(max,max)59*bf2c3715SXin Li EIGEN_MAKE_CWISE_BINARY_OP(max,max)
60*bf2c3715SXin Li 
61*bf2c3715SXin Li /** \returns an expression of the coefficient-wise max of \c *this and scalar \a other
62*bf2c3715SXin Li   *
63*bf2c3715SXin Li   * \sa min()
64*bf2c3715SXin Li   */
65*bf2c3715SXin Li EIGEN_DEVICE_FUNC
66*bf2c3715SXin Li EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar>, const Derived,
67*bf2c3715SXin Li                                         const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
68*bf2c3715SXin Li #ifdef EIGEN_PARSED_BY_DOXYGEN
69*bf2c3715SXin Li max
70*bf2c3715SXin Li #else
71*bf2c3715SXin Li (max)
72*bf2c3715SXin Li #endif
73*bf2c3715SXin Li (const Scalar &other) const
74*bf2c3715SXin Li {
75*bf2c3715SXin Li   return (max)(Derived::PlainObject::Constant(rows(), cols(), other));
76*bf2c3715SXin Li }
77*bf2c3715SXin Li 
78*bf2c3715SXin Li /** \returns an expression of the coefficient-wise absdiff of \c *this and \a other
79*bf2c3715SXin Li   *
80*bf2c3715SXin Li   * Example: \include Cwise_absolute_difference.cpp
81*bf2c3715SXin Li   * Output: \verbinclude Cwise_absolute_difference.out
82*bf2c3715SXin Li   *
83*bf2c3715SXin Li   * \sa absolute_difference()
84*bf2c3715SXin Li   */
EIGEN_MAKE_CWISE_BINARY_OP(absolute_difference,absolute_difference)85*bf2c3715SXin Li EIGEN_MAKE_CWISE_BINARY_OP(absolute_difference,absolute_difference)
86*bf2c3715SXin Li 
87*bf2c3715SXin Li /** \returns an expression of the coefficient-wise absolute_difference of \c *this and scalar \a other
88*bf2c3715SXin Li   *
89*bf2c3715SXin Li   * \sa absolute_difference()
90*bf2c3715SXin Li   */
91*bf2c3715SXin Li EIGEN_DEVICE_FUNC
92*bf2c3715SXin Li EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_absolute_difference_op<Scalar,Scalar>, const Derived,
93*bf2c3715SXin Li                                         const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> >
94*bf2c3715SXin Li #ifdef EIGEN_PARSED_BY_DOXYGEN
95*bf2c3715SXin Li absolute_difference
96*bf2c3715SXin Li #else
97*bf2c3715SXin Li (absolute_difference)
98*bf2c3715SXin Li #endif
99*bf2c3715SXin Li (const Scalar &other) const
100*bf2c3715SXin Li {
101*bf2c3715SXin Li   return (absolute_difference)(Derived::PlainObject::Constant(rows(), cols(), other));
102*bf2c3715SXin Li }
103*bf2c3715SXin Li 
104*bf2c3715SXin Li /** \returns an expression of the coefficient-wise power of \c *this to the given array of \a exponents.
105*bf2c3715SXin Li   *
106*bf2c3715SXin Li   * This function computes the coefficient-wise power.
107*bf2c3715SXin Li   *
108*bf2c3715SXin Li   * Example: \include Cwise_array_power_array.cpp
109*bf2c3715SXin Li   * Output: \verbinclude Cwise_array_power_array.out
110*bf2c3715SXin Li   */
111*bf2c3715SXin Li EIGEN_MAKE_CWISE_BINARY_OP(pow,pow)
112*bf2c3715SXin Li 
113*bf2c3715SXin Li #ifndef EIGEN_PARSED_BY_DOXYGEN
114*bf2c3715SXin Li EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(pow,pow)
115*bf2c3715SXin Li #else
116*bf2c3715SXin Li /** \returns an expression of the coefficients of \c *this rasied to the constant power \a exponent
117*bf2c3715SXin Li   *
118*bf2c3715SXin Li   * \tparam T is the scalar type of \a exponent. It must be compatible with the scalar type of the given expression.
119*bf2c3715SXin Li   *
120*bf2c3715SXin Li   * This function computes the coefficient-wise power. The function MatrixBase::pow() in the
121*bf2c3715SXin Li   * unsupported module MatrixFunctions computes the matrix power.
122*bf2c3715SXin Li   *
123*bf2c3715SXin Li   * Example: \include Cwise_pow.cpp
124*bf2c3715SXin Li   * Output: \verbinclude Cwise_pow.out
125*bf2c3715SXin Li   *
126*bf2c3715SXin Li   * \sa ArrayBase::pow(ArrayBase), square(), cube(), exp(), log()
127*bf2c3715SXin Li   */
128*bf2c3715SXin Li template<typename T>
129*bf2c3715SXin Li const CwiseBinaryOp<internal::scalar_pow_op<Scalar,T>,Derived,Constant<T> > pow(const T& exponent) const;
130*bf2c3715SXin Li #endif
131*bf2c3715SXin Li 
132*bf2c3715SXin Li 
133*bf2c3715SXin Li // TODO code generating macros could be moved to Macros.h and could include generation of documentation
134*bf2c3715SXin Li #define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR) \
135*bf2c3715SXin Li template<typename OtherDerived> \
136*bf2c3715SXin Li EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_cmp_op<Scalar, typename OtherDerived::Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const OtherDerived> \
137*bf2c3715SXin Li OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
138*bf2c3715SXin Li { \
139*bf2c3715SXin Li   return CwiseBinaryOp<internal::scalar_cmp_op<Scalar, typename OtherDerived::Scalar, internal::cmp_ ## COMPARATOR>, const Derived, const OtherDerived>(derived(), other.derived()); \
140*bf2c3715SXin Li }\
141*bf2c3715SXin Li 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*bf2c3715SXin Li 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*bf2c3715SXin Li EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Cmp ## COMPARATOR ## ReturnType \
144*bf2c3715SXin Li OP(const Scalar& s) const { \
145*bf2c3715SXin Li   return this->OP(Derived::PlainObject::Constant(rows(), cols(), s)); \
146*bf2c3715SXin Li } \
147*bf2c3715SXin Li EIGEN_DEVICE_FUNC friend EIGEN_STRONG_INLINE const RCmp ## COMPARATOR ## ReturnType \
148*bf2c3715SXin Li OP(const Scalar& s, const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& d) { \
149*bf2c3715SXin Li   return Derived::PlainObject::Constant(d.rows(), d.cols(), s).OP(d); \
150*bf2c3715SXin Li }
151*bf2c3715SXin Li 
152*bf2c3715SXin Li #define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR) \
153*bf2c3715SXin Li template<typename OtherDerived> \
154*bf2c3715SXin Li EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_cmp_op<typename OtherDerived::Scalar, Scalar, internal::cmp_##RCOMPARATOR>, const OtherDerived, const Derived> \
155*bf2c3715SXin Li OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
156*bf2c3715SXin Li { \
157*bf2c3715SXin Li   return CwiseBinaryOp<internal::scalar_cmp_op<typename OtherDerived::Scalar, Scalar, internal::cmp_##RCOMPARATOR>, const OtherDerived, const Derived>(other.derived(), derived()); \
158*bf2c3715SXin Li } \
159*bf2c3715SXin Li EIGEN_DEVICE_FUNC \
160*bf2c3715SXin Li inline const RCmp ## RCOMPARATOR ## ReturnType \
161*bf2c3715SXin Li OP(const Scalar& s) const { \
162*bf2c3715SXin Li   return Derived::PlainObject::Constant(rows(), cols(), s).R_OP(*this); \
163*bf2c3715SXin Li } \
164*bf2c3715SXin Li friend inline const Cmp ## RCOMPARATOR ## ReturnType \
165*bf2c3715SXin Li OP(const Scalar& s, const Derived& d) { \
166*bf2c3715SXin Li   return d.R_OP(Derived::PlainObject::Constant(d.rows(), d.cols(), s)); \
167*bf2c3715SXin Li }
168*bf2c3715SXin Li 
169*bf2c3715SXin Li 
170*bf2c3715SXin Li 
171*bf2c3715SXin Li /** \returns an expression of the coefficient-wise \< operator of *this and \a other
172*bf2c3715SXin Li   *
173*bf2c3715SXin Li   * Example: \include Cwise_less.cpp
174*bf2c3715SXin Li   * Output: \verbinclude Cwise_less.out
175*bf2c3715SXin Li   *
176*bf2c3715SXin Li   * \sa all(), any(), operator>(), operator<=()
177*bf2c3715SXin Li   */
178*bf2c3715SXin Li EIGEN_MAKE_CWISE_COMP_OP(operator<, LT)
179*bf2c3715SXin Li 
180*bf2c3715SXin Li /** \returns an expression of the coefficient-wise \<= operator of *this and \a other
181*bf2c3715SXin Li   *
182*bf2c3715SXin Li   * Example: \include Cwise_less_equal.cpp
183*bf2c3715SXin Li   * Output: \verbinclude Cwise_less_equal.out
184*bf2c3715SXin Li   *
185*bf2c3715SXin Li   * \sa all(), any(), operator>=(), operator<()
186*bf2c3715SXin Li   */
187*bf2c3715SXin Li EIGEN_MAKE_CWISE_COMP_OP(operator<=, LE)
188*bf2c3715SXin Li 
189*bf2c3715SXin Li /** \returns an expression of the coefficient-wise \> operator of *this and \a other
190*bf2c3715SXin Li   *
191*bf2c3715SXin Li   * Example: \include Cwise_greater.cpp
192*bf2c3715SXin Li   * Output: \verbinclude Cwise_greater.out
193*bf2c3715SXin Li   *
194*bf2c3715SXin Li   * \sa all(), any(), operator>=(), operator<()
195*bf2c3715SXin Li   */
196*bf2c3715SXin Li EIGEN_MAKE_CWISE_COMP_R_OP(operator>, operator<, LT)
197*bf2c3715SXin Li 
198*bf2c3715SXin Li /** \returns an expression of the coefficient-wise \>= operator of *this and \a other
199*bf2c3715SXin Li   *
200*bf2c3715SXin Li   * Example: \include Cwise_greater_equal.cpp
201*bf2c3715SXin Li   * Output: \verbinclude Cwise_greater_equal.out
202*bf2c3715SXin Li   *
203*bf2c3715SXin Li   * \sa all(), any(), operator>(), operator<=()
204*bf2c3715SXin Li   */
205*bf2c3715SXin Li EIGEN_MAKE_CWISE_COMP_R_OP(operator>=, operator<=, LE)
206*bf2c3715SXin Li 
207*bf2c3715SXin Li /** \returns an expression of the coefficient-wise == operator of *this and \a other
208*bf2c3715SXin Li   *
209*bf2c3715SXin Li   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
210*bf2c3715SXin Li   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
211*bf2c3715SXin Li   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
212*bf2c3715SXin Li   * isMuchSmallerThan().
213*bf2c3715SXin Li   *
214*bf2c3715SXin Li   * Example: \include Cwise_equal_equal.cpp
215*bf2c3715SXin Li   * Output: \verbinclude Cwise_equal_equal.out
216*bf2c3715SXin Li   *
217*bf2c3715SXin Li   * \sa all(), any(), isApprox(), isMuchSmallerThan()
218*bf2c3715SXin Li   */
219*bf2c3715SXin Li EIGEN_MAKE_CWISE_COMP_OP(operator==, EQ)
220*bf2c3715SXin Li 
221*bf2c3715SXin Li /** \returns an expression of the coefficient-wise != operator of *this and \a other
222*bf2c3715SXin Li   *
223*bf2c3715SXin Li   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
224*bf2c3715SXin Li   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
225*bf2c3715SXin Li   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
226*bf2c3715SXin Li   * isMuchSmallerThan().
227*bf2c3715SXin Li   *
228*bf2c3715SXin Li   * Example: \include Cwise_not_equal.cpp
229*bf2c3715SXin Li   * Output: \verbinclude Cwise_not_equal.out
230*bf2c3715SXin Li   *
231*bf2c3715SXin Li   * \sa all(), any(), isApprox(), isMuchSmallerThan()
232*bf2c3715SXin Li   */
233*bf2c3715SXin Li EIGEN_MAKE_CWISE_COMP_OP(operator!=, NEQ)
234*bf2c3715SXin Li 
235*bf2c3715SXin Li 
236*bf2c3715SXin Li #undef EIGEN_MAKE_CWISE_COMP_OP
237*bf2c3715SXin Li #undef EIGEN_MAKE_CWISE_COMP_R_OP
238*bf2c3715SXin Li 
239*bf2c3715SXin Li // scalar addition
240*bf2c3715SXin Li #ifndef EIGEN_PARSED_BY_DOXYGEN
241*bf2c3715SXin Li EIGEN_MAKE_SCALAR_BINARY_OP(operator+,sum)
242*bf2c3715SXin Li #else
243*bf2c3715SXin Li /** \returns an expression of \c *this with each coeff incremented by the constant \a scalar
244*bf2c3715SXin Li   *
245*bf2c3715SXin Li   * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression.
246*bf2c3715SXin Li   *
247*bf2c3715SXin Li   * Example: \include Cwise_plus.cpp
248*bf2c3715SXin Li   * Output: \verbinclude Cwise_plus.out
249*bf2c3715SXin Li   *
250*bf2c3715SXin Li   * \sa operator+=(), operator-()
251*bf2c3715SXin Li   */
252*bf2c3715SXin Li template<typename T>
253*bf2c3715SXin Li const CwiseBinaryOp<internal::scalar_sum_op<Scalar,T>,Derived,Constant<T> > operator+(const T& scalar) const;
254*bf2c3715SXin Li /** \returns an expression of \a expr with each coeff incremented by the constant \a scalar
255*bf2c3715SXin Li   *
256*bf2c3715SXin Li   * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression.
257*bf2c3715SXin Li   */
258*bf2c3715SXin Li template<typename T> friend
259*bf2c3715SXin Li const CwiseBinaryOp<internal::scalar_sum_op<T,Scalar>,Constant<T>,Derived> operator+(const T& scalar, const StorageBaseType& expr);
260*bf2c3715SXin Li #endif
261*bf2c3715SXin Li 
262*bf2c3715SXin Li #ifndef EIGEN_PARSED_BY_DOXYGEN
263*bf2c3715SXin Li EIGEN_MAKE_SCALAR_BINARY_OP(operator-,difference)
264*bf2c3715SXin Li #else
265*bf2c3715SXin Li /** \returns an expression of \c *this with each coeff decremented by the constant \a scalar
266*bf2c3715SXin Li   *
267*bf2c3715SXin Li   * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression.
268*bf2c3715SXin Li   *
269*bf2c3715SXin Li   * Example: \include Cwise_minus.cpp
270*bf2c3715SXin Li   * Output: \verbinclude Cwise_minus.out
271*bf2c3715SXin Li   *
272*bf2c3715SXin Li   * \sa operator+=(), operator-()
273*bf2c3715SXin Li   */
274*bf2c3715SXin Li template<typename T>
275*bf2c3715SXin Li const CwiseBinaryOp<internal::scalar_difference_op<Scalar,T>,Derived,Constant<T> > operator-(const T& scalar) const;
276*bf2c3715SXin Li /** \returns an expression of the constant matrix of value \a scalar decremented by the coefficients of \a expr
277*bf2c3715SXin Li   *
278*bf2c3715SXin Li   * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression.
279*bf2c3715SXin Li   */
280*bf2c3715SXin Li template<typename T> friend
281*bf2c3715SXin Li const CwiseBinaryOp<internal::scalar_difference_op<T,Scalar>,Constant<T>,Derived> operator-(const T& scalar, const StorageBaseType& expr);
282*bf2c3715SXin Li #endif
283*bf2c3715SXin Li 
284*bf2c3715SXin Li 
285*bf2c3715SXin Li #ifndef EIGEN_PARSED_BY_DOXYGEN
286*bf2c3715SXin Li   EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(operator/,quotient)
287*bf2c3715SXin Li #else
288*bf2c3715SXin Li   /**
289*bf2c3715SXin Li     * \brief Component-wise division of the scalar \a s by array elements of \a a.
290*bf2c3715SXin Li     *
291*bf2c3715SXin Li     * \tparam Scalar is the scalar type of \a x. It must be compatible with the scalar type of the given array expression (\c Derived::Scalar).
292*bf2c3715SXin Li     */
293*bf2c3715SXin Li   template<typename T> friend
294*bf2c3715SXin Li   inline const CwiseBinaryOp<internal::scalar_quotient_op<T,Scalar>,Constant<T>,Derived>
295*bf2c3715SXin Li   operator/(const T& s,const StorageBaseType& a);
296*bf2c3715SXin Li #endif
297*bf2c3715SXin Li 
298*bf2c3715SXin Li /** \returns an expression of the coefficient-wise ^ operator of *this and \a other
299*bf2c3715SXin Li  *
300*bf2c3715SXin Li  * \warning this operator is for expression of bool only.
301*bf2c3715SXin Li  *
302*bf2c3715SXin Li  * Example: \include Cwise_boolean_xor.cpp
303*bf2c3715SXin Li  * Output: \verbinclude Cwise_boolean_xor.out
304*bf2c3715SXin Li  *
305*bf2c3715SXin Li  * \sa operator&&(), select()
306*bf2c3715SXin Li  */
307*bf2c3715SXin Li template<typename OtherDerived>
308*bf2c3715SXin Li EIGEN_DEVICE_FUNC
309*bf2c3715SXin Li inline const CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>
310*bf2c3715SXin Li operator^(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
311*bf2c3715SXin Li {
312*bf2c3715SXin Li   EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value),
313*bf2c3715SXin Li                       THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
314*bf2c3715SXin Li   return CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>(derived(),other.derived());
315*bf2c3715SXin Li }
316*bf2c3715SXin Li 
317*bf2c3715SXin Li // NOTE disabled until we agree on argument order
318*bf2c3715SXin Li #if 0
319*bf2c3715SXin Li /** \cpp11 \returns an expression of the coefficient-wise polygamma function.
320*bf2c3715SXin Li   *
321*bf2c3715SXin Li   * \specialfunctions_module
322*bf2c3715SXin Li   *
323*bf2c3715SXin Li   * It returns the \a n -th derivative of the digamma(psi) evaluated at \c *this.
324*bf2c3715SXin Li   *
325*bf2c3715SXin Li   * \warning Be careful with the order of the parameters: x.polygamma(n) is equivalent to polygamma(n,x)
326*bf2c3715SXin Li   *
327*bf2c3715SXin Li   * \sa Eigen::polygamma()
328*bf2c3715SXin Li   */
329*bf2c3715SXin Li template<typename DerivedN>
330*bf2c3715SXin Li inline const CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>
331*bf2c3715SXin Li polygamma(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedN> &n) const
332*bf2c3715SXin Li {
333*bf2c3715SXin Li   return CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>(n.derived(), this->derived());
334*bf2c3715SXin Li }
335*bf2c3715SXin Li #endif
336*bf2c3715SXin Li 
337*bf2c3715SXin Li /** \returns an expression of the coefficient-wise zeta function.
338*bf2c3715SXin Li   *
339*bf2c3715SXin Li   * \specialfunctions_module
340*bf2c3715SXin Li   *
341*bf2c3715SXin Li   * It returns the Riemann zeta function of two arguments \c *this and \a q:
342*bf2c3715SXin Li   *
343*bf2c3715SXin Li   * \param q is the shift, it must be > 0
344*bf2c3715SXin Li   *
345*bf2c3715SXin Li   * \note *this is the exponent, it must be > 1.
346*bf2c3715SXin Li   * \note This function supports only float and double scalar types. To support other scalar types, the user has
347*bf2c3715SXin Li   * to provide implementations of zeta(T,T) for any scalar type T to be supported.
348*bf2c3715SXin Li   *
349*bf2c3715SXin Li   * This method is an alias for zeta(*this,q);
350*bf2c3715SXin Li   *
351*bf2c3715SXin Li   * \sa Eigen::zeta()
352*bf2c3715SXin Li   */
353*bf2c3715SXin Li template<typename DerivedQ>
354*bf2c3715SXin Li inline const CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>
zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedQ> & q)355*bf2c3715SXin Li zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedQ> &q) const
356*bf2c3715SXin Li {
357*bf2c3715SXin Li   return CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>(this->derived(), q.derived());
358*bf2c3715SXin Li }
359