11 #ifndef EIGEN_GLOBAL_FUNCTIONS_H
12 #define EIGEN_GLOBAL_FUNCTIONS_H
14 #ifdef EIGEN_PARSED_BY_DOXYGEN
16 #define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \
23 template<typename Derived> \
24 inline const Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, const Derived> \
25 NAME(const Eigen::ArrayBase<Derived>& x);
29 #define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \
30 template<typename Derived> \
31 inline const Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, const Derived> \
32 (NAME)(const Eigen::ArrayBase<Derived>& x) { \
33 return Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, const Derived>(x.derived()); \
36 #endif // EIGEN_PARSED_BY_DOXYGEN
38 #define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \
40 template<typename Derived> \
41 struct NAME##_retval<ArrayBase<Derived> > \
43 typedef const Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, const Derived> type; \
45 template<typename Derived> \
46 struct NAME##_impl<ArrayBase<Derived> > \
48 static inline typename NAME##_retval<ArrayBase<Derived> >::type run(const Eigen::ArrayBase<Derived>& x) \
50 return typename NAME##_retval<ArrayBase<Derived> >::type(x.derived()); \
56 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
real,scalar_real_op,
real part,\sa ArrayBase::real)
58 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
conj,scalar_conjugate_op,complex conjugate,\sa
ArrayBase::conjugate)
68 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
tanh,scalar_tanh_op,hyperbolic tangent,\sa
ArrayBase::
tanh)
69 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
lgamma,scalar_lgamma_op,natural logarithm of the gamma function,\sa
ArrayBase::
lgamma)
71 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
erf,scalar_erf_op,error function,\sa
ArrayBase::
erf)
72 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
erfc,scalar_erfc_op,complement error function,\sa
ArrayBase::
erfc)
73 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
exp,scalar_exp_op,exponential,\sa
ArrayBase::
exp)
75 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
log1p,scalar_log1p_op,natural logarithm of 1 plus the value,\sa
ArrayBase::
log1p)
79 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
arg,scalar_arg_op,complex argument,\sa
ArrayBase::
arg)
86 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(
ceil,scalar_ceil_op,nearest integer not less than the giben value,\sa
Eigen::
floor DOXCOMMA
ArrayBase::
ceil)
100 #ifdef EIGEN_PARSED_BY_DOXYGEN
101 template<
typename Derived,
typename ScalarExponent>
105 template<
typename Derived,
typename ScalarExponent>
106 inline typename internal::enable_if< !(internal::is_same<typename Derived::Scalar,ScalarExponent>::value) && EIGEN_SCALAR_BINARY_SUPPORTED(pow,
typename Derived::Scalar,ScalarExponent),
107 const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,ScalarExponent,pow) >::type
109 return x.
derived().pow(exponent);
112 template<
typename Derived>
113 inline const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,
typename Derived::Scalar,pow)
115 return x.
derived().pow(exponent);
130 template<
typename Derived,
typename ExponentDerived>
153 #ifdef EIGEN_PARSED_BY_DOXYGEN
154 template<
typename Scalar,
typename Derived>
155 inline const CwiseBinaryOp<internal::scalar_pow_op<Scalar,Derived::Scalar>,Constant<Scalar>,Derived>
158 template<
typename Scalar,
typename Derived>
159 inline typename internal::enable_if< !(internal::is_same<typename Derived::Scalar,Scalar>::value) && EIGEN_SCALAR_BINARY_SUPPORTED(pow,Scalar,
typename Derived::Scalar),
160 const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,Derived,pow) >::type
163 return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,Derived,pow)(
164 typename internal::plain_constant_type<Derived,Scalar>::type(exponents.
rows(), exponents.
cols(), x), exponents.
derived() );
167 template<
typename Derived>
168 inline const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(
typename Derived::Scalar,Derived,pow)
171 return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(
typename Derived::Scalar,Derived,pow)(
172 typename internal::plain_constant_type<Derived,typename Derived::Scalar>::type(exponents.
rows(), exponents.
cols(), x), exponents.
derived() );
179 EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(
real,scalar_real_op)
180 EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(
imag,scalar_imag_op)
181 EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(
abs2,scalar_abs2_op)
187 #endif // EIGEN_GLOBAL_FUNCTIONS_H