GlobalFunctions.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2010-2012 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_GLOBAL_FUNCTIONS_H
12 #define EIGEN_GLOBAL_FUNCTIONS_H
13 
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 x.derived(); \
19  }
20 
21 #define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \
22  \
23  template<typename Derived> \
24  struct NAME##_retval<ArrayBase<Derived> > \
25  { \
26  typedef const Eigen::CwiseUnaryOp<Eigen::internal::FUNCTOR<typename Derived::Scalar>, const Derived> type; \
27  }; \
28  template<typename Derived> \
29  struct NAME##_impl<ArrayBase<Derived> > \
30  { \
31  static inline typename NAME##_retval<ArrayBase<Derived> >::type run(const Eigen::ArrayBase<Derived>& x) \
32  { \
33  return x.derived(); \
34  } \
35  };
36 
37 
38 namespace Eigen
39 {
42  EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(conj,scalar_conjugate_op)
52 
53  template<typename Derived>
55  pow(const Eigen::ArrayBase<Derived>& x, const typename Derived::Scalar& exponent) {
56  return x.derived().pow(exponent);
57  }
58 
59  template<typename Derived>
62  {
64  x.derived(),
65  exponents.derived()
66  );
67  }
68 
72  template <typename Derived>
74  operator/(const typename Derived::Scalar& s, const Eigen::ArrayBase<Derived>& a)
75  {
76  return Eigen::CwiseUnaryOp<Eigen::internal::scalar_inverse_mult_op<typename Derived::Scalar>, const Derived>(
77  a.derived(),
79  );
80  }
81 
82  namespace internal
83  {
87  }
88 }
89 
90 // TODO: cleanly disable those functions that are not supported on Array (numext::real_ref, internal::random, internal::isApprox...)
91 
92 #endif // EIGEN_GLOBAL_FUNCTIONS_H
const CwiseUnaryOp< internal::scalar_pow_op< Scalar >, const Derived > pow(const Scalar &exponent) const
Definition: ArrayBase.h:144
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_pow_op< typename Derived::Scalar >, const Derived > pow(const Eigen::ArrayBase< Derived > &x, const typename Derived::Scalar &exponent)
#define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME, FUNCTOR)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_inverse_mult_op< typename Derived::Scalar >, const Derived > operator/(const typename Derived::Scalar &s, const Eigen::ArrayBase< Derived > &a)
Component-wise division of a scalar by array elements.
#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME, FUNCTOR)
Definition: LDLT.h:16
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > abs2() const
const ImagReturnType imag() const
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > abs() const
RealReturnType real() const
Generic expression where a coefficient-wise binary operator is applied to two expressions.
const CwiseUnaryOp< internal::scalar_tan_op< Scalar >, Derived > tan() const
const CwiseUnaryOp< internal::scalar_log_op< Scalar >, const Derived > log() const
Base class for all 1D and 2D array, and related expressions.
Definition: ArrayBase.h:39
const CwiseUnaryOp< internal::scalar_sin_op< Scalar >, const Derived > sin() const
const CwiseUnaryOp< internal::scalar_cos_op< Scalar >, const Derived > cos() const
const CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > sqrt() const
const CwiseUnaryOp< internal::scalar_exp_op< Scalar >, const Derived > exp() const
const CwiseUnaryOp< internal::scalar_asin_op< Scalar >, const Derived > asin() const
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:59
const CwiseUnaryOp< internal::scalar_acos_op< Scalar >, const Derived > acos() const


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:50