NumCpp  2.9.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 #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/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 
84  inArrayX.cbegin(),
85  inArrayX.cend(),
86  returnArray.begin(),
87  [](dtype inX) -> auto{ return expint(inX); });
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:1221
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4092
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1529
iterator begin() noexcept
Definition: NdArrayCore.hpp:1171
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:784
Definition: Coordinate.hpp:45