NumCpp  2.11.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 NUMCPP_NO_USE_BOOST
31 
32 #include "boost/math/special_functions/polygamma.hpp"
33 
36 #include "NumCpp/NdArray.hpp"
37 
38 namespace nc::special
39 {
40  //============================================================================
41  // Method Description:
50  template<typename dtype>
51  auto polygamma(uint32 n, dtype inValue)
52  {
54 
55  return boost::math::polygamma(n, inValue);
56  }
57 
58  //============================================================================
59  // Method Description:
68  template<typename dtype>
69  auto polygamma(uint32 n, const NdArray<dtype>& inArray)
70  {
71  NdArray<decltype(polygamma(n, dtype{ 0 }))> returnArray(inArray.shape());
72 
74  inArray.cbegin(),
75  inArray.cend(),
76  returnArray.begin(),
77  [n](dtype inValue) -> auto{ return polygamma(n, inValue); });
78 
79  return returnArray;
80  }
81 } // namespace nc::special
82 
83 #endif // #ifndef 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:138
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1318
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1626
iterator begin() noexcept
Definition: NdArrayCore.hpp:1268
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4464
Definition: airy_ai.hpp:39
auto polygamma(uint32 n, dtype inValue)
Definition: polygamma.hpp:51
auto polygamma(uint32 n, const NdArray< dtype > &inArray)
Definition: polygamma.hpp:69
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:775
std::uint32_t uint32
Definition: Types.hpp:40