mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
packet math functions:
- take const Packet& args like the other packet funcs - SSE specializations: make them be actual template specializations
This commit is contained in:
parent
7958797648
commit
134ca4acb3
@ -210,19 +210,19 @@ template<typename Packet> inline Packet ei_preverse(const Packet& a)
|
|||||||
***************************/
|
***************************/
|
||||||
|
|
||||||
/** \internal \returns the sin of \a a (coeff-wise) */
|
/** \internal \returns the sin of \a a (coeff-wise) */
|
||||||
template<typename Packet> inline static Packet ei_psin(Packet a) { return ei_sin(a); }
|
template<typename Packet> inline static Packet ei_psin(const Packet& a) { return ei_sin(a); }
|
||||||
|
|
||||||
/** \internal \returns the cos of \a a (coeff-wise) */
|
/** \internal \returns the cos of \a a (coeff-wise) */
|
||||||
template<typename Packet> inline static Packet ei_pcos(Packet a) { return ei_cos(a); }
|
template<typename Packet> inline static Packet ei_pcos(const Packet& a) { return ei_cos(a); }
|
||||||
|
|
||||||
/** \internal \returns the exp of \a a (coeff-wise) */
|
/** \internal \returns the exp of \a a (coeff-wise) */
|
||||||
template<typename Packet> inline static Packet ei_pexp(Packet a) { return ei_exp(a); }
|
template<typename Packet> inline static Packet ei_pexp(const Packet& a) { return ei_exp(a); }
|
||||||
|
|
||||||
/** \internal \returns the log of \a a (coeff-wise) */
|
/** \internal \returns the log of \a a (coeff-wise) */
|
||||||
template<typename Packet> inline static Packet ei_plog(Packet a) { return ei_log(a); }
|
template<typename Packet> inline static Packet ei_plog(const Packet& a) { return ei_log(a); }
|
||||||
|
|
||||||
/** \internal \returns the square-root of \a a (coeff-wise) */
|
/** \internal \returns the square-root of \a a (coeff-wise) */
|
||||||
template<typename Packet> inline static Packet ei_psqrt(Packet a) { return ei_sqrt(a); }
|
template<typename Packet> inline static Packet ei_psqrt(const Packet& a) { return ei_sqrt(a); }
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* The following functions might not have to be overwritten for vectorized types
|
* The following functions might not have to be overwritten for vectorized types
|
||||||
|
@ -30,8 +30,10 @@
|
|||||||
#ifndef EIGEN_MATH_FUNCTIONS_SSE_H
|
#ifndef EIGEN_MATH_FUNCTIONS_SSE_H
|
||||||
#define EIGEN_MATH_FUNCTIONS_SSE_H
|
#define EIGEN_MATH_FUNCTIONS_SSE_H
|
||||||
|
|
||||||
static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_plog(Packet4f x)
|
template<> EIGEN_DONT_INLINE EIGEN_UNUSED
|
||||||
|
Packet4f ei_plog<Packet4f>(const Packet4f& _x)
|
||||||
{
|
{
|
||||||
|
Packet4f x = _x;
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f);
|
_EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f);
|
||||||
@ -108,8 +110,10 @@ static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_plog(Packet4f x)
|
|||||||
return _mm_or_ps(x, invalid_mask); // negative arg will be NAN
|
return _mm_or_ps(x, invalid_mask); // negative arg will be NAN
|
||||||
}
|
}
|
||||||
|
|
||||||
static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_pexp(Packet4f x)
|
template<> EIGEN_DONT_INLINE EIGEN_UNUSED
|
||||||
|
Packet4f ei_pexp<Packet4f>(const Packet4f& _x)
|
||||||
{
|
{
|
||||||
|
Packet4f x = _x;
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f);
|
_EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f);
|
||||||
@ -181,8 +185,10 @@ static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_pexp(Packet4f x)
|
|||||||
surprising but correct result.
|
surprising but correct result.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_psin(Packet4f x)
|
template<> EIGEN_DONT_INLINE EIGEN_UNUSED
|
||||||
|
Packet4f ei_psin<Packet4f>(const Packet4f& _x)
|
||||||
{
|
{
|
||||||
|
Packet4f x = _x;
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
||||||
|
|
||||||
@ -280,8 +286,10 @@ static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_psin(Packet4f x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* almost the same as ei_psin */
|
/* almost the same as ei_psin */
|
||||||
static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_pcos(Packet4f x)
|
template<> EIGEN_DONT_INLINE EIGEN_UNUSED
|
||||||
|
Packet4f ei_pcos<Packet4f>(const Packet4f& _x)
|
||||||
{
|
{
|
||||||
|
Packet4f x = _x;
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
_EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
_EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);
|
||||||
|
|
||||||
@ -367,7 +375,8 @@ static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_pcos(Packet4f x)
|
|||||||
|
|
||||||
// This is Quake3's fast inverse square root.
|
// This is Quake3's fast inverse square root.
|
||||||
// For detail see here: http://www.beyond3d.com/content/articles/8/
|
// For detail see here: http://www.beyond3d.com/content/articles/8/
|
||||||
static EIGEN_UNUSED Packet4f ei_psqrt(Packet4f _x)
|
template<> EIGEN_UNUSED
|
||||||
|
Packet4f ei_psqrt<Packet4f>(const Packet4f& _x)
|
||||||
{
|
{
|
||||||
Packet4f half = ei_pmul(_x, ei_pset1(.5f));
|
Packet4f half = ei_pmul(_x, ei_pset1(.5f));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user