7 #ifndef JADE_RANDOMIZER_HPP__
8 #define JADE_RANDOMIZER_HPP__
10 #include "jade.matrix.hpp"
11 #include "jade.verification.hpp"
18 template <
typename TValue>
55 static const auto epsilon =
value_type(1.0e-6);
56 static const auto min =
value_type(0.0) + epsilon;
57 static const auto max =
value_type(1.0) - epsilon;
62 { return n >= min && n <= max; }));
68 for (
size_t j = 0; j < J; j++)
70 static std::normal_distribution<value_type>
73 for (
size_t k = 0; k < K; k++)
74 f(k, j) = std::min(std::max(
75 min, dist(_engine)), max);
90 static const auto epsilon =
value_type(1.0e-6);
91 static const auto min =
value_type(0.0) + epsilon;
92 static const auto max =
value_type(1.0) - epsilon;
97 { return n >= min && n <= max; }));
104 for (
size_t j = 0; j < J; j++)
106 static std::normal_distribution<value_type>
113 f(k, j) = std::min(std::max(
114 min, dist(_engine)), max);
130 static std::uniform_real_distribution<value_type>
131 distribution (K_0, K_1);
135 for (
size_t i = 0; i < I; i++)
138 for (
size_t k = 0; k < K; k++)
139 sum += (q(i, k) = distribution(_engine));
141 const auto factor = K_1 / sum;
142 for (
size_t k = 0; k < K; k++)
150 std::default_random_engine _engine;
154 #endif // JADE_RANDOMIZER_HPP__