NumCpp  2.7.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
expint.hpp
Go to the documentation of this file.
1 #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/expint.hpp"
40 #endif
41 
42 #include <type_traits>
43 
44 namespace nc
45 {
46  namespace special
47  {
48  //============================================================================
49  // Method Description:
57  template<typename dtype>
58  auto expint(dtype inX)
59  {
61 
62 #ifdef __cpp_lib_math_special_functions
63  return std::expint(inX);
64 #else
65  return boost::math::expint(inX);
66 #endif
67  }
68 
69  //============================================================================
70  // Method Description:
78  template<typename dtype>
79  auto expint(const NdArray<dtype>& inArrayX)
80  {
81  NdArray<decltype(expint(dtype{ 0 }))> returnArray(inArrayX.shape());
82 
83  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(),
84  [](dtype inX) -> auto
85  {
86  return expint(inX);
87  });
88 
89  return returnArray;
90  }
91  } // namespace special
92 } // namespace nc
93 
94 #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:1216
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4283
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1524
iterator begin() noexcept
Definition: NdArrayCore.hpp:1166
auto expint(dtype inX)
Definition: expint.hpp:58
auto expint(const NdArray< dtype > &inArrayX)
Definition: expint.hpp:79
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
Definition: Coordinate.hpp:45