NumCpp  2.7.0
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 #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/ellint_2.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 comp_ellint_2(dtype inK)
59  {
61 
62 #ifdef __cpp_lib_math_special_functions
63  return std::comp_ellint_2(inK);
64 #else
65  return boost::math::ellint_2(inK);
66 #endif
67  }
68 
69  //============================================================================
70  // Method Description:
78  template<typename dtype>
79  auto comp_ellint_2(const NdArray<dtype>& inArrayK)
80  {
81  NdArray<decltype(comp_ellint_2(dtype{ 0 }))> returnArray(inArrayK.shape());
82 
83  stl_algorithms::transform(inArrayK.cbegin(), inArrayK.cend(), returnArray.begin(),
84  [](dtype inK) -> auto
85  {
86  return comp_ellint_2(inK);
87  });
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:1216
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4283
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1524
iterator begin() noexcept
Definition: NdArrayCore.hpp:1166
auto ellint_2(dtype1 inK, dtype2 inP)
Definition: ellint_2.hpp:60
auto comp_ellint_2(const NdArray< dtype > &inArrayK)
Definition: comp_ellint_2.hpp:79
auto comp_ellint_2(dtype inK)
Definition: comp_ellint_2.hpp:58
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
Definition: Coordinate.hpp:45