NumCpp  2.3.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
chebyshev_t.hpp
Go to the documentation of this file.
1 #pragma once
29 
32 #include "NumCpp/NdArray.hpp"
33 
34 #include "boost/math/special_functions/chebyshev.hpp"
35 
36 namespace nc
37 {
38  namespace polynomial
39  {
40  //============================================================================
41  // Method Description:
49  template<typename dtype>
50  double chebyshev_t(uint32 n, dtype x)
51  {
53 
54  return boost::math::chebyshev_t(n, static_cast<double>(x));
55  }
56 
57  //============================================================================
58  // Method Description:
66  template<typename dtype>
68  {
69  NdArray<double> returnArray(inArrayX.shape());
70 
71  const auto function = [n](dtype x) -> double
72  {
73  return chebyshev_t(n, x);
74  };
75 
76  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(), function);
77 
78  return returnArray;
79  }
80  } // namespace polynomial
81 } // namespace nc
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4311
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
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:1490
nc
Definition: Coordinate.hpp:44
nc::polynomial::chebyshev_t
double chebyshev_t(uint32 n, dtype x)
Definition: chebyshev_t.hpp:50
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1146
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1090
nc::polynomial::chebyshev_t
NdArray< double > chebyshev_t(uint32 n, const NdArray< dtype > &inArrayX)
Definition: chebyshev_t.hpp:67