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);
78template<
typename RealScalar>
91 if(p==RealScalar(0))
return RealScalar(0);
93 return p *
sqrt(RealScalar(1) + qp*qp);
96template<
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 );
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 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:1195
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
constexpr common_return_t< T1, T2 > atan2(const T1 y, const T2 x) noexcept
Compile-time two-argument arctangent function.
Definition: atan2.hpp:82
UnitType abs(const UnitType x) noexcept
Compute absolute value.
Definition: math.h:721
auto sqrt(const UnitType &value) noexcept -> unit_t< square_root< typename units::traits::unit_t_traits< UnitType >::unit_type >, typename units::traits::unit_t_traits< UnitType >::underlying_type, linear_scale >
computes the square root of value
Definition: math.h:483
constexpr common_return_t< T1, T2 > hypot(const T1 x, const T2 y) noexcept
Compile-time Pythagorean addition function.
Definition: hypot.hpp:84
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_STRONG_INLINE Packet4i pmadd(const Packet4i &a, const Packet4i &b, const Packet4i &c)
Definition: PacketMath.h:370
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_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:432
EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f &a)
Definition: PacketMath.h:601
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_DEVICE_FUNC Packet16b pselect(const Packet16b &mask, const Packet16b &a, const Packet16b &b)
Definition: PacketMath.h:391
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 bool() isinf(const T &x)
Definition: MathFunctions.h:1371
EIGEN_DEVICE_FUNC bool() isnan(const T &x)
Definition: MathFunctions.h:1370
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Definition: MathFunctions.h:1091
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
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typenameNumTraits< T >::Real >::type abs(const T &x)
Definition: MathFunctions.h:1509
Namespace containing all symbols from the Eigen library.
Definition: MatrixExponential.h:16
Definition: Eigen_Colamd.h:50
Holds information about the various numeric (i.e.
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