mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
add SSE2 versions of sin, cos, log, exp using code from Julien
Pommier. They are for float only, and they return exactly the same result as the standard versions in about 90% of the cases. Otherwise the max error is below 1e-7. However, for very large values (>1e3) the accuracy of sin and cos slighlty decrease. They are about 3 or 4 times faster than 4 calls to their respective standard versions. So, is it ok to enable them by default in their respective functors ?
This commit is contained in:
@@ -45,8 +45,10 @@ typedef __vector __bool int v4bi;
|
||||
#define USE_CONST_v1i_ const v4ui v1i_ = vec_splat_u32(-1)
|
||||
#define USE_CONST_v0f_ USE_CONST_v1i_; const v4f v0f_ = (v4f) vec_sl(v1i_, v1i_)
|
||||
|
||||
template<> struct ei_packet_traits<float> { typedef v4f type; enum {size=4}; };
|
||||
template<> struct ei_packet_traits<int> { typedef v4i type; enum {size=4}; };
|
||||
template<> struct ei_packet_traits<float> : ei_default_packet_traits
|
||||
{ typedef v4f type; enum {size=4}; };
|
||||
template<> struct ei_packet_traits<int> : ei_default_packet_traits
|
||||
{ typedef v4i type; enum {size=4}; };
|
||||
|
||||
template<> struct ei_unpacket_traits<v4f> { typedef float type; enum {size=4}; };
|
||||
template<> struct ei_unpacket_traits<v4i> { typedef int type; enum {size=4}; };
|
||||
|
||||
Reference in New Issue
Block a user