NumCpp  1.0
A C++ implementation of the Python Numpy library
bessel_kn.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/NdArray.hpp"
34 
35 #include "boost/math/special_functions/bessel.hpp"
36 
37 #include <type_traits>
38 
39 namespace nc
40 {
41  namespace special
42  {
43  //============================================================================
44  // Method Description:
52  template<typename dtype1, typename dtype2>
53  auto bessel_kn(dtype1 inV, dtype2 inX)
54  {
57 
58  return boost::math::cyl_bessel_k(inV, inX);
59  }
60 
61  //============================================================================
62  // Method Description:
70  template<typename dtype1, typename dtype2>
71  auto bessel_kn(dtype1 inV, const NdArray<dtype2>& inArrayX)
72  {
73  NdArray<decltype(bessel_in(dtype1{ 0 }, dtype2{ 0 }))> returnArray(inArrayX.shape());
74 
75  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(),
76  [inV](dtype2 inX) -> auto
77  {
78  return bessel_kn(inV, inX);
79  });
80 
81  return returnArray;
82  }
83  }
84 }
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4296
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:38
nc::special::bessel_in
auto bessel_in(dtype1 inV, dtype2 inX)
Definition: bessel_in.hpp:53
nc::NdArray
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:75
NdArray.hpp
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1491
nc
Definition: Coordinate.hpp:45
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction) noexcept
Definition: StlAlgorithms.hpp:703
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1147
nc::special::bessel_kn
auto bessel_kn(dtype1 inV, dtype2 inX)
Definition: bessel_kn.hpp:53
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1091