tmp/tmprp9w5bt9/{from.md → to.md}
RENAMED
|
@@ -7,10 +7,11 @@ $$P(i\,|\,k,p) = \binom{k+i-1}{i} \cdot p^k \cdot (1-p)^i \text{ .}$$
|
|
| 7 |
|
| 8 |
[*Note 1*: This implies that P(i | k,p) is undefined when
|
| 9 |
`p == 1`. — *end note*]
|
| 10 |
|
| 11 |
``` cpp
|
|
|
|
| 12 |
template<class IntType = int>
|
| 13 |
class negative_binomial_distribution {
|
| 14 |
public:
|
| 15 |
// types
|
| 16 |
using result_type = IntType;
|
|
@@ -20,10 +21,14 @@ template<class IntType = int>
|
|
| 20 |
negative_binomial_distribution() : negative_binomial_distribution(1) {}
|
| 21 |
explicit negative_binomial_distribution(IntType k, double p = 0.5);
|
| 22 |
explicit negative_binomial_distribution(const param_type& parm);
|
| 23 |
void reset();
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
// generating functions
|
| 26 |
template<class URBG>
|
| 27 |
result_type operator()(URBG& g);
|
| 28 |
template<class URBG>
|
| 29 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -33,11 +38,20 @@ template<class IntType = int>
|
|
| 33 |
double p() const;
|
| 34 |
param_type param() const;
|
| 35 |
void param(const param_type& parm);
|
| 36 |
result_type min() const;
|
| 37 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
};
|
|
|
|
| 39 |
```
|
| 40 |
|
| 41 |
``` cpp
|
| 42 |
explicit negative_binomial_distribution(IntType k, double p = 0.5);
|
| 43 |
```
|
|
|
|
| 7 |
|
| 8 |
[*Note 1*: This implies that P(i | k,p) is undefined when
|
| 9 |
`p == 1`. — *end note*]
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
+
namespace std {
|
| 13 |
template<class IntType = int>
|
| 14 |
class negative_binomial_distribution {
|
| 15 |
public:
|
| 16 |
// types
|
| 17 |
using result_type = IntType;
|
|
|
|
| 21 |
negative_binomial_distribution() : negative_binomial_distribution(1) {}
|
| 22 |
explicit negative_binomial_distribution(IntType k, double p = 0.5);
|
| 23 |
explicit negative_binomial_distribution(const param_type& parm);
|
| 24 |
void reset();
|
| 25 |
|
| 26 |
+
// equality operators
|
| 27 |
+
friend bool operator==(const negative_binomial_distribution& x,
|
| 28 |
+
const negative_binomial_distribution& y);
|
| 29 |
+
|
| 30 |
// generating functions
|
| 31 |
template<class URBG>
|
| 32 |
result_type operator()(URBG& g);
|
| 33 |
template<class URBG>
|
| 34 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 38 |
double p() const;
|
| 39 |
param_type param() const;
|
| 40 |
void param(const param_type& parm);
|
| 41 |
result_type min() const;
|
| 42 |
result_type max() const;
|
| 43 |
+
|
| 44 |
+
// inserters and extractors
|
| 45 |
+
template<class charT, class traits>
|
| 46 |
+
friend basic_ostream<charT, traits>&
|
| 47 |
+
operator<<(basic_ostream<charT, traits>& os, const negative_binomial_distribution& x);
|
| 48 |
+
template<class charT, class traits>
|
| 49 |
+
friend basic_istream<charT, traits>&
|
| 50 |
+
operator>>(basic_istream<charT, traits>& is, negative_binomial_distribution& x);
|
| 51 |
};
|
| 52 |
+
}
|
| 53 |
```
|
| 54 |
|
| 55 |
``` cpp
|
| 56 |
explicit negative_binomial_distribution(IntType k, double p = 0.5);
|
| 57 |
```
|