GenericPacketMathFunctionsFwd.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) 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 #include "../../InternalHeaderCheck.h"
14 
15 namespace Eigen {
16 namespace internal {
17 
18 // Forward declarations of the generic math functions
19 // implemented in GenericPacketMathFunctions.h
20 // This is needed to workaround a circular dependency.
21 
22 
29 template<typename Packet> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
30 Packet pfrexp_generic(const Packet& a, Packet& exponent);
31 
32 // Extracts the biased exponent value from Packet p, and casts the results to
33 // a floating-point Packet type. Used by pfrexp_generic. Override this if
34 // there is no unpacket_traits<Packet>::integer_packet.
35 template<typename Packet> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
36 Packet pfrexp_generic_get_biased_exponent(const Packet& p);
37 
41 template<typename Packet> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
42 Packet pldexp_generic(const Packet& a, const Packet& exponent);
43 
45 template <typename Packet>
47 Packet plog_float(const Packet _x);
48 
50 template <typename Packet>
52 Packet plog2_float(const Packet _x);
53 
55 template <typename Packet>
57 Packet plog_double(const Packet _x);
58 
60 template <typename Packet>
62 Packet plog2_double(const Packet _x);
63 
65 template<typename Packet>
66 Packet generic_plog1p(const Packet& x);
67 
69 template<typename Packet>
70 Packet generic_expm1(const Packet& x);
71 
73 template <typename Packet>
75 Packet pexp_float(const Packet _x);
76 
78 template <typename Packet>
80 Packet pexp_double(const Packet _x);
81 
83 template<typename Packet>
85 Packet psin_float(const Packet& x);
86 
88 template<typename Packet>
90 Packet pcos_float(const Packet& x);
91 
93 template<typename Packet>
95 Packet pasin_float(const Packet& x);
96 
98 template<typename Packet>
100 Packet pacos_float(const Packet& x);
101 
103 template<typename Packet>
105 Packet patan_float(const Packet& x);
106 
108 template<typename Packet>
110 Packet patan_double(const Packet& x);
111 
113 template<typename Packet>
115 Packet patanh_float(const Packet& x);
116 
118 template<typename Packet>
120 Packet psqrt_complex(const Packet& a);
121 
123 template<typename Packet>
125 Packet pdiv_complex(const Packet& x, const Packet& y);
126 
127 template <typename Packet, int N> struct ppolevl;
128 
129 // Macros for instantiating these generic functions for different backends.
130 #define EIGEN_PACKET_FUNCTION(METHOD, SCALAR, PACKET) \
131  template <> \
132  EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_UNUSED PACKET p##METHOD<PACKET>(const PACKET& _x) { \
133  return p##METHOD##_##SCALAR(_x); \
134  }
135 
136 #define EIGEN_FLOAT_PACKET_FUNCTION(METHOD, PACKET) EIGEN_PACKET_FUNCTION(METHOD, float, PACKET)
137 #define EIGEN_DOUBLE_PACKET_FUNCTION(METHOD, PACKET) EIGEN_PACKET_FUNCTION(METHOD, double, PACKET)
138 
139 #define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(PACKET) \
140  EIGEN_FLOAT_PACKET_FUNCTION(sin, PACKET) \
141  EIGEN_FLOAT_PACKET_FUNCTION(cos, PACKET) \
142  EIGEN_FLOAT_PACKET_FUNCTION(asin, PACKET) \
143  EIGEN_FLOAT_PACKET_FUNCTION(acos, PACKET) \
144  EIGEN_FLOAT_PACKET_FUNCTION(atan, PACKET) \
145  EIGEN_FLOAT_PACKET_FUNCTION(atanh, PACKET) \
146  EIGEN_FLOAT_PACKET_FUNCTION(log, PACKET) \
147  EIGEN_FLOAT_PACKET_FUNCTION(log2, PACKET) \
148  EIGEN_FLOAT_PACKET_FUNCTION(exp, PACKET) \
149  template <> \
150  EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_UNUSED PACKET pexpm1<PACKET>(const PACKET& _x) { \
151  return internal::generic_expm1(_x); \
152  } \
153  template <> \
154  EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_UNUSED PACKET plog1p<PACKET>(const PACKET& _x) { \
155  return internal::generic_plog1p(_x); \
156  } \
157  template <> \
158  EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_UNUSED PACKET ptanh<PACKET>(const PACKET& _x) { \
159  return internal::generic_fast_tanh_float(_x); \
160  }
161 
162 #define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(PACKET) \
163  EIGEN_DOUBLE_PACKET_FUNCTION(atan, PACKET) \
164  EIGEN_DOUBLE_PACKET_FUNCTION(log, PACKET) \
165  EIGEN_DOUBLE_PACKET_FUNCTION(log2, PACKET) \
166  EIGEN_DOUBLE_PACKET_FUNCTION(exp, PACKET)
167 
168 } // end namespace internal
169 } // end namespace Eigen
170 
171 #endif // EIGEN_ARCH_GENERIC_PACKET_MATH_FUNCTIONS_FWD_H
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:883
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Definition: Macros.h:892
float * p
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2_double(const Packet _x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet &x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp_double(const Packet _x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pacos_float(const Packet &x_in)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patan_float(const Packet &x_in)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patanh_float(const Packet &x)
const Scalar & y
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet patan_double(const Packet &x_in)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psqrt_complex(const Packet &a)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2_float(const Packet _x)
Packet generic_plog1p(const Packet &x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos_float(const Packet &x)
Packet4d pfrexp_generic_get_biased_exponent(const Packet4d &a)
Packet pfrexp_generic(const Packet &a, Packet &exponent)
Packet pldexp_generic(const Packet &a, const Packet &exponent)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pdiv_complex(const Packet &x, const Packet &y)
Packet generic_expm1(const Packet &x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp_float(const Packet _x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog_double(const Packet _x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog_float(const Packet _x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pasin_float(const Packet &x_in)
: InteropHeaders
Definition: Core:139