Add log2() to Eigen.

This commit is contained in:
Rasmus Munk Larsen
2020-12-04 21:45:09 +00:00
parent 2dbac2f99f
commit f9fac1d5b0
13 changed files with 160 additions and 12 deletions

View File

@@ -650,6 +650,13 @@ Packet plog1p(const Packet& a) { return numext::log1p(a); }
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet plog10(const Packet& a) { EIGEN_USING_STD(log10); return log10(a); }
/** \internal \returns the log10 of \a a (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet plog2(const Packet& a) {
typedef typename internal::unpacket_traits<Packet>::type Scalar;
return pmul(pset1<Packet>(Scalar(M_LOG2E)), plog(a));
}
/** \internal \returns the square-root of \a a (coeff-wise) */
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet psqrt(const Packet& a) { EIGEN_USING_STD(sqrt); return sqrt(a); }