Eigen  5.0.1-dev+284dcc12
 
Loading...
Searching...
No Matches
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
16namespace Eigen {
17namespace 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
30template <typename Packet>
31EIGEN_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.
36template <typename Packet>
37EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet pfrexp_generic_get_biased_exponent(const Packet& p);
38
42template <typename Packet>
43EIGEN_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
54template <typename Packet>
55EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet pldexp_fast(const Packet& a, const Packet& exponent);
56
58template <typename Packet>
59EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcbrt_float(const Packet& x_in);
60
62template <typename Packet>
63EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcbrt_double(const Packet& x_in);
64
66template <typename Packet>
67EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog_float(const Packet _x);
68
70template <typename Packet>
71EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2_float(const Packet _x);
72
74template <typename Packet>
75EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog_double(const Packet _x);
76
78template <typename Packet>
79EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2_double(const Packet _x);
80
82template <typename Packet>
83EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_log1p(const Packet& x);
84
86template <typename Packet>
87EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_expm1(const Packet& x);
88
90template <typename Packet>
91EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_atan(const Packet& x);
92
94template <typename Packet>
95EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet generic_exp2(const Packet& x);
96
98template <typename Packet>
99EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp_float(const Packet _x);
100
102template <typename Packet>
103EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp_double(const Packet _x);
104
106template <typename Packet>
107EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x);
108
110template <typename Packet>
111EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos_float(const Packet& x);
112
114template <typename Packet>
115EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x);
116
118template <typename Packet>
119EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos_double(const Packet& x);
120
122template <typename Packet>
123EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pasin_float(const Packet& x);
124
126template <typename Packet>
127EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pacos_float(const Packet& x);
128
130template <typename Packet>
131EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptanh_float(const Packet& x);
132
134template <typename Packet>
135EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptanh_double(const Packet& x);
136
138template <typename Packet>
139EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patanh_float(const Packet& x);
140
142template <typename Packet>
143EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patanh_double(const Packet& x);
144
146template <typename Packet>
147EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psqrt_complex(const Packet& a);
148
150template <typename Packet>
151EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pdiv_complex(const Packet& x, const Packet& y);
152
153template <typename Packet, int N>
154struct ppolevl;
155
157template <typename Packet>
158EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog_complex(const Packet& x);
159
161template <typename Packet>
162EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp_complex(const Packet& x);
163
164template <typename Packet>
165EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_rint(const Packet& a);
166
167template <typename Packet>
168EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_floor(const Packet& a);
169
170template <typename Packet>
171EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_ceil(const Packet& a);
172
173template <typename Packet>
174EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_trunc(const Packet& a);
175
176template <typename Packet>
177EIGEN_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