NumCpp  1.0
A C++ implementation of the Python Numpy library
Special/beta.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include "NumCpp/NdArray.hpp"
34 
35 #include "boost/math/special_functions/beta.hpp"
36 
37 #include <type_traits>
38 
39 namespace nc
40 {
41  namespace special
42  {
43  //============================================================================
44  // Method Description:
52  template<typename dtype1, typename dtype2>
53  auto beta(dtype1 a, dtype2 b)
54  {
57 
58  return boost::math::beta(a, b);
59  }
60 
61  //============================================================================
62  // Method Description:
70  template<typename dtype1, typename dtype2>
71  auto beta(const NdArray<dtype1>& inArrayA, const NdArray<dtype2>& inArrayB)
72  {
73  NdArray<decltype(bessel_in(dtype1{ 0 }, dtype2{ 0 }))> returnArray(inArrayB.shape());
74 
75  stl_algorithms::transform(inArrayA.cbegin(), inArrayA.cend(), inArrayB.cbegin(), returnArray.begin(),
76  [](dtype1 a, dtype2 b) -> auto
77  {
78  return beta(a, b);
79  });
80 
81  return returnArray;
82  }
83  }
84 }
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::special::beta
auto beta(const NdArray< dtype1 > &inArrayA, const NdArray< dtype2 > &inArrayB)
Definition: Special/beta.hpp:71
nc::special::bessel_in
auto bessel_in(dtype1 inV, dtype2 inX)
Definition: bessel_in.hpp:53
nc::NdArray
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:75
NdArray.hpp
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::special::beta
auto beta(dtype1 a, dtype2 b)
Definition: Special/beta.hpp:53