NumCpp  2.13.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
exponential.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <algorithm>
31#include <random>
32
34#include "NumCpp/Core/Shape.hpp"
35#include "NumCpp/NdArray.hpp"
37
38namespace nc::random
39{
40 namespace detail
41 {
42 //============================================================================
43 // Method Description:
53 template<typename dtype, typename GeneratorType = std::mt19937>
55 {
57
58 std::exponential_distribution<dtype> dist(inScaleValue);
59 return dist(generator);
60 }
61
62 //============================================================================
63 // Method Description:
75 template<typename dtype, typename GeneratorType = std::mt19937>
77 {
79
81
82 std::exponential_distribution<dtype> dist(inScaleValue);
83
84 std::for_each(returnArray.begin(),
85 returnArray.end(),
86 [&generator, &dist](dtype& value) -> void { value = dist(generator); });
87
88 return returnArray;
89 }
90 } // namespace detail
91
92 //============================================================================
93 // Method Description:
102 template<typename dtype>
107
108 //============================================================================
109 // Method Description:
120 template<typename dtype>
125} // namespace nc::random
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
A Shape Class for NdArrays.
Definition Core/shape.hpp:41
dtype exponential(GeneratorType &generator, dtype inScaleValue=1)
Definition exponential.hpp:54
Definition Random/bernoulli.hpp:41
dtype exponential(dtype inScaleValue=1)
Definition exponential.hpp:103
std::mt19937_64 generator_
generator function
Definition generator.hpp:35
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59