From Jason Turner

[rand.dist.samp]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdcl88r24/{from.md → to.md} +10 -11
tmp/tmpdcl88r24/{from.md → to.md} RENAMED
@@ -2,11 +2,11 @@
2
 
3
  ##### Class template `discrete_distribution` <a id="rand.dist.samp.discrete">[[rand.dist.samp.discrete]]</a>
4
 
5
  A `discrete_distribution` random number distribution produces random
6
  integers i, 0 ≤ i < n, distributed according to the discrete probability
7
- function $$P(i \,|\, p_0, \dotsc, p_{n-1}) = p_i \text{ .}$$
8
 
9
  Unless specified otherwise, the distribution parameters are calculated
10
  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:
@@ -81,11 +81,11 @@ is `true`.
81
  requirements [[input.iterators]]. If `firstW == lastW`, let n = 1 and
82
  w₀ = 1. Otherwise, [`firstW`, `lastW`) forms a sequence w of length
83
  n > 0.
84
 
85
  *Effects:* Constructs a `discrete_distribution` object with
86
- probabilities given by the formula above.
87
 
88
  ``` cpp
89
  discrete_distribution(initializer_list<double> wl);
90
  ```
91
 
@@ -120,12 +120,11 @@ k = 0, …, n - 1.
120
  ##### Class template `piecewise_constant_distribution` <a id="rand.dist.samp.pconst">[[rand.dist.samp.pconst]]</a>
121
 
122
  A `piecewise_constant_distribution` random number distribution produces
123
  random numbers x, b₀ ≤ x < bₙ, uniformly distributed over each
124
  subinterval [ bᵢ, bᵢ₊₁ ) according to the probability density function
125
- $$p(x \,|\, b_0, \dotsc, b_n, \; \rho_0, \dotsc, \rho_{n-1}) = \rho_i
126
- \text{ , for $b_i \le x < b_{i+1}$.}$$
127
 
128
  The n + 1 distribution parameters bᵢ, also known as this distribution’s
129
  *interval boundaries* , shall satisfy the relation $b_i < b_{i + 1}$ for
130
  i = 0, …, n - 1. Unless specified otherwise, the remaining n
131
  distribution parameters are calculated as:
@@ -267,15 +266,11 @@ k = 0, …, n - 1.
267
 
268
  ##### Class template `piecewise_linear_distribution` <a id="rand.dist.samp.plinear">[[rand.dist.samp.plinear]]</a>
269
 
270
  A `piecewise_linear_distribution` random number distribution produces
271
  random numbers x, b₀ ≤ x < bₙ, distributed over each subinterval
272
- [bᵢ, bᵢ₊₁) according to the probability density function
273
- $$p(x \,|\, b_0, \dotsc, b_n, \; \rho_0, \dotsc, \rho_n)
274
- = \rho_{i} \cdot {\frac{b_{i+1} - x}{b_{i+1} - b_i}}
275
- + \rho_{i+1} \cdot {\frac{x - b_i}{b_{i+1} - b_i}}
276
- \text{ , for $b_i \le x < b_{i+1}$.}$$
277
 
278
  The n + 1 distribution parameters bᵢ, also known as this distribution’s
279
  *interval boundaries* , shall satisfy the relation bᵢ < bᵢ₊₁ for
280
  i = 0, …, n - 1. Unless specified otherwise, the remaining n + 1
281
  distribution parameters are calculated as ρₖ = {wₖ / S} for k = 0, …, n,
@@ -345,12 +340,16 @@ n = 1, ρ₀ = ρ₁ = 1, b₀ = 0, and b₁ = 1.
345
  template<class InputIteratorB, class InputIteratorW>
346
  piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB,
347
  InputIteratorW firstW);
348
  ```
349
 
350
- *Mandates:* `is_invocable_r_v<double, UnaryOperation&, double>` is
351
- `true`.
 
 
 
 
352
 
353
  *Preconditions:* `InputIteratorB` and `InputIteratorW` each meet the
354
  *Cpp17InputIterator* requirements [[input.iterators]]. If
355
  `firstB == lastB` or `++firstB == lastB`, let n = 1, ρ₀ = ρ₁ = 1,
356
  b₀ = 0, and b₁ = 1. Otherwise, [`firstB`, `lastB`) forms a sequence b of
 
2
 
3
  ##### Class template `discrete_distribution` <a id="rand.dist.samp.discrete">[[rand.dist.samp.discrete]]</a>
4
 
5
  A `discrete_distribution` random number distribution produces random
6
  integers i, 0 ≤ i < n, distributed according to the discrete probability
7
+ function in .
8
 
9
  Unless specified otherwise, the distribution parameters are calculated
10
  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:
 
81
  requirements [[input.iterators]]. If `firstW == lastW`, let n = 1 and
82
  w₀ = 1. Otherwise, [`firstW`, `lastW`) forms a sequence w of length
83
  n > 0.
84
 
85
  *Effects:* Constructs a `discrete_distribution` object with
86
+ probabilities given by the .
87
 
88
  ``` cpp
89
  discrete_distribution(initializer_list<double> wl);
90
  ```
91
 
 
120
  ##### Class template `piecewise_constant_distribution` <a id="rand.dist.samp.pconst">[[rand.dist.samp.pconst]]</a>
121
 
122
  A `piecewise_constant_distribution` random number distribution produces
123
  random numbers x, b₀ ≤ x < bₙ, uniformly distributed over each
124
  subinterval [ bᵢ, bᵢ₊₁ ) according to the probability density function
125
+ in .
 
126
 
127
  The n + 1 distribution parameters bᵢ, also known as this distribution’s
128
  *interval boundaries* , shall satisfy the relation $b_i < b_{i + 1}$ for
129
  i = 0, …, n - 1. Unless specified otherwise, the remaining n
130
  distribution parameters are calculated as:
 
266
 
267
  ##### Class template `piecewise_linear_distribution` <a id="rand.dist.samp.plinear">[[rand.dist.samp.plinear]]</a>
268
 
269
  A `piecewise_linear_distribution` random number distribution produces
270
  random numbers x, b₀ ≤ x < bₙ, distributed over each subinterval
271
+ [bᵢ, bᵢ₊₁) according to the probability density function in .
 
 
 
 
272
 
273
  The n + 1 distribution parameters bᵢ, also known as this distribution’s
274
  *interval boundaries* , shall satisfy the relation bᵢ < bᵢ₊₁ for
275
  i = 0, …, n - 1. Unless specified otherwise, the remaining n + 1
276
  distribution parameters are calculated as ρₖ = {wₖ / S} for k = 0, …, n,
 
340
  template<class InputIteratorB, class InputIteratorW>
341
  piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB,
342
  InputIteratorW firstW);
343
  ```
344
 
345
+ *Mandates:* Both of
346
+
347
+ - `is_convertible_v<iterator_traits<InputIteratorB>::value_type, double>`
348
+ - `is_convertible_v<iterator_traits<InputIteratorW>::value_type, double>`
349
+
350
+ are `true`.
351
 
352
  *Preconditions:* `InputIteratorB` and `InputIteratorW` each meet the
353
  *Cpp17InputIterator* requirements [[input.iterators]]. If
354
  `firstB == lastB` or `++firstB == lastB`, let n = 1, ρ₀ = ρ₁ = 1,
355
  b₀ = 0, and b₁ = 1. Otherwise, [`firstB`, `lastB`) forms a sequence b of