BesselFunctionsBFloat16.h (2724B)
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_BESSELFUNCTIONS_BFLOAT16_H 9 #define EIGEN_BESSELFUNCTIONS_BFLOAT16_H 10 11 namespace Eigen { 12 namespace numext { 13 14 #if EIGEN_HAS_C99_MATH 15 template <> 16 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_i0(const Eigen::bfloat16& x) { 17 return Eigen::bfloat16(Eigen::numext::bessel_i0(static_cast<float>(x))); 18 } 19 template <> 20 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_i0e(const Eigen::bfloat16& x) { 21 return Eigen::bfloat16(Eigen::numext::bessel_i0e(static_cast<float>(x))); 22 } 23 template <> 24 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_i1(const Eigen::bfloat16& x) { 25 return Eigen::bfloat16(Eigen::numext::bessel_i1(static_cast<float>(x))); 26 } 27 template <> 28 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_i1e(const Eigen::bfloat16& x) { 29 return Eigen::bfloat16(Eigen::numext::bessel_i1e(static_cast<float>(x))); 30 } 31 template <> 32 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_j0(const Eigen::bfloat16& x) { 33 return Eigen::bfloat16(Eigen::numext::bessel_j0(static_cast<float>(x))); 34 } 35 template <> 36 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_j1(const Eigen::bfloat16& x) { 37 return Eigen::bfloat16(Eigen::numext::bessel_j1(static_cast<float>(x))); 38 } 39 template <> 40 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_y0(const Eigen::bfloat16& x) { 41 return Eigen::bfloat16(Eigen::numext::bessel_y0(static_cast<float>(x))); 42 } 43 template <> 44 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_y1(const Eigen::bfloat16& x) { 45 return Eigen::bfloat16(Eigen::numext::bessel_y1(static_cast<float>(x))); 46 } 47 template <> 48 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_k0(const Eigen::bfloat16& x) { 49 return Eigen::bfloat16(Eigen::numext::bessel_k0(static_cast<float>(x))); 50 } 51 template <> 52 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_k0e(const Eigen::bfloat16& x) { 53 return Eigen::bfloat16(Eigen::numext::bessel_k0e(static_cast<float>(x))); 54 } 55 template <> 56 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_k1(const Eigen::bfloat16& x) { 57 return Eigen::bfloat16(Eigen::numext::bessel_k1(static_cast<float>(x))); 58 } 59 template <> 60 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::bfloat16 bessel_k1e(const Eigen::bfloat16& x) { 61 return Eigen::bfloat16(Eigen::numext::bessel_k1e(static_cast<float>(x))); 62 } 63 #endif 64 65 } // end namespace numext 66 } // end namespace Eigen 67 68 #endif // EIGEN_BESSELFUNCTIONS_BFLOAT16_H