11 #ifndef EIGEN_GLOBAL_FUNCTIONS_H 12 #define EIGEN_GLOBAL_FUNCTIONS_H 14 #define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR) \ 15 template<typename Derived> \ 16 inline const Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, const Derived> \ 17 (NAME)(const Eigen::ArrayBase<Derived>& x) { \ 18 return Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, const Derived>(x.derived()); \ 21 #define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \ 23 template<typename Derived> \ 24 struct NAME##_retval<ArrayBase<Derived> > \ 26 typedef const Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, const Derived> type; \ 28 template<typename Derived> \ 29 struct NAME##_impl<ArrayBase<Derived> > \ 31 static inline typename NAME##_retval<ArrayBase<Derived> >::type run(const Eigen::ArrayBase<Derived>& x) \ 33 return typename NAME##_retval<ArrayBase<Derived> >::type(x.derived()); \ 39 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op)
40 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(imag,scalar_imag_op)
41 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(conj,scalar_conjugate_op)
42 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(inverse,scalar_inverse_op)
43 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sin,scalar_sin_op)
44 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cos,scalar_cos_op)
45 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tan,scalar_tan_op)
46 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(atan,scalar_atan_op)
47 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asin,scalar_asin_op)
48 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acos,scalar_acos_op)
49 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sinh,scalar_sinh_op)
50 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cosh,scalar_cosh_op)
51 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tanh,scalar_tanh_op)
52 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(lgamma,scalar_lgamma_op)
53 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op)
54 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erfc,scalar_erfc_op)
55 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op)
56 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log,scalar_log_op)
57 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log10,scalar_log10_op)
58 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs,scalar_abs_op)
59 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs2,scalar_abs2_op)
60 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(arg,scalar_arg_op)
61 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sqrt,scalar_sqrt_op)
62 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(square,scalar_square_op)
63 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cube,scalar_cube_op)
64 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(round,scalar_round_op)
65 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op)
66 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ceil,scalar_ceil_op)
67 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isnan,scalar_isnan_op)
68 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op)
69 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op)
70 EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sign,scalar_sign_op)
72 template<typename Derived>
73 inline const
Eigen::CwiseUnaryOp<
Eigen::
internal::scalar_pow_op<typename Derived::Scalar>, const Derived>
74 pow(const
Eigen::ArrayBase<Derived>& x, const typename Derived::Scalar& exponent) {
75 return x.derived().pow(exponent);
87 template<
typename Derived,
typename ExponentDerived>
107 template<
typename Derived>
111 typename Derived::ConstantReturnType constant_x(exponents.rows(), exponents.cols(), x);
112 return Eigen::CwiseBinaryOp<Eigen::internal::scalar_binary_pow_op<typename Derived::Scalar, typename Derived::Scalar>,
const typename Derived::ConstantReturnType,
const Derived>(
121 template <
typename Derived>
125 return Eigen::CwiseUnaryOp<Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>,
const Derived>(
127 Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>(s)
133 EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op)
134 EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(imag,scalar_imag_op)
135 EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs2,scalar_abs2_op)
141 #endif // EIGEN_GLOBAL_FUNCTIONS_H
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:78
Base class for all 1D and 2D array, and related expressions.
Definition: ArrayBase.h:39
Definition: Eigen_Colamd.h:54
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:56