NumCpp  2.12.1
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#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
44namespace nc::special
45{
46 //============================================================================
47 // Method Description:
55 template<typename dtype>
56 auto expint(dtype inX)
57 {
59
60#ifdef __cpp_lib_math_special_functions
61 return std::expint(inX);
62#else
63 return boost::math::expint(inX);
64#endif
65 }
66
67 //============================================================================
68 // Method Description:
76 template<typename dtype>
77 auto expint(const NdArray<dtype>& inArrayX)
78 {
79 NdArray<decltype(expint(dtype{ 0 }))> returnArray(inArrayX.shape());
80
82 inArrayX.cend(),
83 returnArray.begin(),
84 [](dtype inX) -> auto { return expint(inX); });
85
86 return returnArray;
87 }
88} // namespace nc::special
89
90#endif // #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1365
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4511
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1673
Definition: airy_ai.hpp:39
auto expint(dtype inX)
Definition: expint.hpp:56
auto expint(const NdArray< dtype > &inArrayX)
Definition: expint.hpp:77
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:775