Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
Eigen  3.4.0
 
Loading...
Searching...
No Matches
arch/NEON/MathFunctions.h
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
11namespace Eigen {
12
13namespace internal {
14
15template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f pexp<Packet2f>(const Packet2f& x)
16{ return pexp_float(x); }
17template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f pexp<Packet4f>(const Packet4f& x)
18{ return pexp_float(x); }
19
20template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f plog<Packet2f>(const Packet2f& x)
21{ return plog_float(x); }
22template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f plog<Packet4f>(const Packet4f& x)
23{ return plog_float(x); }
24
25template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f psin<Packet2f>(const Packet2f& x)
26{ return psin_float(x); }
27template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f psin<Packet4f>(const Packet4f& x)
28{ return psin_float(x); }
29
30template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f pcos<Packet2f>(const Packet2f& x)
31{ return pcos_float(x); }
32template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f pcos<Packet4f>(const Packet4f& x)
33{ return pcos_float(x); }
34
35// Hyperbolic Tangent function.
36template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2f ptanh<Packet2f>(const Packet2f& x)
37{ return internal::generic_fast_tanh_float(x); }
38template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f ptanh<Packet4f>(const Packet4f& x)
39{ return internal::generic_fast_tanh_float(x); }
40
41BF16_PACKET_FUNCTION(Packet4f, Packet4bf, psin)
42BF16_PACKET_FUNCTION(Packet4f, Packet4bf, pcos)
43BF16_PACKET_FUNCTION(Packet4f, Packet4bf, plog)
44BF16_PACKET_FUNCTION(Packet4f, Packet4bf, pexp)
45BF16_PACKET_FUNCTION(Packet4f, Packet4bf, ptanh)
46
47template <>
48EIGEN_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
55template <>
56EIGEN_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
63template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2d pexp<Packet2d>(const Packet2d& x)
64{ return pexp_double(x); }
65
66template<> 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
Namespace containing all symbols from the Eigen library.
Definition: Core:141