NumCpp  1.0
A C++ implementation of the Python Numpy library
laguerre.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/NdArray.hpp"
34 
35 #include "boost/math/special_functions/laguerre.hpp"
36 
37 namespace nc
38 {
39  namespace polynomial
40  {
41  //============================================================================
42  // Method Description:
50  template<typename dtype>
51  double laguerre(uint32 n, dtype x)
52  {
54 
55  return boost::math::laguerre(n, static_cast<double>(x));
56  }
57 
58  //============================================================================
59  // Method Description:
68  template<typename dtype>
69  double laguerre(uint32 n, uint32 m, dtype x)
70  {
72 
73  return boost::math::laguerre(m, n, static_cast<double>(x));
74  }
75 
76  //============================================================================
77  // Method Description:
85  template<typename dtype>
87  {
88  NdArray<double> returnArray(inArrayX.shape());
89 
90  const auto function = [n](dtype x) -> double
91  {
92  return laguerre(n, x);
93  };
94 
95  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(), function);
96 
97  return returnArray;
98  }
99 
100  //============================================================================
101  // Method Description:
110  template<typename dtype>
112  {
113  NdArray<double> returnArray(inArrayX.shape());
114 
115  const auto function = [n, m](dtype x) -> double
116  {
117  return laguerre(n, m, x);
118  };
119 
120  stl_algorithms::transform(inArrayX.cbegin(), inArrayX.cend(), returnArray.begin(), function);
121 
122  return returnArray;
123  }
124  }
125 }
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4296
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:38
nc::NdArray< double >
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:41
NdArray.hpp
nc::polynomial::laguerre
double laguerre(uint32 n, dtype x)
Definition: laguerre.hpp:51
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1491
nc
Definition: Coordinate.hpp:45
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction) noexcept
Definition: StlAlgorithms.hpp:703
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1147
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1091
nc::polynomial::laguerre
NdArray< double > laguerre(uint32 n, uint32 m, const NdArray< dtype > &inArrayX)
Definition: laguerre.hpp:111