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  }
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 {
53  EIGEN_EMPTY_STRUCT_CTOR(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  }
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 {
80  EIGEN_EMPTY_STRUCT_CTOR(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  }
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 {
108  EIGEN_EMPTY_STRUCT_CTOR(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 {
135  EIGEN_EMPTY_STRUCT_CTOR(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 {
163  EIGEN_EMPTY_STRUCT_CTOR(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 {
191  EIGEN_EMPTY_STRUCT_CTOR(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 {
219  EIGEN_EMPTY_STRUCT_CTOR(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 {
247  EIGEN_EMPTY_STRUCT_CTOR(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 {
275  EIGEN_EMPTY_STRUCT_CTOR(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 {
303  EIGEN_EMPTY_STRUCT_CTOR(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 {
331  EIGEN_EMPTY_STRUCT_CTOR(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_EMPTY_STRUCT_CTOR
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition: XprHelper.h:22
Eigen::internal::scalar_bessel_i0_op
Definition: ForwardDeclarations.h:226
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen::bessel_k1
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k1_op< typename Derived::Scalar >, const Derived > bessel_k1(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:167
Eigen::internal::scalar_bessel_k0_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:253
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::internal::scalar_bessel_j0_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:141
Eigen::internal::pbessel_j1
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_j1(const Packet &x)
Definition: BesselFunctionsPacketMath.h:61
Eigen::bessel_i1e
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i1e_op< typename Derived::Scalar >, const Derived > bessel_i1e(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:100
Eigen::bessel_i0e
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i0e_op< typename Derived::Scalar >, const Derived > bessel_i0e(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:55
Eigen::internal::scalar_bessel_j1_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:196
Eigen::bessel_i1
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i1_op< typename Derived::Scalar >, const Derived > bessel_i1(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:77
Eigen::internal::scalar_bessel_j1_op
Definition: ForwardDeclarations.h:232
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
Definition: gnuplot_common_settings.hh:12
Eigen::internal::scalar_bessel_y0_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:168
Eigen::internal::scalar_bessel_k0e_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:280
Eigen::internal::packet_traits
Definition: GenericPacketMath.h:106
Eigen::internal::scalar_bessel_k1_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:309
Eigen::internal::pbessel_j0
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_j0(const Packet &x)
Definition: BesselFunctionsPacketMath.h:53
Eigen::internal::scalar_bessel_y0_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:169
Eigen::bessel_k0
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k0_op< typename Derived::Scalar >, const Derived > bessel_k0(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:122
Eigen::internal::scalar_bessel_i0e_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:58
Eigen::internal::pbessel_i1
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i1(const Packet &x)
Definition: BesselFunctionsPacketMath.h:37
Eigen::bessel_j0
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_j0_op< typename Derived::Scalar >, const Derived > bessel_j0(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:212
Eigen::internal::scalar_bessel_i0e_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:59
Eigen::internal::scalar_bessel_i0_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:31
Eigen::internal::pbessel_y1
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_y1(const Packet &x)
Definition: BesselFunctionsPacketMath.h:77
Eigen::bessel_k0e
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k0e_op< typename Derived::Scalar >, const Derived > bessel_k0e(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:145
Eigen::internal::pbessel_i0e
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i0e(const Packet &x)
Definition: BesselFunctionsPacketMath.h:29
Eigen::internal::scalar_bessel_k0e_op
Definition: ForwardDeclarations.h:235
Eigen::internal::scalar_bessel_i1e_op
Definition: ForwardDeclarations.h:229
Eigen::internal::scalar_bessel_k0_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:252
Eigen::internal::scalar_bessel_y1_op
Definition: ForwardDeclarations.h:233
Eigen::internal::pbessel_k0e
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k0e(const Packet &x)
Definition: BesselFunctionsPacketMath.h:93
Eigen::internal::scalar_bessel_i1e_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:114
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
Eigen::internal::scalar_bessel_k1_op
Definition: ForwardDeclarations.h:236
Eigen::internal::scalar_bessel_y1_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:224
Eigen::internal::scalar_bessel_k0e_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:281
Eigen::internal::pbessel_y0
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_y0(const Packet &x)
Definition: BesselFunctionsPacketMath.h:69
Eigen::internal::scalar_bessel_j0_op
Definition: ForwardDeclarations.h:230
Eigen::bessel_y1
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_y1_op< typename Derived::Scalar >, const Derived > bessel_y1(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:278
Eigen::internal::functor_traits::PacketAccess
@ PacketAccess
Definition: XprHelper.h:180
Eigen::internal::scalar_bessel_j0_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:140
Eigen::internal::scalar_bessel_i1_op
Definition: ForwardDeclarations.h:228
Eigen::internal::scalar_bessel_i1_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:86
Eigen::bessel_j1
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_j1_op< typename Derived::Scalar >, const Derived > bessel_j1(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:256
Eigen::internal::scalar_bessel_i1_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:85
Eigen::internal::functor_traits::Cost
@ Cost
Definition: XprHelper.h:179
Eigen::internal::pbessel_k1e
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k1e(const Packet &x)
Definition: BesselFunctionsPacketMath.h:109
Eigen::internal::pbessel_i1e
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i1e(const Packet &x)
Definition: BesselFunctionsPacketMath.h:45
Eigen::internal::scalar_bessel_i0_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:30
Eigen::bessel_i0
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_i0_op< typename Derived::Scalar >, const Derived > bessel_i0(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:32
Eigen::bessel_y0
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_y0_op< typename Derived::Scalar >, const Derived > bessel_y0(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:234
Eigen::internal::pbessel_k0
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k0(const Packet &x)
Definition: BesselFunctionsPacketMath.h:85
Eigen::internal::scalar_bessel_k1_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:308
Eigen::internal::scalar_bessel_j1_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:197
Eigen::internal::scalar_bessel_k1e_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:336
Eigen::internal::pbessel_k1
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_k1(const Packet &x)
Definition: BesselFunctionsPacketMath.h:101
Eigen::internal::scalar_bessel_y0_op
Definition: ForwardDeclarations.h:231
Eigen::internal::scalar_bessel_k1e_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:337
Eigen::internal::scalar_bessel_i1e_op::Packet
packet_traits< Scalar >::type Packet
Definition: BesselFunctionsFunctors.h:113
Eigen::internal::scalar_bessel_k1e_op
Definition: ForwardDeclarations.h:237
Eigen::internal::functor_traits
Definition: XprHelper.h:175
internal
Definition: BandTriangularSolver.h:13
Eigen::internal::pbessel_i0
EIGEN_DEVICE_FUNC EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pbessel_i0(const Packet &x)
Definition: BesselFunctionsPacketMath.h:21
Eigen::internal::scalar_bessel_y1_op::packetOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet &x) const
Definition: BesselFunctionsFunctors.h:225
Eigen::internal::scalar_bessel_k0_op
Definition: ForwardDeclarations.h:234
Eigen::bessel_k1e
const EIGEN_STRONG_INLINE Eigen::CwiseUnaryOp< Eigen::internal::scalar_bessel_k1e_op< typename Derived::Scalar >, const Derived > bessel_k1e(const Eigen::ArrayBase< Derived > &x)
Definition: BesselFunctionsArrayAPI.h:190
Eigen::NumTraits
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:232
Eigen::internal::scalar_bessel_i0e_op
Definition: ForwardDeclarations.h:227
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:01:54