NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bessel_jn.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
42#include <type_traits>
43
44namespace nc::special
45{
46 //============================================================================
47 // Method Description:
56 template<typename dtype1, typename dtype2>
58 {
61
62#ifdef __cpp_lib_math_special_functions
63 return std::cyl_bessel_j(static_cast<double>(inV), static_cast<double>(inX));
64#else
65 return boost::math::cyl_bessel_j(static_cast<double>(inV), static_cast<double>(inX));
66#endif
67 }
68
69 //============================================================================
70 // Method Description:
79 template<typename dtype1, typename dtype2>
81 {
82 NdArray<decltype(bessel_jn(dtype1{ 0 }, dtype2{ 0 }))> returnArray(inArrayX.shape());
83
85 inArrayX.cend(),
86 returnArray.begin(),
87 [inV](dtype2 inX) -> auto { return bessel_jn(inV, inX); });
88
89 return returnArray;
90 }
91} // namespace nc::special
92
93#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:139
Definition airy_ai.hpp:39
auto bessel_jn(dtype1 inV, dtype2 inX)
Definition bessel_jn.hpp:57
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:775
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59