Medial Code Documentation
Loading...
Searching...
No Matches
SpecialFunctions.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2015 Eugene Brevdo <ebrevdo@gmail.com>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_SPECIAL_FUNCTIONS_H
11#define EIGEN_SPECIAL_FUNCTIONS_H
12
13namespace Eigen {
14namespace internal {
15
16/****************************************************************************
17 * Implementation of lgamma *
18 ****************************************************************************/
19
20template<typename Scalar>
22{
24 static EIGEN_STRONG_INLINE Scalar run(const Scalar&)
25 {
26 EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false),
27 THIS_TYPE_IS_NOT_SUPPORTED);
28 return Scalar(0);
29 }
30};
31
32template<typename Scalar>
34{
35 typedef Scalar type;
36};
37
38#ifdef EIGEN_HAS_C99_MATH
39template<>
40struct lgamma_impl<float>
41{
43 static EIGEN_STRONG_INLINE double run(const float& x) { return ::lgammaf(x); }
44};
45
46template<>
47struct lgamma_impl<double>
48{
49 EIGEN_DEVICE_FUNC
50 static EIGEN_STRONG_INLINE double run(const double& x) { return ::lgamma(x); }
51};
52#endif
53
54/****************************************************************************
55 * Implementation of erf *
56 ****************************************************************************/
57
58template<typename Scalar>
60{
62 static EIGEN_STRONG_INLINE Scalar run(const Scalar&)
63 {
64 EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false),
65 THIS_TYPE_IS_NOT_SUPPORTED);
66 return Scalar(0);
67 }
68};
69
70template<typename Scalar>
72{
73 typedef Scalar type;
74};
75
76#ifdef EIGEN_HAS_C99_MATH
77template<>
78struct erf_impl<float>
79{
81 static EIGEN_STRONG_INLINE float run(const float& x) { return ::erff(x); }
82};
83
84template<>
85struct erf_impl<double>
86{
87 EIGEN_DEVICE_FUNC
88 static EIGEN_STRONG_INLINE double run(const double& x) { return ::erf(x); }
89};
90#endif // EIGEN_HAS_C99_MATH
91
92/***************************************************************************
93* Implementation of erfc *
94****************************************************************************/
95
96template<typename Scalar>
98{
100 static EIGEN_STRONG_INLINE Scalar run(const Scalar&)
101 {
102 EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false),
103 THIS_TYPE_IS_NOT_SUPPORTED);
104 return Scalar(0);
105 }
106};
107
108template<typename Scalar>
110{
111 typedef Scalar type;
112};
113
114#ifdef EIGEN_HAS_C99_MATH
115template<>
116struct erfc_impl<float>
117{
119 static EIGEN_STRONG_INLINE float run(const float x) { return ::erfcf(x); }
120};
121
122template<>
123struct erfc_impl<double>
124{
125 EIGEN_DEVICE_FUNC
126 static EIGEN_STRONG_INLINE double run(const double x) { return ::erfc(x); }
127};
128#endif // EIGEN_HAS_C99_MATH
129
130} // end namespace internal
131
132
133namespace numext {
134
135template<typename Scalar>
136EIGEN_DEVICE_FUNC
137inline EIGEN_MATHFUNC_RETVAL(lgamma, Scalar) lgamma(const Scalar& x)
138{
139 return EIGEN_MATHFUNC_IMPL(lgamma, Scalar)::run(x);
140}
141
142template<typename Scalar>
143EIGEN_DEVICE_FUNC
144inline EIGEN_MATHFUNC_RETVAL(erf, Scalar) erf(const Scalar& x)
145{
146 return EIGEN_MATHFUNC_IMPL(erf, Scalar)::run(x);
147}
148
149template<typename Scalar>
150EIGEN_DEVICE_FUNC
151inline EIGEN_MATHFUNC_RETVAL(erfc, Scalar) erfc(const Scalar& x)
152{
153 return EIGEN_MATHFUNC_IMPL(erfc, Scalar)::run(x);
154}
155
156} // end namespace numext
157
158} // end namespace Eigen
159
160#endif // EIGEN_SPECIAL_FUNCTIONS_H
Pseudo expression representing a solving operation.
Definition Solve.h:63
Definition SpecialFunctions.h:60
Definition SpecialFunctions.h:72
Definition SpecialFunctions.h:98
Definition SpecialFunctions.h:110
Definition Meta.h:39
Definition SpecialFunctions.h:22
Definition SpecialFunctions.h:34