Eigen-Contrib  5.0.1
 
Loading...
Searching...
No Matches
SpecialFunctionsHalf.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_SPECIALFUNCTIONS_HALF_H
11#define EIGEN_SPECIALFUNCTIONS_HALF_H
12
13// IWYU pragma: private
14#include "./InternalHeaderCheck.h"
15
16namespace Eigen {
17namespace numext {
18
19template <>
20EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half lgamma(const Eigen::half& a) {
21 return Eigen::half(Eigen::numext::lgamma(static_cast<float>(a)));
22}
23template <>
24EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half digamma(const Eigen::half& a) {
25 return Eigen::half(Eigen::numext::digamma(static_cast<float>(a)));
26}
27template <>
28EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half zeta(const Eigen::half& x, const Eigen::half& q) {
29 return Eigen::half(Eigen::numext::zeta(static_cast<float>(x), static_cast<float>(q)));
30}
31template <>
32EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half polygamma(const Eigen::half& n, const Eigen::half& x) {
33 return Eigen::half(Eigen::numext::polygamma(static_cast<float>(n), static_cast<float>(x)));
34}
35template <>
36EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erf(const Eigen::half& a) {
37 return Eigen::half(Eigen::numext::erf(static_cast<float>(a)));
38}
39template <>
40EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erfc(const Eigen::half& a) {
41 return Eigen::half(Eigen::numext::erfc(static_cast<float>(a)));
42}
43template <>
44EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half ndtri(const Eigen::half& a) {
45 return Eigen::half(Eigen::numext::ndtri(static_cast<float>(a)));
46}
47template <>
48EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma(const Eigen::half& a, const Eigen::half& x) {
49 return Eigen::half(Eigen::numext::igamma(static_cast<float>(a), static_cast<float>(x)));
50}
51template <>
52EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma_der_a(const Eigen::half& a, const Eigen::half& x) {
53 return Eigen::half(Eigen::numext::igamma_der_a(static_cast<float>(a), static_cast<float>(x)));
54}
55template <>
56EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half gamma_sample_der_alpha(const Eigen::half& alpha,
57 const Eigen::half& sample) {
58 return Eigen::half(Eigen::numext::gamma_sample_der_alpha(static_cast<float>(alpha), static_cast<float>(sample)));
59}
60template <>
61EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igammac(const Eigen::half& a, const Eigen::half& x) {
62 return Eigen::half(Eigen::numext::igammac(static_cast<float>(a), static_cast<float>(x)));
63}
64template <>
65EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half betainc(const Eigen::half& a, const Eigen::half& b,
66 const Eigen::half& x) {
67 return Eigen::half(Eigen::numext::betainc(static_cast<float>(a), static_cast<float>(b), static_cast<float>(x)));
68}
69
70} // end namespace numext
71} // end namespace Eigen
72
73#endif // EIGEN_SPECIALFUNCTIONS_HALF_H
Namespace containing all symbols from the Eigen library.