NumCpp  2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
chebyshev_u.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #ifndef NO_USE_BOOST
31 
34 #include "NumCpp/NdArray.hpp"
35 
36 #include "boost/math/special_functions/chebyshev.hpp"
37 
38 namespace nc
39 {
40  namespace polynomial
41  {
42  //============================================================================
43  // Method Description:
52  template<typename dtype>
53  double chebyshev_u(uint32 n, dtype x)
54  {
56 
57  return boost::math::chebyshev_u(n, static_cast<double>(x));
58  }
59 
60  //============================================================================
61  // Method Description:
70  template<typename dtype>
72  {
73  NdArray<double> returnArray(inArrayX.shape());
74 
75  const auto function = [n](dtype x) -> double
76  {
77  return chebyshev_u(n, x);
78  };
79 
80  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(), function);
81 
82  return returnArray;
83  }
84  } // namespace polynomial
85 } // namespace nc
86 
87 #endif // #ifndef 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::polynomial::chebyshev_u
double chebyshev_u(uint32 n, dtype x)
Definition: chebyshev_u.hpp:53
nc::NdArray< double >
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:40
NdArray.hpp
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::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1087
nc::polynomial::chebyshev_u
NdArray< double > chebyshev_u(uint32 n, const NdArray< dtype > &inArrayX)
Definition: chebyshev_u.hpp:71