NumCpp  2.4.0
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 #if defined(__cpp_lib_math_special_functions) || !defined(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(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::special::riemann_zeta
auto riemann_zeta(dtype inValue)
Definition: riemann_zeta.hpp:59
nc::NdArray< dtype >
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
NdArray.hpp
nc::special::riemann_zeta
auto riemann_zeta(const NdArray< dtype > &inArray)
Definition: riemann_zeta.hpp:83
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1487
nc
Definition: Coordinate.hpp:44
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1143
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1087