NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
ellint_3.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
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
43namespace nc::special
44{
45 //============================================================================
46 // Method Description:
56 template<typename dtype1, typename dtype2, typename dtype3>
57 auto ellint_3(dtype1 inK, dtype2 inV, dtype3 inP)
58 {
62
63#ifdef __cpp_lib_math_special_functions
64 return std::ellint_3(inK, inV, inP);
65#else
66 return boost::math::ellint_3(inK, inV, inP);
67#endif
68 }
69
70 //============================================================================
71 // Method Description:
81 template<typename dtype1, typename dtype2, typename dtype3>
82 auto ellint_3(const NdArray<dtype1>& inArrayK, const NdArray<dtype2>& inArrayV, const NdArray<dtype3>& inArrayP)
83 {
84 if (inArrayK.size() != inArrayV.size() || inArrayK.size() != inArrayP.size())
85 {
86 THROW_INVALID_ARGUMENT_ERROR("Shapes of inArrayK, inArrayV, and inArrayP must match.");
87 }
88
89 NdArray<decltype(ellint_3(dtype1{ 0 }, dtype2{ 0 }, dtype3{ 0 }))> returnArray(inArrayK.shape());
90
91 for (uint32 i = 0; i < inArrayK.size(); ++i)
92 {
93 returnArray[i] = ellint_3(inArrayK[i], inArrayV[i], inArrayP[i]);
94 }
95
96 return returnArray;
97 }
98} // namespace nc::special
99
100#endif // #if defined(__cpp_lib_math_special_functions) || !defined(NUMCPP_NO_USE_BOOST)
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#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
size_type size() const noexcept
Definition NdArrayCore.hpp:4600
const Shape & shape() const noexcept
Definition NdArrayCore.hpp:4587
Definition airy_ai.hpp:39
auto ellint_3(dtype1 inK, dtype2 inV, dtype3 inP)
Definition ellint_3.hpp:57
std::uint32_t uint32
Definition Types.hpp:40