30#ifndef REMORA_KERNELS_DEFAULT_RANDOM_HPP
31#define REMORA_KERNELS_DEFAULT_RANDOM_HPP
36namespace remora{
namespace bindings{
37template<
class V,
class Rng>
39 vector_expression<V, cpu_tag>& v,
41 typename V::value_type mean,
42 typename V::value_type variance
44 std::normal_distribution<typename V::value_type> dist(mean,std::sqrt(variance));
49template<
class M,
class Rng>
51 matrix_expression<M, cpu_tag>& m,
53 typename M::value_type mean,
54 typename M::value_type variance
56 std::normal_distribution<typename M::value_type> dist(mean,std::sqrt(variance));
57 std::size_t size = M::orientation::index_M(m().size1(),m().size2());
58 for(std::size_t i = 0; i != size; ++i){
59 auto end = m().major_end(i);
60 for(
auto pos = m().major_begin(i);pos != end; ++pos){
66template<
class V,
class Rng>
68 vector_expression<V, cpu_tag>& v,
70 typename V::value_type low,
71 typename V::value_type high
73 std::uniform_real_distribution<typename V::value_type> dist(low,high);
78template<
class M,
class Rng>
80 matrix_expression<M, cpu_tag>& m,
82 typename M::value_type low,
83 typename M::value_type high
85 std::uniform_real_distribution<typename M::value_type> dist(low,high);
86 std::size_t size = M::orientation::index_M(m().size1(),m().size2());
87 for(std::size_t i = 0; i != size; ++i){
88 auto end = m().major_end(i);
89 for(
auto pos = m().major_begin(i);pos != end; ++pos){
95template<
class V,
class Rng>
96void generate_discrete(
97 vector_expression<V, cpu_tag>& v,
102 std::uniform_int_distribution<int> dist(low,high);
107template<
class M,
class Rng>
108void generate_discrete(
109 matrix_expression<M, cpu_tag>& m,
114 std::uniform_int_distribution<int> dist(low,high);
115 std::size_t size = M::orientation::index_M(m().size1(),m().size2());
116 for(std::size_t i = 0; i != size; ++i){
117 auto end = m().major_end(i);
118 for(
auto pos = m().major_begin(i);pos != end; ++pos){