BesselFunctionsFunctors.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) 2016 Eugene Brevdo <ebrevdo@gmail.com>
5 // Copyright (C) 2016 Gael Guennebaud <gael.guennebaud@inria.fr>
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_BESSELFUNCTIONS_FUNCTORS_H
12 #define EIGEN_BESSELFUNCTIONS_FUNCTORS_H
13 
14 namespace Eigen {
15 
16 namespace internal {
17 
23 template <typename Scalar>
24 struct scalar_bessel_i0_op {
25  EIGEN_EMPTY_STRUCT_CTOR(scalar_bessel_i0_op)
26  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
27  using numext::bessel_i0;
28  return bessel_i0(x);
29  }
31  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
32  return internal::pbessel_i0(x);
33  }
34 };
35 template <typename Scalar>
37  enum {
38  // On average, a Chebyshev polynomial of order N=20 is computed.
39  // The cost is N multiplications and 2N additions. We also add
40  // the cost of an additional exp over i0e.
43  };
44 };
45 
51 template <typename Scalar>
52 struct scalar_bessel_i0e_op {
54  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
55  using numext::bessel_i0e;
56  return bessel_i0e(x);
57  }
59  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
60  return internal::pbessel_i0e(x);
61  }
62 };
63 template <typename Scalar>
65  enum {
66  // On average, a Chebyshev polynomial of order N=20 is computed.
67  // The cost is N multiplications and 2N additions.
70  };
71 };
72 
78 template <typename Scalar>
79 struct scalar_bessel_i1_op {
81  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
82  using numext::bessel_i1;
83  return bessel_i1(x);
84  }
86  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& x) const {
87  return internal::pbessel_i1(x);
88  }
89 };
90 template <typename Scalar>
92  enum {
93  // On average, a Chebyshev polynomial of order N=20 is computed.
94  // The cost is N multiplications and 2N additions. We also add
95  // the cost of an additional exp over i1e.
98  };
99 };
100 
106 template <typename Scalar>
107 struct scalar_bessel_i1e_op {
109  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
110  using numext::bessel_i1e;
111  return bessel_i1e(x);
112  }
115  return internal::pbessel_i1e(x);
116  }
117 };
118 template <typename Scalar>
120  enum {
121  // On average, a Chebyshev polynomial of order N=20 is computed.
122  // The cost is N multiplications and 2N additions.
125  };
126 };
127 
133 template <typename Scalar>
134 struct scalar_bessel_j0_op {
136  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
137  using numext::bessel_j0;
138  return bessel_j0(x);
139  }
142  return internal::pbessel_j0(x);
143  }
144 };
145 template <typename Scalar>
147  enum {
148  // 6 polynomial of order ~N=8 is computed.
149  // The cost is N multiplications and N additions each, along with a
150  // sine, cosine and rsqrt cost.
153  };
154 };
155 
161 template <typename Scalar>
162 struct scalar_bessel_y0_op {
164  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
165  using numext::bessel_y0;
166  return bessel_y0(x);
167  }
170  return internal::pbessel_y0(x);
171  }
172 };
173 template <typename Scalar>
175  enum {
176  // 6 polynomial of order ~N=8 is computed.
177  // The cost is N multiplications and N additions each, along with a
178  // sine, cosine, rsqrt and j0 cost.
181  };
182 };
183 
189 template <typename Scalar>
190 struct scalar_bessel_j1_op {
192  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
193  using numext::bessel_j1;
194  return bessel_j1(x);
195  }
198  return internal::pbessel_j1(x);
199  }
200 };
201 template <typename Scalar>
203  enum {
204  // 6 polynomial of order ~N=8 is computed.
205  // The cost is N multiplications and N additions each, along with a
206  // sine, cosine and rsqrt cost.
209  };
210 };
211 
217 template <typename Scalar>
218 struct scalar_bessel_y1_op {
220  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
221  using numext::bessel_y1;
222  return bessel_y1(x);
223  }
226  return internal::pbessel_y1(x);
227  }
228 };
229 template <typename Scalar>
231  enum {
232  // 6 polynomial of order ~N=8 is computed.
233  // The cost is N multiplications and N additions each, along with a
234  // sine, cosine, rsqrt and j1 cost.
237  };
238 };
239 
245 template <typename Scalar>
246 struct scalar_bessel_k0_op {
248  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
249  using numext::bessel_k0;
250  return bessel_k0(x);
251  }
254  return internal::pbessel_k0(x);
255  }
256 };
257 template <typename Scalar>
259  enum {
260  // On average, a Chebyshev polynomial of order N=10 is computed.
261  // The cost is N multiplications and 2N additions. In addition we compute
262  // i0, a log, exp and prsqrt and sin and cos.
265  };
266 };
267 
273 template <typename Scalar>
274 struct scalar_bessel_k0e_op {
276  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
277  using numext::bessel_k0e;
278  return bessel_k0e(x);
279  }
282  return internal::pbessel_k0e(x);
283  }
284 };
285 template <typename Scalar>
287  enum {
288  // On average, a Chebyshev polynomial of order N=10 is computed.
289  // The cost is N multiplications and 2N additions. In addition we compute
290  // i0, a log, exp and prsqrt and sin and cos.
293  };
294 };
295 
301 template <typename Scalar>
302 struct scalar_bessel_k1_op {
304  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
305  using numext::bessel_k1;
306  return bessel_k1(x);
307  }
310  return internal::pbessel_k1(x);
311  }
312 };
313 template <typename Scalar>
315  enum {
316  // On average, a Chebyshev polynomial of order N=10 is computed.
317  // The cost is N multiplications and 2N additions. In addition we compute
318  // i1, a log, exp and prsqrt and sin and cos.
321  };
322 };
323 
329 template <typename Scalar>
330 struct scalar_bessel_k1e_op {
332  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& x) const {
333  using numext::bessel_k1e;
334  return bessel_k1e(x);
335  }
338  return internal::pbessel_k1e(x);
339  }
340 };
341 template <typename Scalar>
343  enum {
344  // On average, a Chebyshev polynomial of order N=10 is computed.
345  // The cost is N multiplications and 2N additions. In addition we compute
346  // i1, a log, exp and prsqrt and sin and cos.
349  };
350 };
351 
352 
353 } // end namespace internal
354 
355 } // end namespace Eigen
356 
357 #endif // EIGEN_BESSELFUNCTIONS_FUNCTORS_H
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k1e_op< typename Derived::Scalar >, const Derived > bessel_k1e(const Eigen::ArrayBase< Derived > &x)
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i1e_op< typename Derived::Scalar >, const Derived > bessel_i1e(const Eigen::ArrayBase< Derived > &x)
SCALAR Scalar
Definition: bench_gemm.cpp:46
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition: XprHelper.h:22
packet_traits< Scalar >::type Packet
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_j1(const Packet &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_j1_op< typename Derived::Scalar >, const Derived > bessel_j1(const Eigen::ArrayBase< Derived > &x)
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:232
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i0e(const Packet &x)
packet_traits< Scalar >::type Packet
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i0(const Packet &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_y1(const Packet &x)
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k0(const Packet &x)
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_y0_op< typename Derived::Scalar >, const Derived > bessel_y0(const Eigen::ArrayBase< Derived > &x)
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i0e_op< typename Derived::Scalar >, const Derived > bessel_i0e(const Eigen::ArrayBase< Derived > &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k1e(const Packet &x)
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i0_op< typename Derived::Scalar >, const Derived > bessel_i0(const Eigen::ArrayBase< Derived > &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k1_op< typename Derived::Scalar >, const Derived > bessel_k1(const Eigen::ArrayBase< Derived > &x)
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k0e_op< typename Derived::Scalar >, const Derived > bessel_k0e(const Eigen::ArrayBase< Derived > &x)
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i1e(const Packet &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_y0(const Packet &x)
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_j0(const Packet &x)
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k1(const Packet &x)
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_y1_op< typename Derived::Scalar >, const Derived > bessel_y1(const Eigen::ArrayBase< Derived > &x)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i1(const Packet &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k0_op< typename Derived::Scalar >, const Derived > bessel_k0(const Eigen::ArrayBase< Derived > &x)
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_j0_op< typename Derived::Scalar >, const Derived > bessel_j0(const Eigen::ArrayBase< Derived > &x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
EIGEN_STRONG_INLINE const Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i1_op< typename Derived::Scalar >, const Derived > bessel_i1(const Eigen::ArrayBase< Derived > &x)
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k0e(const Packet &x)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:33:58