tmp/tmp6c6tjo38/{from.md → to.md}
RENAMED
|
@@ -11,10 +11,11 @@ as: pₖ = {wₖ / S} for k = 0, …, n - 1, in which the values wₖ, commonly
|
|
| 11 |
known as the *weights* , shall be non-negative, non-NaN, and
|
| 12 |
non-infinity. Moreover, the following relation shall hold:
|
| 13 |
$0 < S = w_0 + \dotsb + w_{n - 1}$.
|
| 14 |
|
| 15 |
``` cpp
|
|
|
|
| 16 |
template<class IntType = int>
|
| 17 |
class discrete_distribution {
|
| 18 |
public:
|
| 19 |
// types
|
| 20 |
using result_type = IntType;
|
|
@@ -28,10 +29,13 @@ template<class IntType = int>
|
|
| 28 |
template<class UnaryOperation>
|
| 29 |
discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
|
| 30 |
explicit discrete_distribution(const param_type& parm);
|
| 31 |
void reset();
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
// generating functions
|
| 34 |
template<class URBG>
|
| 35 |
result_type operator()(URBG& g);
|
| 36 |
template<class URBG>
|
| 37 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -40,11 +44,20 @@ template<class IntType = int>
|
|
| 40 |
vector<double> probabilities() const;
|
| 41 |
param_type param() const;
|
| 42 |
void param(const param_type& parm);
|
| 43 |
result_type min() const;
|
| 44 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
};
|
|
|
|
| 46 |
```
|
| 47 |
|
| 48 |
``` cpp
|
| 49 |
discrete_distribution();
|
| 50 |
```
|
|
@@ -120,10 +133,11 @@ $$\rho_k = \frac{w_k}{S \cdot (b_{k+1}-b_k)} \text{ for } k = 0, \dotsc, n - 1 \
|
|
| 120 |
in which the values wₖ, commonly known as the *weights* , shall be
|
| 121 |
non-negative, non-NaN, and non-infinity. Moreover, the following
|
| 122 |
relation shall hold: 0 < S = w₀ + … + wₙ₋₁.
|
| 123 |
|
| 124 |
``` cpp
|
|
|
|
| 125 |
template<class RealType = double>
|
| 126 |
class piecewise_constant_distribution {
|
| 127 |
public:
|
| 128 |
// types
|
| 129 |
using result_type = RealType;
|
|
@@ -140,10 +154,14 @@ template<class RealType = double>
|
|
| 140 |
piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax,
|
| 141 |
UnaryOperation fw);
|
| 142 |
explicit piecewise_constant_distribution(const param_type& parm);
|
| 143 |
void reset();
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
// generating functions
|
| 146 |
template<class URBG>
|
| 147 |
result_type operator()(URBG& g);
|
| 148 |
template<class URBG>
|
| 149 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -153,11 +171,20 @@ template<class RealType = double>
|
|
| 153 |
vector<result_type> densities() const;
|
| 154 |
param_type param() const;
|
| 155 |
void param(const param_type& parm);
|
| 156 |
result_type min() const;
|
| 157 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
};
|
|
|
|
| 159 |
```
|
| 160 |
|
| 161 |
``` cpp
|
| 162 |
piecewise_constant_distribution();
|
| 163 |
```
|
|
@@ -256,10 +283,11 @@ in which the values wₖ, commonly known as the *weights at boundaries* ,
|
|
| 256 |
shall be non-negative, non-NaN, and non-infinity. Moreover, the
|
| 257 |
following relation shall hold:
|
| 258 |
$$0 < S = \frac{1}{2} \cdot \sum_{k=0}^{n-1} (w_k + w_{k+1}) \cdot (b_{k+1} - b_k) \text{ .}$$
|
| 259 |
|
| 260 |
``` cpp
|
|
|
|
| 261 |
template<class RealType = double>
|
| 262 |
class piecewise_linear_distribution {
|
| 263 |
public:
|
| 264 |
// types
|
| 265 |
using result_type = RealType;
|
|
@@ -275,10 +303,14 @@ template<class RealType = double>
|
|
| 275 |
template<class UnaryOperation>
|
| 276 |
piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
|
| 277 |
explicit piecewise_linear_distribution(const param_type& parm);
|
| 278 |
void reset();
|
| 279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
// generating functions
|
| 281 |
template<class URBG>
|
| 282 |
result_type operator()(URBG& g);
|
| 283 |
template<class URBG>
|
| 284 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -288,11 +320,20 @@ template<class RealType = double>
|
|
| 288 |
vector<result_type> densities() const;
|
| 289 |
param_type param() const;
|
| 290 |
void param(const param_type& parm);
|
| 291 |
result_type min() const;
|
| 292 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
};
|
|
|
|
| 294 |
```
|
| 295 |
|
| 296 |
``` cpp
|
| 297 |
piecewise_linear_distribution();
|
| 298 |
```
|
|
|
|
| 11 |
known as the *weights* , shall be non-negative, non-NaN, and
|
| 12 |
non-infinity. Moreover, the following relation shall hold:
|
| 13 |
$0 < S = w_0 + \dotsb + w_{n - 1}$.
|
| 14 |
|
| 15 |
``` cpp
|
| 16 |
+
namespace std {
|
| 17 |
template<class IntType = int>
|
| 18 |
class discrete_distribution {
|
| 19 |
public:
|
| 20 |
// types
|
| 21 |
using result_type = IntType;
|
|
|
|
| 29 |
template<class UnaryOperation>
|
| 30 |
discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
|
| 31 |
explicit discrete_distribution(const param_type& parm);
|
| 32 |
void reset();
|
| 33 |
|
| 34 |
+
// equality operators
|
| 35 |
+
friend bool operator==(const discrete_distribution& x, const discrete_distribution& y);
|
| 36 |
+
|
| 37 |
// generating functions
|
| 38 |
template<class URBG>
|
| 39 |
result_type operator()(URBG& g);
|
| 40 |
template<class URBG>
|
| 41 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 44 |
vector<double> probabilities() const;
|
| 45 |
param_type param() const;
|
| 46 |
void param(const param_type& parm);
|
| 47 |
result_type min() const;
|
| 48 |
result_type max() const;
|
| 49 |
+
|
| 50 |
+
// inserters and extractors
|
| 51 |
+
template<class charT, class traits>
|
| 52 |
+
friend basic_ostream<charT, traits>&
|
| 53 |
+
operator<<(basic_ostream<charT, traits>& os, const discrete_distribution& x);
|
| 54 |
+
template<class charT, class traits>
|
| 55 |
+
friend basic_istream<charT, traits>&
|
| 56 |
+
operator>>(basic_istream<charT, traits>& is, discrete_distribution& x);
|
| 57 |
};
|
| 58 |
+
}
|
| 59 |
```
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
discrete_distribution();
|
| 63 |
```
|
|
|
|
| 133 |
in which the values wₖ, commonly known as the *weights* , shall be
|
| 134 |
non-negative, non-NaN, and non-infinity. Moreover, the following
|
| 135 |
relation shall hold: 0 < S = w₀ + … + wₙ₋₁.
|
| 136 |
|
| 137 |
``` cpp
|
| 138 |
+
namespace std {
|
| 139 |
template<class RealType = double>
|
| 140 |
class piecewise_constant_distribution {
|
| 141 |
public:
|
| 142 |
// types
|
| 143 |
using result_type = RealType;
|
|
|
|
| 154 |
piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax,
|
| 155 |
UnaryOperation fw);
|
| 156 |
explicit piecewise_constant_distribution(const param_type& parm);
|
| 157 |
void reset();
|
| 158 |
|
| 159 |
+
// equality operators
|
| 160 |
+
friend bool operator==(const piecewise_constant_distribution& x,
|
| 161 |
+
const piecewise_constant_distribution& y);
|
| 162 |
+
|
| 163 |
// generating functions
|
| 164 |
template<class URBG>
|
| 165 |
result_type operator()(URBG& g);
|
| 166 |
template<class URBG>
|
| 167 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 171 |
vector<result_type> densities() const;
|
| 172 |
param_type param() const;
|
| 173 |
void param(const param_type& parm);
|
| 174 |
result_type min() const;
|
| 175 |
result_type max() const;
|
| 176 |
+
|
| 177 |
+
// inserters and extractors
|
| 178 |
+
template<class charT, class traits>
|
| 179 |
+
friend basic_ostream<charT, traits>&
|
| 180 |
+
operator<<(basic_ostream<charT, traits>& os, const piecewise_constant_distribution& x);
|
| 181 |
+
template<class charT, class traits>
|
| 182 |
+
friend basic_istream<charT, traits>&
|
| 183 |
+
operator>>(basic_istream<charT, traits>& is, piecewise_constant_distribution& x);
|
| 184 |
};
|
| 185 |
+
}
|
| 186 |
```
|
| 187 |
|
| 188 |
``` cpp
|
| 189 |
piecewise_constant_distribution();
|
| 190 |
```
|
|
|
|
| 283 |
shall be non-negative, non-NaN, and non-infinity. Moreover, the
|
| 284 |
following relation shall hold:
|
| 285 |
$$0 < S = \frac{1}{2} \cdot \sum_{k=0}^{n-1} (w_k + w_{k+1}) \cdot (b_{k+1} - b_k) \text{ .}$$
|
| 286 |
|
| 287 |
``` cpp
|
| 288 |
+
namespace std {
|
| 289 |
template<class RealType = double>
|
| 290 |
class piecewise_linear_distribution {
|
| 291 |
public:
|
| 292 |
// types
|
| 293 |
using result_type = RealType;
|
|
|
|
| 303 |
template<class UnaryOperation>
|
| 304 |
piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
|
| 305 |
explicit piecewise_linear_distribution(const param_type& parm);
|
| 306 |
void reset();
|
| 307 |
|
| 308 |
+
// equality operators
|
| 309 |
+
friend bool operator==(const piecewise_linear_distribution& x,
|
| 310 |
+
const piecewise_linear_distribution& y);
|
| 311 |
+
|
| 312 |
// generating functions
|
| 313 |
template<class URBG>
|
| 314 |
result_type operator()(URBG& g);
|
| 315 |
template<class URBG>
|
| 316 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 320 |
vector<result_type> densities() const;
|
| 321 |
param_type param() const;
|
| 322 |
void param(const param_type& parm);
|
| 323 |
result_type min() const;
|
| 324 |
result_type max() const;
|
| 325 |
+
|
| 326 |
+
// inserters and extractors
|
| 327 |
+
template<class charT, class traits>
|
| 328 |
+
friend basic_ostream<charT, traits>&
|
| 329 |
+
operator<<(basic_ostream<charT, traits>& os, const piecewise_linear_distribution& x);
|
| 330 |
+
template<class charT, class traits>
|
| 331 |
+
friend basic_istream<charT, traits>&
|
| 332 |
+
operator>>(basic_istream<charT, traits>& is, piecewise_linear_distribution& x);
|
| 333 |
};
|
| 334 |
+
}
|
| 335 |
```
|
| 336 |
|
| 337 |
``` cpp
|
| 338 |
piecewise_linear_distribution();
|
| 339 |
```
|