Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:51:42

0001 // This file is part of Eigen, a lightweight C++ template library
0002 // for linear algebra.
0003 //
0004 // This Source Code Form is subject to the terms of the Mozilla
0005 // Public License v. 2.0. If a copy of the MPL was not distributed
0006 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
0007 
0008 #ifndef EIGEN_MATH_FUNCTIONS_NEON_H
0009 #define EIGEN_MATH_FUNCTIONS_NEON_H
0010 
0011 namespace Eigen {
0012 
0013 namespace internal {
0014 
0015 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f pexp<Packet2f>(const Packet2f& x)
0016 { return pexp_float(x); }
0017 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f pexp<Packet4f>(const Packet4f& x)
0018 { return pexp_float(x); }
0019 
0020 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f plog<Packet2f>(const Packet2f& x)
0021 { return plog_float(x); }
0022 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f plog<Packet4f>(const Packet4f& x)
0023 { return plog_float(x); }
0024 
0025 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f psin<Packet2f>(const Packet2f& x)
0026 { return psin_float(x); }
0027 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f psin<Packet4f>(const Packet4f& x)
0028 { return psin_float(x); }
0029 
0030 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f pcos<Packet2f>(const Packet2f& x)
0031 { return pcos_float(x); }
0032 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f pcos<Packet4f>(const Packet4f& x)
0033 { return pcos_float(x); }
0034 
0035 // Hyperbolic Tangent function.
0036 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f ptanh<Packet2f>(const Packet2f& x)
0037 { return internal::generic_fast_tanh_float(x); }
0038 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f ptanh<Packet4f>(const Packet4f& x)
0039 { return internal::generic_fast_tanh_float(x); }
0040 
0041 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, psin)
0042 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, pcos)
0043 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, plog)
0044 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, pexp)
0045 BF16_PACKET_FUNCTION(Packet4f, Packet4bf, ptanh)
0046 
0047 template <>
0048 EIGEN_STRONG_INLINE Packet4bf pfrexp(const Packet4bf& a, Packet4bf& exponent) {
0049   Packet4f fexponent;
0050   const Packet4bf out = F32ToBf16(pfrexp<Packet4f>(Bf16ToF32(a), fexponent));
0051   exponent = F32ToBf16(fexponent);
0052   return out;
0053 }
0054 
0055 template <>
0056 EIGEN_STRONG_INLINE Packet4bf pldexp(const Packet4bf& a, const Packet4bf& exponent) {
0057   return F32ToBf16(pldexp<Packet4f>(Bf16ToF32(a), Bf16ToF32(exponent)));
0058 }
0059 
0060 //---------- double ----------
0061 
0062 #if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG
0063 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2d pexp<Packet2d>(const Packet2d& x)
0064 { return pexp_double(x); }
0065 
0066 template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2d plog<Packet2d>(const Packet2d& x)
0067 { return plog_double(x); }
0068 
0069 #endif
0070 
0071 } // end namespace internal
0072 
0073 } // end namespace Eigen
0074 
0075 #endif // EIGEN_MATH_FUNCTIONS_NEON_H