arch/NEON/MathFunctions.h
Go to the documentation of this file.
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 // IWYU pragma: private
12 #include "../../InternalHeaderCheck.h"
13 
14 namespace Eigen {
15 
16 namespace internal {
17 
20 
21 #if EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC
22 template <>
23 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet4hf ptanh<Packet4hf>(const Packet4hf& x) {
24  // Convert to float, call the float ptanh, and then convert back.
25  return vcvt_f16_f32(ptanh<Packet4f>(vcvt_f32_f16(x)));
26 }
27 
28 template <>
29 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet8hf ptanh<Packet8hf>(const Packet8hf& x) {
30  // Convert each 4 half types to float, call the float ptanh, and then convert back.
31  return vcombine_f16(vcvt_f16_f32(ptanh<Packet4f>(vcvt_f32_f16(vget_low_f16(x)))),
32  vcvt_f16_f32(ptanh<Packet4f>(vcvt_high_f32_f16(x))));
33 }
34 #endif // EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC
35 
42 
43 template <>
45  Packet4f fexponent;
46  const Packet4bf out = F32ToBf16(pfrexp<Packet4f>(Bf16ToF32(a), fexponent));
47  exponent = F32ToBf16(fexponent);
48  return out;
49 }
50 
51 template <>
53  return F32ToBf16(pldexp<Packet4f>(Bf16ToF32(a), Bf16ToF32(exponent)));
54 }
55 
56 //---------- double ----------
57 
58 #if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG
59 
61 
62 #endif
63 
64 } // end namespace internal
65 
66 } // end namespace Eigen
67 
68 #endif // EIGEN_MATH_FUNCTIONS_NEON_H
#define BF16_PACKET_FUNCTION(PACKET_F, PACKET_BF16, METHOD)
Definition: BFloat16.h:34
#define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(PACKET)
Definition: GenericPacketMathFunctionsFwd.h:203
#define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(PACKET)
Definition: GenericPacketMathFunctionsFwd.h:188
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
const Scalar * a
Definition: level2_cplx_impl.h:32
__m128d Packet2d
Definition: LSX/PacketMath.h:36
EIGEN_STRONG_INLINE Packet8f Bf16ToF32(const Packet8bf &a)
Definition: AVX/PacketMath.h:2558
eigen_packet_wrapper< uint16x4_t, 19 > Packet4bf
Definition: NEON/PacketMath.h:4726
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog(const Packet &a)
Definition: GenericPacketMath.h:1103
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pcos(const Packet &a)
Definition: GenericPacketMath.h:1022
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin(const Packet &a)
Definition: GenericPacketMath.h:1015
EIGEN_STRONG_INLINE Packet4f pfrexp< Packet4f >(const Packet4f &a, Packet4f &exponent)
Definition: AltiVec/PacketMath.h:2328
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet4f ptanh< Packet4f >(const Packet4f &_x)
Definition: arch/MSA/MathFunctions.h:174
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet ptanh(const Packet &a)
Definition: GenericPacketMath.h:1071
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp2(const Packet &a)
Definition: GenericPacketMath.h:1091
float32x2_t Packet2f
Definition: NEON/PacketMath.h:75
EIGEN_STRONG_INLINE Packet4f pldexp< Packet4f >(const Packet4f &a, const Packet4f &exponent)
Definition: AltiVec/PacketMath.h:2319
EIGEN_STRONG_INLINE Packet8h pldexp(const Packet8h &a, const Packet8h &exponent)
Definition: arch/AVX/MathFunctions.h:80
EIGEN_STRONG_INLINE Packet8h pfrexp(const Packet8h &a, Packet8h &exponent)
Definition: arch/AVX/MathFunctions.h:72
__vector float Packet4f
Definition: AltiVec/PacketMath.h:33
EIGEN_STRONG_INLINE Packet8bf F32ToBf16(Packet4f p4f)
Definition: AltiVec/PacketMath.h:2059
EIGEN_STRONG_INLINE Packet4f pexp(const Packet4f &_x)
Definition: LSX/PacketMath.h:2663
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
Definition: GenericPacketMath.h:225
std::ofstream out("Result.txt")