NumCpp  2.10.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
riemann_zeta.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include <cmath>
31 
32 #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
33 
36 #include "NumCpp/NdArray.hpp"
37 
38 #ifndef __cpp_lib_math_special_functions
39 #include "boost/math/special_functions/zeta.hpp"
40 #endif
41 
42 namespace nc::special
43 {
44  //============================================================================
45  // Method Description:
54  template<typename dtype>
55  auto riemann_zeta(dtype inValue)
56  {
58 
59 #ifdef __cpp_lib_math_special_functions
60  return std::riemann_zeta(inValue);
61 #else
62  return boost::math::zeta(inValue);
63 #endif
64  }
65 
66  //============================================================================
67  // Method Description:
76  template<typename dtype>
77  auto riemann_zeta(const NdArray<dtype>& inArray)
78  {
79  NdArray<decltype(riemann_zeta(dtype{ 0 }))> returnArray(inArray.shape());
80 
82  inArray.cbegin(),
83  inArray.cend(),
84  returnArray.begin(),
85  [](dtype inValue) -> auto{ return riemann_zeta(inValue); });
86 
87  return returnArray;
88  }
89 } // namespace nc::special
90 
91 #endif // #if defined(__cpp_lib_math_special_functions) || !defined(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:1308
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4402
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1616
iterator begin() noexcept
Definition: NdArrayCore.hpp:1258
Definition: airy_ai.hpp:39
auto riemann_zeta(const NdArray< dtype > &inArray)
Definition: riemann_zeta.hpp:77
auto riemann_zeta(dtype inValue)
Definition: riemann_zeta.hpp:55
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:775