tmp/tmp_i53mloi/{from.md → to.md}
RENAMED
|
@@ -14,10 +14,11 @@ $$\rho_k = \frac{w_k}{S \cdot (b_{k+1}-b_k)} \text{ for } k = 0, \dotsc, n - 1 \
|
|
| 14 |
in which the values wₖ, commonly known as the *weights* , shall be
|
| 15 |
non-negative, non-NaN, and non-infinity. Moreover, the following
|
| 16 |
relation shall hold: 0 < S = w₀ + … + wₙ₋₁.
|
| 17 |
|
| 18 |
``` cpp
|
|
|
|
| 19 |
template<class RealType = double>
|
| 20 |
class piecewise_constant_distribution {
|
| 21 |
public:
|
| 22 |
// types
|
| 23 |
using result_type = RealType;
|
|
@@ -34,10 +35,14 @@ template<class RealType = double>
|
|
| 34 |
piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax,
|
| 35 |
UnaryOperation fw);
|
| 36 |
explicit piecewise_constant_distribution(const param_type& parm);
|
| 37 |
void reset();
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
// generating functions
|
| 40 |
template<class URBG>
|
| 41 |
result_type operator()(URBG& g);
|
| 42 |
template<class URBG>
|
| 43 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -47,11 +52,20 @@ template<class RealType = double>
|
|
| 47 |
vector<result_type> densities() const;
|
| 48 |
param_type param() const;
|
| 49 |
void param(const param_type& parm);
|
| 50 |
result_type min() const;
|
| 51 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
};
|
|
|
|
| 53 |
```
|
| 54 |
|
| 55 |
``` cpp
|
| 56 |
piecewise_constant_distribution();
|
| 57 |
```
|
|
|
|
| 14 |
in which the values wₖ, commonly known as the *weights* , shall be
|
| 15 |
non-negative, non-NaN, and non-infinity. Moreover, the following
|
| 16 |
relation shall hold: 0 < S = w₀ + … + wₙ₋₁.
|
| 17 |
|
| 18 |
``` cpp
|
| 19 |
+
namespace std {
|
| 20 |
template<class RealType = double>
|
| 21 |
class piecewise_constant_distribution {
|
| 22 |
public:
|
| 23 |
// types
|
| 24 |
using result_type = RealType;
|
|
|
|
| 35 |
piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax,
|
| 36 |
UnaryOperation fw);
|
| 37 |
explicit piecewise_constant_distribution(const param_type& parm);
|
| 38 |
void reset();
|
| 39 |
|
| 40 |
+
// equality operators
|
| 41 |
+
friend bool operator==(const piecewise_constant_distribution& x,
|
| 42 |
+
const piecewise_constant_distribution& y);
|
| 43 |
+
|
| 44 |
// generating functions
|
| 45 |
template<class URBG>
|
| 46 |
result_type operator()(URBG& g);
|
| 47 |
template<class URBG>
|
| 48 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 52 |
vector<result_type> densities() const;
|
| 53 |
param_type param() const;
|
| 54 |
void param(const param_type& parm);
|
| 55 |
result_type min() const;
|
| 56 |
result_type max() const;
|
| 57 |
+
|
| 58 |
+
// inserters and extractors
|
| 59 |
+
template<class charT, class traits>
|
| 60 |
+
friend basic_ostream<charT, traits>&
|
| 61 |
+
operator<<(basic_ostream<charT, traits>& os, const piecewise_constant_distribution& x);
|
| 62 |
+
template<class charT, class traits>
|
| 63 |
+
friend basic_istream<charT, traits>&
|
| 64 |
+
operator>>(basic_istream<charT, traits>& is, piecewise_constant_distribution& x);
|
| 65 |
};
|
| 66 |
+
}
|
| 67 |
```
|
| 68 |
|
| 69 |
``` cpp
|
| 70 |
piecewise_constant_distribution();
|
| 71 |
```
|