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