NumCpp  2.8.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
ellint_3.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 
37 #include "NumCpp/NdArray.hpp"
38 
39 #ifndef __cpp_lib_math_special_functions
40 #include "boost/math/special_functions/ellint_3.hpp"
41 #endif
42 
43 #include <type_traits>
44 
45 namespace nc
46 {
47  namespace special
48  {
49  //============================================================================
50  // Method Description:
60  template<typename dtype1, typename dtype2, typename dtype3>
61  auto ellint_3(dtype1 inK, dtype2 inV, dtype3 inP)
62  {
66 
67 #ifdef __cpp_lib_math_special_functions
68  return std::ellint_3(inK, inV, inP);
69 #else
70  return boost::math::ellint_3(inK, inV, inP);
71 #endif
72  }
73 
74  //============================================================================
75  // Method Description:
85  template<typename dtype1, typename dtype2, typename dtype3>
86  auto ellint_3(const NdArray<dtype1>& inArrayK, const NdArray<dtype2>& inArrayV, const NdArray<dtype3>& inArrayP)
87  {
88  if (inArrayK.size() != inArrayV.size() || inArrayK.size() != inArrayP.size())
89  {
90  THROW_INVALID_ARGUMENT_ERROR("Shapes of inArrayK, inArrayV, and inArrayP must match.");
91  }
92 
93  NdArray<decltype(ellint_3(dtype1{ 0 }, dtype2{ 0 }, dtype3{ 0 }))> returnArray(inArrayK.shape());
94 
95  for (uint32 i = 0; i < inArrayK.size(); ++i)
96  {
97  returnArray[i] = ellint_3(inArrayK[i], inArrayV[i], inArrayP[i]);
98  }
99 
100  return returnArray;
101  }
102  } // namespace special
103 } // namespace nc
104 
105 #endif // #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:36
#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
size_type size() const noexcept
Definition: NdArrayCore.hpp:4289
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4276
auto ellint_3(dtype1 inK, dtype2 inV, dtype3 inP)
Definition: ellint_3.hpp:61
auto ellint_3(const NdArray< dtype1 > &inArrayK, const NdArray< dtype2 > &inArrayV, const NdArray< dtype3 > &inArrayP)
Definition: ellint_3.hpp:86
Definition: Coordinate.hpp:45
std::uint32_t uint32
Definition: Types.hpp:40