Eigen  5.0.1-dev+master
 
Loading...
Searching...
No Matches
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// SPDX-FileCopyrightText: The Eigen Authors
8// SPDX-License-Identifier: MPL-2.0
9
10#ifndef EIGEN_MATH_FUNCTIONS_NEON_H
11#define EIGEN_MATH_FUNCTIONS_NEON_H
12
13// IWYU pragma: private
14#include "../../InternalHeaderCheck.h"
15
16namespace Eigen {
17
18namespace internal {
19
20EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(Packet2f)
21EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(Packet4f)
22
23#if EIGEN_ARCH_ARM64 && EIGEN_HAS_ARM64_FP16
24template <>
25EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet4hf ptanh<Packet4hf>(const Packet4hf& x) {
26 // Convert to float, call the float ptanh, and then convert back.
27 return vcvt_f16_f32(ptanh<Packet4f>(vcvt_f32_f16(x)));
28}
29
30template <>
31EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet8hf ptanh<Packet8hf>(const Packet8hf& x) {
32 // Convert each 4 half types to float, call the float ptanh, and then convert back.
33 return vcombine_f16(vcvt_f16_f32(ptanh<Packet4f>(vcvt_f32_f16(vget_low_f16(x)))),
34 vcvt_f16_f32(ptanh<Packet4f>(vcvt_f32_f16(vget_high_f16(x)))));
35}
36#endif // EIGEN_ARCH_ARM64 && EIGEN_HAS_ARM64_FP16
37
38//---------- double ----------
39
40#if EIGEN_ARCH_ARM64
41
42EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(Packet2d)
43
44#endif
45
46} // end namespace internal
47
48} // end namespace Eigen
49
50#endif // EIGEN_MATH_FUNCTIONS_NEON_H