NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Special/bernoulli.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#ifndef NUMCPP_NO_USE_BOOST
31
32#include "boost/math/special_functions/bernoulli.hpp"
33
35#include "NumCpp/Core/Types.hpp"
36#include "NumCpp/NdArray.hpp"
37
38namespace nc::special
39{
40 //============================================================================
41 // Method Description:
48 inline double bernoilli(uint32 n)
49 {
50 if (n == 1)
51 {
52 return 0.5;
53 }
54 if (n % 2 != 0)
55 {
56 return 0.;
57 }
58
59 return boost::math::bernoulli_b2n<double>(n / 2);
60 }
61
62 //============================================================================
63 // Method Description:
71 {
73
75 inArray.cend(),
76 returnArray.begin(),
77 [](uint32 inValue) -> double { return bernoilli(inValue); });
78
79 return returnArray;
80 }
81} // namespace nc::special
82
83#endif // #ifndef NUMCPP_NO_USE_BOOST
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Definition airy_ai.hpp:39
double bernoilli(uint32 n)
Definition Special/bernoulli.hpp:48
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:775
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
std::uint32_t uint32
Definition Types.hpp:40