NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
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
42namespace nc::special
43{
44 //============================================================================
45 // Method Description:
53 template<typename dtype>
54 auto expint(dtype inX)
55 {
57
58#ifdef __cpp_lib_math_special_functions
59 return std::expint(inX);
60#else
61 return boost::math::expint(inX);
62#endif
63 }
64
65 //============================================================================
66 // Method Description:
74 template<typename dtype>
75 auto expint(const NdArray<dtype>& inArrayX)
76 {
77 NdArray<decltype(expint(dtype{ 0 }))> returnArray(inArrayX.shape());
78
80 inArrayX.cend(),
81 returnArray.begin(),
82 [](dtype inX) -> auto { return expint(inX); });
83
84 return returnArray;
85 }
86} // namespace nc::special
87
88#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:135
const_iterator cbegin() const noexcept
Definition NdArrayCore.hpp:1361
const Shape & shape() const noexcept
Definition NdArrayCore.hpp:4587
const_iterator cend() const noexcept
Definition NdArrayCore.hpp:1669
Definition airy_ai.hpp:39
auto expint(dtype inX)
Definition expint.hpp:54
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:776