NumCpp  2.8.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
comp_ellint_1.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_1.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_1(dtype inK)
59  {
61 
62 #ifdef __cpp_lib_math_special_functions
63  return std::comp_ellint_1(inK);
64 #else
65  return boost::math::ellint_1(inK);
66 #endif
67  }
68 
69  //============================================================================
70  // Method Description:
78  template<typename dtype>
79  auto comp_ellint_1(const NdArray<dtype>& inArrayK)
80  {
81  NdArray<decltype(comp_ellint_1(dtype{ 0 }))> returnArray(inArrayK.shape());
82 
84  inArrayK.cbegin(),
85  inArrayK.cend(),
86  returnArray.begin(),
87  [](dtype inK) -> auto{ return comp_ellint_1(inK); });
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:4276
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1529
iterator begin() noexcept
Definition: NdArrayCore.hpp:1171
auto comp_ellint_1(dtype inK)
Definition: comp_ellint_1.hpp:58
auto comp_ellint_1(const NdArray< dtype > &inArrayK)
Definition: comp_ellint_1.hpp:79
auto ellint_1(dtype1 inK, dtype2 inP)
Definition: ellint_1.hpp:60
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:784
Definition: Coordinate.hpp:45