mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
bessel.hpp
Go to the documentation of this file.
1 /** \file bessel.hpp
2  * \brief Declares and defines Bessel functions of the first kind.
3  * \ingroup gen_math_files
4  * \author Jared R. Males (jaredmales@gmail.com)
5  *
6  */
7 
8 //***********************************************************************//
9 // Copyright 2020 Jared R. Males (jaredmales@gmail.com)
10 //
11 // This file is part of mxlib.
12 //
13 // mxlib is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // mxlib is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with mxlib. If not, see <http://www.gnu.org/licenses/>.
25 //***********************************************************************//
26 
27 #ifndef mx_bessel_hpp
28 #define mx_bessel_hpp
29 
30 #include <type_traits>
31 
32 #ifdef MX_INCLUDE_BOOST
33 #include <boost/math/special_functions/bessel.hpp>
34 #endif
35 
36 namespace mx
37 {
38 namespace math
39 {
40 namespace func
41 {
42 
43 /// Bessel Functions of the First Kind.
44 /** This is a wrapper for boost.
45  *
46  * \ingroup gen_math_bessel
47  */
48 template<typename T1, typename T2>
49 T2 bessel_j( T1 v, ///< [in]
50  T2 x ///< [in]
51  )
52 {
53 #ifdef MX_INCLUDE_BOOST
54  return boost::math::cyl_bessel_j<T1, T2>(v,x);
55 #else
56  static_assert(std::is_fundamental<T1>::value || !std::is_fundamental<T1>::value, "bessel_j<T1,T2> not specialized for type T1 and/or T2, and MX_INCLUDE_BOOST is not defined, so I can't just use boost.");
57  return 0;
58 #endif
59 }
60 
61 template<>
62 float bessel_j<float, float>( float v,
63  float x
64  );
65 
66 template<>
67 float bessel_j<int, float>( int v,
68  float x
69  );
70 
71 template<>
72 double bessel_j<double, double>( double v,
73  double x
74  );
75 
76 template<>
77 double bessel_j<int, double>( int v,
78  double x
79  );
80 
81 template<>
82 long double bessel_j<long double, long double>( long double v,
83  long double x
84  );
85 
86 template<>
87 long double bessel_j<int, long double>( int v,
88  long double x
89  );
90 
91 #ifdef HASQUAD
92 template<>
93 __float128 bessel_j<__float128, __float128>( __float128 v,
94  __float128 x
95  );
96 
97 template<>
98 __float128 bessel_j<int, __float128>( int v,
99  __float128 x
100  );
101 #endif
102 
103 }
104 }
105 }
106 
107 #endif //mx_bessel_hpp
T2 bessel_j(T1 v, T2 x)
Bessel Functions of the First Kind.
Definition: bessel.hpp:49
The mxlib c++ namespace.
Definition: mxError.hpp:107