NumCpp  2.10.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
comp_ellint_2.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/ellint_2.hpp"
40 #endif
41 
42 #include <type_traits>
43 
44 namespace nc::special
45 {
46  //============================================================================
47  // Method Description:
55  template<typename dtype>
56  auto comp_ellint_2(dtype inK)
57  {
59 
60 #ifdef __cpp_lib_math_special_functions
61  return std::comp_ellint_2(inK);
62 #else
63  return boost::math::ellint_2(inK);
64 #endif
65  }
66 
67  //============================================================================
68  // Method Description:
76  template<typename dtype>
77  auto comp_ellint_2(const NdArray<dtype>& inArrayK)
78  {
79  NdArray<decltype(comp_ellint_2(dtype{ 0 }))> returnArray(inArrayK.shape());
80 
82  inArrayK.cbegin(),
83  inArrayK.cend(),
84  returnArray.begin(),
85  [](dtype inK) -> auto{ return comp_ellint_2(inK); });
86 
87  return returnArray;
88  }
89 } // namespace nc::special
90 
91 #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:138
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1308
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4402
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1616
iterator begin() noexcept
Definition: NdArrayCore.hpp:1258
Definition: airy_ai.hpp:39
auto ellint_2(dtype1 inK, dtype2 inP)
Definition: ellint_2.hpp:58
auto comp_ellint_2(const NdArray< dtype > &inArrayK)
Definition: comp_ellint_2.hpp:77
auto comp_ellint_2(dtype inK)
Definition: comp_ellint_2.hpp:56
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:775