NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
polygamma.hpp
Go to the documentation of this file.
1
28#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
38namespace 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.cend(),
75 returnArray.begin(),
76 [n](dtype inValue) -> auto { return polygamma(n, inValue); });
77
78 return returnArray;
79 }
80} // namespace nc::special
81
82#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:139
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1365
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4511
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1673
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