11 #ifndef EIGEN_MATHFUNCTIONSIMPL_H
12 #define EIGEN_MATHFUNCTIONSIMPL_H
32 #ifdef EIGEN_VECTORIZE_FMA
33 const T plus_clamp = pset1<T>(7.99881172180175781f);
34 const T minus_clamp = pset1<T>(-7.99881172180175781f);
36 const T plus_clamp = pset1<T>(7.90531110763549805f);
37 const T minus_clamp = pset1<T>(-7.90531110763549805f);
39 const T tiny = pset1<T>(0.0004f);
40 const T x =
pmax(
pmin(a_x, plus_clamp), minus_clamp);
43 const T alpha_1 = pset1<T>(4.89352455891786e-03f);
44 const T alpha_3 = pset1<T>(6.37261928875436e-04f);
45 const T alpha_5 = pset1<T>(1.48572235717979e-05f);
46 const T alpha_7 = pset1<T>(5.12229709037114e-08f);
47 const T alpha_9 = pset1<T>(-8.60467152213735e-11f);
48 const T alpha_11 = pset1<T>(2.00018790482477e-13f);
49 const T alpha_13 = pset1<T>(-2.76076847742355e-16f);
52 const T beta_0 = pset1<T>(4.89352518554385e-03f);
53 const T beta_2 = pset1<T>(2.26843463243900e-03f);
54 const T beta_4 = pset1<T>(1.18534705686654e-04f);
55 const T beta_6 = pset1<T>(1.19825839466702e-06f);
58 const T x2 =
pmul(x, x);
61 T p =
pmadd(x2, alpha_13, alpha_11);
62 p =
pmadd(x2, p, alpha_9);
63 p =
pmadd(x2, p, alpha_7);
64 p =
pmadd(x2, p, alpha_5);
65 p =
pmadd(x2, p, alpha_3);
66 p =
pmadd(x2, p, alpha_1);
70 T q =
pmadd(x2, beta_6, beta_4);
71 q =
pmadd(x2, q, beta_2);
72 q =
pmadd(x2, q, beta_0);
78 template<
typename RealScalar>
91 if(p==RealScalar(0))
return RealScalar(0);
93 return p *
sqrt(RealScalar(1) + qp*qp);
96 template<
typename Scalar>
104 return positive_real_hypot<RealScalar>(
abs(x),
abs(
y));
141 : x == zero ? std::complex<T>(w,
y < zero ? -w : w)
142 : x > zero ? std::complex<T>(w,
y / (2 * w))
143 : std::complex<T>(
numext::abs(
y) / (2 * w),
y < zero ? -w : w );
175 const T abs_z = numext::hypot(x,
y);
177 const T woz = w / abs_z;
182 : x == zero ? std::complex<T>(woz,
y < zero ? woz : -woz)
183 : x > zero ? std::complex<T>(woz, -
y / (2 * w * abs_z))
184 : std::complex<T>(
numext::abs(
y) / (2 * w * abs_z),
y < zero ? woz : -woz );
192 T b = atan2(z.imag(), z.real());
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
Definition: ArrayCwiseUnaryOps.h:52
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Definition: ArrayCwiseUnaryOps.h:187
EIGEN_DEVICE_FUNC RealReturnType real() const
Definition: CommonCwiseUnaryOps.h:100
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
Definition: CommonCwiseUnaryOps.h:109
#define EIGEN_USING_STD(FUNC)
Definition: Macros.h:1185
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RealScalar positive_real_hypot(const RealScalar &x, const RealScalar &y)
Definition: MathFunctionsImpl.h:80
const Scalar & y
Definition: MathFunctions.h:821
EIGEN_DEVICE_FUNC Packet pdiv(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:244
EIGEN_DEVICE_FUNC Packet pmax(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:524
EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f &a, const Packet4f &b, const Packet4f &c)
Definition: PacketMath.h:827
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:237
EIGEN_DEVICE_FUNC Packet pmin(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:512
EIGEN_STRONG_INLINE Packet4f pcmp_lt(const Packet4f &a, const Packet4f &b)
Definition: PacketMath.h:868
EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f &a)
Definition: PacketMath.h:1176
T generic_fast_tanh_float(const T &a_x)
Definition: MathFunctionsImpl.h:29
EIGEN_DEVICE_FUNC std::complex< T > complex_log(const std::complex< T > &z)
Definition: MathFunctionsImpl.h:188
EIGEN_DEVICE_FUNC std::complex< T > complex_sqrt(const std::complex< T > &a_x)
Definition: MathFunctionsImpl.h:111
EIGEN_STRONG_INLINE Packet4f pselect(const Packet4f &mask, const Packet4f &a, const Packet4f &b)
Definition: PacketMath.h:917
EIGEN_DEVICE_FUNC std::complex< T > complex_rsqrt(const std::complex< T > &a_x)
Definition: MathFunctionsImpl.h:148
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T log(const T &x)
Definition: MathFunctions.h:1489
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isinf(const Eigen::bfloat16 &h)
Definition: BFloat16.h:665
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Definition: MathFunctions.h:1091
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isnan(const Eigen::bfloat16 &h)
Definition: BFloat16.h:659
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real >::type abs(const T &x)
Definition: MathFunctions.h:1509
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sqrt(const float &x)
Definition: MathFunctions.h:177
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
Definition: MathFunctions.h:1083
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
Definition: document.h:416
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1181
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:233
Definition: MathFunctionsImpl.h:98
NumTraits< Scalar >::Real RealScalar
Definition: MathFunctionsImpl.h:99
static EIGEN_DEVICE_FUNC RealScalar run(const Scalar &x, const Scalar &y)
Definition: MathFunctionsImpl.h:101