NumCpp  2.4.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 #if defined(__cpp_lib_math_special_functions) || !defined(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_1.hpp"
40 #endif
41 
42 #include <type_traits>
43 
44 namespace nc
45 {
46  namespace special
47  {
48  //============================================================================
49  // Method Description:
58  template<typename dtype>
59  auto comp_ellint_1(dtype inK)
60  {
62 
63 #ifdef __cpp_lib_math_special_functions
64  return std::comp_ellint_1(inK);
65 #else
66  return boost::math::ellint_1(inK);
67 #endif
68  }
69 
70  //============================================================================
71  // Method Description:
80  template<typename dtype>
81  auto comp_ellint_1(const NdArray<dtype>& inArrayK)
82  {
83  NdArray<decltype(comp_ellint_1(dtype{ 0 }))> returnArray(inArrayK.shape());
84 
85  stl_algorithms::transform(inArrayK.cbegin(), inArrayK.cend(), returnArray.begin(),
86  [](dtype inK) -> auto
87  {
88  return comp_ellint_1(inK);
89  });
90 
91  return returnArray;
92  }
93  } // namespace special
94 } // namespace nc
95 
96 #endif // #if defined(__cpp_lib_math_special_functions) || !defined(NO_USE_BOOST)
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4356
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
nc::NdArray< dtype >
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
NdArray.hpp
nc::special::ellint_1
auto ellint_1(dtype1 inK, dtype2 inP)
Definition: ellint_1.hpp:61
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1487
nc
Definition: Coordinate.hpp:44
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1143
StlAlgorithms.hpp
nc::special::comp_ellint_1
auto comp_ellint_1(dtype inK)
Definition: comp_ellint_1.hpp:59
nc::special::comp_ellint_1
auto comp_ellint_1(const NdArray< dtype > &inArrayK)
Definition: comp_ellint_1.hpp:81
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1087