cart-elc

Source code for CART-ELC
git clone git://git.laack.co/cart-elc.git
Log | Files | Refs | README | LICENSE

MathFunctions.h (3083B)


      1 // This file is part of Eigen, a lightweight C++ template library
      2 // for linear algebra.
      3 //
      4 // This Source Code Form is subject to the terms of the Mozilla
      5 // Public License v. 2.0. If a copy of the MPL was not distributed
      6 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
      7 
      8 #ifndef EIGEN_MATH_FUNCTIONS_NEON_H
      9 #define EIGEN_MATH_FUNCTIONS_NEON_H
     10 
     11 namespace Eigen {
     12 
     13 namespace internal {
     14 
     15 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f pexp<Packet2f>(const Packet2f& x)
     16 { return pexp_float(x); }
     17 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f pexp<Packet4f>(const Packet4f& x)
     18 { return pexp_float(x); }
     19 
     20 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f plog<Packet2f>(const Packet2f& x)
     21 { return plog_float(x); }
     22 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f plog<Packet4f>(const Packet4f& x)
     23 { return plog_float(x); }
     24 
     25 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f psin<Packet2f>(const Packet2f& x)
     26 { return psin_float(x); }
     27 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f psin<Packet4f>(const Packet4f& x)
     28 { return psin_float(x); }
     29 
     30 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f pcos<Packet2f>(const Packet2f& x)
     31 { return pcos_float(x); }
     32 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f pcos<Packet4f>(const Packet4f& x)
     33 { return pcos_float(x); }
     34 
     35 // Hyperbolic Tangent function.
     36 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f ptanh<Packet2f>(const Packet2f& x)
     37 { return internal::generic_fast_tanh_float(x); }
     38 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f ptanh<Packet4f>(const Packet4f& x)
     39 { return internal::generic_fast_tanh_float(x); }
     40 
     41 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, psin)
     42 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, pcos)
     43 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, plog)
     44 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, pexp)
     45 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, ptanh)
     46 
     47 template <>
     48 EIGEN_STRONG_INLINE Packet4bf pfrexp(const Packet4bf& a, Packet4bf& exponent) {
     49   Packet4f fexponent;
     50   const Packet4bf out = F32ToBf16(pfrexp<Packet4f>(Bf16ToF32(a), fexponent));
     51   exponent = F32ToBf16(fexponent);
     52   return out;
     53 }
     54 
     55 template <>
     56 EIGEN_STRONG_INLINE Packet4bf pldexp(const Packet4bf& a, const Packet4bf& exponent) {
     57   return F32ToBf16(pldexp<Packet4f>(Bf16ToF32(a), Bf16ToF32(exponent)));
     58 }
     59 
     60 //---------- double ----------
     61 
     62 #if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG
     63 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2d pexp<Packet2d>(const Packet2d& x)
     64 { return pexp_double(x); }
     65 
     66 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2d plog<Packet2d>(const Packet2d& x)
     67 { return plog_double(x); }
     68 
     69 #endif
     70 
     71 } // end namespace internal
     72 
     73 } // end namespace Eigen
     74 
     75 #endif // EIGEN_MATH_FUNCTIONS_NEON_H