NumCpp  2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
polygamma.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #ifndef NO_USE_BOOST
31 
34 #include "NumCpp/NdArray.hpp"
35 
36 #include "boost/math/special_functions/polygamma.hpp"
37 
38 namespace nc
39 {
40  namespace special
41  {
42  //============================================================================
43  // Method Description:
53  template<typename dtype>
54  auto polygamma(uint32 n, dtype inValue)
55  {
57 
58  return boost::math::polygamma(n, inValue);
59  }
60 
61  //============================================================================
62  // Method Description:
72  template<typename dtype>
73  auto polygamma(uint32 n, const NdArray<dtype>& inArray)
74  {
75  NdArray<decltype(polygamma(n, dtype{0}))> returnArray(inArray.shape());
76 
77  stl_algorithms::transform(inArray.cbegin(), inArray.cend(), returnArray.begin(),
78  [n](dtype inValue) -> auto
79  {
80  return polygamma(n, inValue);
81  });
82 
83  return returnArray;
84  }
85  } // namespace special
86 } // namespace nc
87 
88 #endif // #ifndef NO_USE_BOOST
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4356
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
nc::NdArray< dtype >
nc::special::polygamma
auto polygamma(uint32 n, dtype inValue)
Definition: polygamma.hpp:54
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:40
NdArray.hpp
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1487
nc
Definition: Coordinate.hpp:44
nc::special::polygamma
auto polygamma(uint32 n, const NdArray< dtype > &inArray)
Definition: polygamma.hpp:73
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1143
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1087