NumCpp  2.7.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
bessel_in.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
31 
34 #include "NumCpp/NdArray.hpp"
35 
36 #ifdef __cpp_lib_math_special_functions
37 #include <cmath>
38 #else
39 #include "boost/math/special_functions/bessel.hpp"
40 #endif
41 
42 #include <type_traits>
43 
44 namespace nc
45 {
46  namespace special
47  {
48  //============================================================================
49  // Method Description:
58  template<typename dtype1, typename dtype2>
59  auto bessel_in(dtype1 inV, dtype2 inX)
60  {
63 
64 #ifdef __cpp_lib_math_special_functions
65  return std::cyl_bessel_i(inV, inX);
66 #else
67  return boost::math::cyl_bessel_i(inV, inX);
68 #endif
69  }
70 
71  //============================================================================
72  // Method Description:
81  template<typename dtype1, typename dtype2>
82  auto bessel_in(dtype1 inV, const NdArray<dtype2>& inArrayX)
83  {
84  NdArray<decltype(bessel_in(dtype1{ 0 }, dtype2{ 0 }))> returnArray(inArrayX.shape());
85 
86  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(),
87  [inV](dtype2 inX) -> auto
88  {
89  return bessel_in(inV, inX);
90  });
91 
92  return returnArray;
93  }
94  } // namespace special
95 } // namespace nc
96 
97 #endif // #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1216
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4283
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1524
iterator begin() noexcept
Definition: NdArrayCore.hpp:1166
auto bessel_in(dtype1 inV, dtype2 inX)
Definition: bessel_in.hpp:59
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
Definition: Coordinate.hpp:45