NumCpp  2.3.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
laguerre.hpp
Go to the documentation of this file.
1 #pragma once
29 
32 #include "NumCpp/NdArray.hpp"
33 
34 #include "boost/math/special_functions/laguerre.hpp"
35 
36 namespace nc
37 {
38  namespace polynomial
39  {
40  //============================================================================
41  // Method Description:
49  template<typename dtype>
50  double laguerre(uint32 n, dtype x)
51  {
53 
54  return boost::math::laguerre(n, static_cast<double>(x));
55  }
56 
57  //============================================================================
58  // Method Description:
67  template<typename dtype>
68  double laguerre(uint32 n, uint32 m, dtype x)
69  {
71 
72  return boost::math::laguerre(m, n, static_cast<double>(x));
73  }
74 
75  //============================================================================
76  // Method Description:
84  template<typename dtype>
86  {
87  NdArray<double> returnArray(inArrayX.shape());
88 
89  const auto function = [n](dtype x) -> double
90  {
91  return laguerre(n, x);
92  };
93 
94  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(), function);
95 
96  return returnArray;
97  }
98 
99  //============================================================================
100  // Method Description:
109  template<typename dtype>
111  {
112  NdArray<double> returnArray(inArrayX.shape());
113 
114  const auto function = [n, m](dtype x) -> double
115  {
116  return laguerre(n, m, x);
117  };
118 
119  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(), function);
120 
121  return returnArray;
122  }
123  } // namespace polynomial
124 } // 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::polynomial::laguerre
double laguerre(uint32 n, dtype x)
Definition: laguerre.hpp:50
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1490
nc
Definition: Coordinate.hpp:44
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::laguerre
NdArray< double > laguerre(uint32 n, uint32 m, const NdArray< dtype > &inArrayX)
Definition: laguerre.hpp:110