Added support for fast reciprocal square root computation.

This commit is contained in:
Benoit Steiner
2015-02-26 09:42:41 -08:00
parent 8e817b65d0
commit f41b1f1666
8 changed files with 72 additions and 6 deletions

View File

@@ -58,6 +58,7 @@ struct default_packet_traits
HasDiv = 0,
HasSqrt = 0,
HasRsqrt = 0,
HasExp = 0,
HasLog = 0,
HasPow = 0,
@@ -352,6 +353,14 @@ Packet plog(const Packet& a) { using std::log; return log(a); }
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet psqrt(const Packet& a) { using std::sqrt; return sqrt(a); }
/** \internal \returns the reciprocal square-root of \a a (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet prsqrt(const Packet& a) {
using std::sqrt;
const Packet one(1);
return one/sqrt(a);
}
/***************************************************************************
* The following functions might not have to be overwritten for vectorized types
***************************************************************************/