$darkmode
Eigen  5.0.1-dev
GenericPacketMathFunctionsFwd.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2019 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_ARCH_GENERIC_PACKET_MATH_FUNCTIONS_FWD_H
11 #define EIGEN_ARCH_GENERIC_PACKET_MATH_FUNCTIONS_FWD_H
12 
13 // IWYU pragma: private
14 #include "../../InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 namespace internal {
18 
19 // Forward declarations of the generic math functions
20 // implemented in GenericPacketMathFunctions.h
21 // This is needed to workaround a circular dependency.
22 
23 /***************************************************************************
24  * Some generic implementations to be used by implementers
25  ***************************************************************************/
26 
30 template <typename Packet>
31 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet pfrexp_generic(const Packet& a, Packet& exponent);
32 
33 // Extracts the biased exponent value from Packet p, and casts the results to
34 // a floating-point Packet type. Used by pfrexp_generic. Override this if
35 // there is no unpacket_traits<Packet>::integer_packet.
36 template <typename Packet>
37 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet pfrexp_generic_get_biased_exponent(const Packet& p);
38 
42 template <typename Packet>
43 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet pldexp_generic(const Packet& a, const Packet& exponent);
44 
45 // Explicitly multiplies
46 // a * (2^e)
47 // clamping e to the range
48 // [NumTraits<Scalar>::min_exponent()-2, NumTraits<Scalar>::max_exponent()]
49 //
50 // This is approx 7x faster than pldexp_impl, but will prematurely over/underflow
51 // if 2^e doesn't fit into a normal floating-point Scalar.
52 //
53 // Assumes IEEE floating point format
54 template <typename Packet>
55 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet pldexp_fast(const Packet& a, const Packet& exponent);
56 
58 template <typename Packet>
59 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcbrt_float(const Packet& x_in);
60 
62 template <typename Packet>
63 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcbrt_double(const Packet& x_in);
64 
66 template <typename Packet>
67 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog_float(const Packet _x);
68 
70 template <typename Packet>
71 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2_float(const Packet _x);
72 
74 template <typename Packet>
75 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog_double(const Packet _x);
76 
78 template <typename Packet>
79 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2_double(const Packet _x);
80 
82 template <typename Packet>
83 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_log1p(const Packet& x);
84 
86 template <typename Packet>
87 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_expm1(const Packet& x);
88 
90 template <typename Packet>
91 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_atan(const Packet& x);
92 
94 template <typename Packet>
95 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_exp2(const Packet& x);
96 
98 template <typename Packet>
99 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp_float(const Packet _x);
100 
102 template <typename Packet>
103 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp_double(const Packet _x);
104 
106 template <typename Packet>
107 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x);
108 
110 template <typename Packet>
111 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos_float(const Packet& x);
112 
114 template <typename Packet>
115 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x);
116 
118 template <typename Packet>
119 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos_double(const Packet& x);
120 
122 template <typename Packet>
123 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pasin_float(const Packet& x);
124 
126 template <typename Packet>
127 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pacos_float(const Packet& x);
128 
130 template <typename Packet>
131 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptanh_float(const Packet& x);
132 
134 template <typename Packet>
135 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptanh_double(const Packet& x);
136 
138 template <typename Packet>
139 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patanh_float(const Packet& x);
140 
142 template <typename Packet>
143 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patanh_double(const Packet& x);
144 
146 template <typename Packet>
147 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psqrt_complex(const Packet& a);
148 
150 template <typename Packet>
151 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pdiv_complex(const Packet& x, const Packet& y);
152 
153 template <typename Packet, int N>
154 struct ppolevl;
155 
157 template <typename Packet>
158 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog_complex(const Packet& x);
159 
161 template <typename Packet>
162 EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp_complex(const Packet& x);
163 
164 template <typename Packet>
165 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_rint(const Packet& a);
166 
167 template <typename Packet>
168 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_floor(const Packet& a);
169 
170 template <typename Packet>
171 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_ceil(const Packet& a);
172 
173 template <typename Packet>
174 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_trunc(const Packet& a);
175 
176 template <typename Packet>
177 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_round(const Packet& a);
178 
179 // Macros for instantiating these generic functions for different backends.
180 #define EIGEN_PACKET_FUNCTION(METHOD, SCALAR, PACKET) \
181  template <> \
182  EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_UNUSED PACKET p##METHOD<PACKET>(const PACKET& _x) { \
183  return p##METHOD##_##SCALAR(_x); \
184  }
185 
186 // Macros for instantiating these generic functions for different backends.
187 #define EIGEN_GENERIC_PACKET_FUNCTION(METHOD, PACKET) \
188  template <> \
189  EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_UNUSED PACKET p##METHOD<PACKET>(const PACKET& _x) { \
190  return generic_##METHOD(_x); \
191  }
192 
193 #define EIGEN_FLOAT_PACKET_FUNCTION(METHOD, PACKET) EIGEN_PACKET_FUNCTION(METHOD, float, PACKET)
194 #define EIGEN_DOUBLE_PACKET_FUNCTION(METHOD, PACKET) EIGEN_PACKET_FUNCTION(METHOD, double, PACKET)
195 
196 #define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(PACKET) \
197  EIGEN_FLOAT_PACKET_FUNCTION(sin, PACKET) \
198  EIGEN_FLOAT_PACKET_FUNCTION(cos, PACKET) \
199  EIGEN_FLOAT_PACKET_FUNCTION(asin, PACKET) \
200  EIGEN_FLOAT_PACKET_FUNCTION(acos, PACKET) \
201  EIGEN_FLOAT_PACKET_FUNCTION(tanh, PACKET) \
202  EIGEN_FLOAT_PACKET_FUNCTION(atanh, PACKET) \
203  EIGEN_FLOAT_PACKET_FUNCTION(log, PACKET) \
204  EIGEN_FLOAT_PACKET_FUNCTION(log2, PACKET) \
205  EIGEN_FLOAT_PACKET_FUNCTION(exp, PACKET) \
206  EIGEN_FLOAT_PACKET_FUNCTION(cbrt, PACKET) \
207  EIGEN_GENERIC_PACKET_FUNCTION(expm1, PACKET) \
208  EIGEN_GENERIC_PACKET_FUNCTION(exp2, PACKET) \
209  EIGEN_GENERIC_PACKET_FUNCTION(log1p, PACKET) \
210  EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET)
211 
212 #define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(PACKET) \
213  EIGEN_DOUBLE_PACKET_FUNCTION(atanh, PACKET) \
214  EIGEN_DOUBLE_PACKET_FUNCTION(log, PACKET) \
215  EIGEN_DOUBLE_PACKET_FUNCTION(sin, PACKET) \
216  EIGEN_DOUBLE_PACKET_FUNCTION(cos, PACKET) \
217  EIGEN_DOUBLE_PACKET_FUNCTION(log2, PACKET) \
218  EIGEN_DOUBLE_PACKET_FUNCTION(exp, PACKET) \
219  EIGEN_DOUBLE_PACKET_FUNCTION(tanh, PACKET) \
220  EIGEN_DOUBLE_PACKET_FUNCTION(cbrt, PACKET) \
221  EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET) \
222  EIGEN_GENERIC_PACKET_FUNCTION(exp2, PACKET)
223 
224 } // end namespace internal
225 } // end namespace Eigen
226 
227 #endif // EIGEN_ARCH_GENERIC_PACKET_MATH_FUNCTIONS_FWD_H
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1