NumCpp  2.6.2
A Templatized Header Only C++ Implementation of the Python NumPy Library
riemann_zeta.hpp
Go to the documentation of this file.
1 
28 #pragma once
29 
30 #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
31 
34 #include "NumCpp/NdArray.hpp"
35 
36 #ifdef __cpp_lib_math_special_functions
37 #include <cmath>
38 #else
39 #include "boost/math/special_functions/zeta.hpp"
40 #endif
41 
42 namespace nc
43 {
44  namespace special
45  {
46  //============================================================================
47  // Method Description:
58  template<typename dtype>
59  auto riemann_zeta(dtype inValue)
60  {
62 
63 #ifdef __cpp_lib_math_special_functions
64  return std::riemann_zeta(inValue);
65 #else
66  return boost::math::zeta(inValue);
67 #endif
68  }
69 
70  //============================================================================
71  // Method Description:
82  template<typename dtype>
83  auto riemann_zeta(const NdArray<dtype>& inArray)
84  {
85  NdArray<decltype(riemann_zeta(dtype{0}))> returnArray(inArray.shape());
86 
87  stl_algorithms::transform(inArray.cbegin(), inArray.cend(), returnArray.begin(),
88  [](dtype inValue) -> auto
89  {
90  return riemann_zeta(inValue);
91  });
92 
93  return returnArray;
94  }
95  } // namespace special
96 } // namespace nc
97 
98 #endif // #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1270
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4483
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1614
iterator begin() noexcept
Definition: NdArrayCore.hpp:1214
auto riemann_zeta(const NdArray< dtype > &inArray)
Definition: riemann_zeta.hpp:83
auto riemann_zeta(dtype inValue)
Definition: riemann_zeta.hpp:59
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
Definition: Coordinate.hpp:45