Add special functions to Eigen: lgamma, erf, erfc.

Includes CUDA support and unit tests.
This commit is contained in:
Eugene Brevdo
2015-12-07 15:24:49 -08:00
parent 7dfe75f445
commit fa4f933c0f
14 changed files with 513 additions and 1 deletions

View File

@@ -74,6 +74,9 @@ struct default_packet_traits
HasSinh = 0,
HasCosh = 0,
HasTanh = 0,
HasLGamma = 0,
HasErf = 0,
HasErfc = 0
HasRound = 0,
HasFloor = 0,
@@ -432,6 +435,18 @@ Packet pfloor(const Packet& a) { using numext::floor; return floor(a); }
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet pceil(const Packet& a) { using numext::ceil; return ceil(a); }
/** \internal \returns the ln(|gamma(\a a)|) (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet plgamma(const Packet& a) { return numext::lgamma(a); }
/** \internal \returns the erf(\a a) (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet perf(const Packet& a) { return numext::erf(a); }
/** \internal \returns the erfc(\a a) (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet perfc(const Packet& a) { return numext::erfc(a); }
/***************************************************************************
* The following functions might not have to be overwritten for vectorized types
***************************************************************************/