Add generic PacketMath implementation of the Error Function (erf).

This commit is contained in:
Rasmus Munk Larsen
2019-09-19 12:48:30 -07:00
parent e02d429637
commit 6de5ed08d8
20 changed files with 265 additions and 90 deletions

View File

@@ -147,6 +147,13 @@ ptanh<Packet4f>(const Packet4f& x) {
return internal::generic_fast_tanh_float(x);
}
// Error function.
template <>
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f
perf<Packet4f>(const Packet4f& a) {
return internal::generic_fast_erf_float(a);
}
} // end namespace internal
namespace numext {

View File

@@ -96,28 +96,29 @@ template<> struct is_arithmetic<__m128d> { enum { value = true }; };
// Use the packet_traits defined in AVX/PacketMath.h instead if we're going
// to leverage AVX instructions.
#ifndef EIGEN_VECTORIZE_AVX
template<> struct packet_traits<float> : default_packet_traits
{
template <>
struct packet_traits<float> : default_packet_traits {
typedef Packet4f type;
typedef Packet4f half;
enum {
Vectorizable = 1,
AlignedOnScalar = 1,
size=4,
size = 4,
HasHalfPacket = 0,
HasDiv = 1,
HasSin = EIGEN_FAST_MATH,
HasCos = EIGEN_FAST_MATH,
HasLog = 1,
HasLog1p = 1,
HasExpm1 = 1,
HasDiv = 1,
HasSin = EIGEN_FAST_MATH,
HasCos = EIGEN_FAST_MATH,
HasLog = 1,
HasLog1p = 1,
HasExpm1 = 1,
HasNdtri = 1,
HasExp = 1,
HasBessel = 1,
HasExp = 1,
HasBessel = 1,
HasSqrt = 1,
HasRsqrt = 1,
HasTanh = EIGEN_FAST_MATH,
HasTanh = EIGEN_FAST_MATH,
HasErf = EIGEN_FAST_MATH,
HasBlend = 1,
HasFloor = 1
@@ -128,8 +129,8 @@ template<> struct packet_traits<float> : default_packet_traits
#endif
};
};
template<> struct packet_traits<double> : default_packet_traits
{
template <>
struct packet_traits<double> : default_packet_traits {
typedef Packet2d type;
typedef Packet2d half;
enum {