diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-03-25 12:26:13 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-03-25 12:26:13 +0000 |
commit | 17860e578cab13d5aacf8b5e6e373e59403352ba (patch) | |
tree | 285e8ef963751a1a96ea127457ff51cf44a6cf16 /Eigen/src/Core/arch/AltiVec/PacketMath.h | |
parent | 64fbd93cd904790e831aa5404698c5aa30f54be4 (diff) |
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 ?
Diffstat (limited to 'Eigen/src/Core/arch/AltiVec/PacketMath.h')
-rw-r--r-- | Eigen/src/Core/arch/AltiVec/PacketMath.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h index d183f048f..e87dd1962 100644 --- a/Eigen/src/Core/arch/AltiVec/PacketMath.h +++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h @@ -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}; }; |