NumCpp  2.7.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
spherical_bessel_yn.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 namespace nc
43 {
44  namespace special
45  {
46  //============================================================================
47  // Method Description:
56  template<typename dtype>
57  auto spherical_bessel_yn(uint32 inV, dtype inX)
58  {
60 
61 #ifdef __cpp_lib_math_special_functions
62  return std::sph_neumann(inV, inX);
63 #else
64  return boost::math::sph_neumann(inV, inX);
65 #endif
66  }
67 
68  //============================================================================
69  // Method Description:
78  template<typename dtype>
79  auto spherical_bessel_yn(uint32 inV, const NdArray<dtype>& inArrayX)
80  {
81  NdArray<decltype(arccos(dtype{0}))> returnArray(inArrayX.shape());
82 
83  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(),
84  [inV](dtype inX) -> auto
85  {
86  return spherical_bessel_yn(inV, inX);
87  });
88 
89  return returnArray;
90  }
91  } // namespace special
92 } // namespace nc
93 
94 #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 spherical_bessel_yn(uint32 inV, dtype inX)
Definition: spherical_bessel_yn.hpp:57
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
Definition: Coordinate.hpp:45
auto arccos(dtype inValue) noexcept
Definition: arccos.hpp:49
std::uint32_t uint32
Definition: Types.hpp:40