NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
bessel_in.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <cmath>
31
32#if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
33
36#include "NumCpp/NdArray.hpp"
37
38#ifndef __cpp_lib_math_special_functions
39#include "boost/math/special_functions/bessel.hpp"
40#endif
41
42namespace nc::special
43{
44 //============================================================================
45 // Method Description:
54 template<typename dtype1, typename dtype2>
55 auto bessel_in(dtype1 inV, dtype2 inX)
56 {
59
60#ifdef __cpp_lib_math_special_functions
61 return std::cyl_bessel_i(static_cast<double>(inV), static_cast<double>(inX));
62#else
63 return boost::math::cyl_bessel_i(static_cast<double>(inV), static_cast<double>(inX));
64#endif
65 }
66
67 //============================================================================
68 // Method Description:
77 template<typename dtype1, typename dtype2>
78 auto bessel_in(dtype1 inV, const NdArray<dtype2>& inArrayX)
79 {
80 NdArray<decltype(bessel_in(dtype1{ 0 }, dtype2{ 0 }))> returnArray(inArrayX.shape());
81
83 inArrayX.cend(),
84 returnArray.begin(),
85 [inV](dtype2 inX) -> auto { return bessel_in(inV, inX); });
86
87 return returnArray;
88 }
89} // namespace nc::special
90
91#endif // #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:135
const_iterator cbegin() const noexcept
Definition NdArrayCore.hpp:1361
const Shape & shape() const noexcept
Definition NdArrayCore.hpp:4587
const_iterator cend() const noexcept
Definition NdArrayCore.hpp:1669
Definition airy_ai.hpp:39
auto bessel_in(dtype1 inV, dtype2 inX)
Definition bessel_in.hpp:55
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:776