mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-14 15:04:09 +00:00
distribution 修正
This commit is contained in:
parent
9255ad6808
commit
6e6c515704
7 changed files with 73 additions and 47 deletions
|
@ -69,6 +69,10 @@ namespace sprout {
|
|||
class param_type {
|
||||
public:
|
||||
typedef binomial_distribution distribution_type;
|
||||
private:
|
||||
static SPROUT_CONSTEXPR bool arg_check_nothrow(IntType t_arg, RealType p_arg) {
|
||||
return distribution_type::arg_check_nothrow(t_arg, p_arg);
|
||||
}
|
||||
private:
|
||||
IntType t_;
|
||||
RealType p_;
|
||||
|
@ -88,9 +92,9 @@ namespace sprout {
|
|||
return p_;
|
||||
}
|
||||
template<typename Elem, typename Traits>
|
||||
friend std::basic_ostream<Elem, Traits>& operator>>(
|
||||
friend std::basic_istream<Elem, Traits>& operator>>(
|
||||
std::basic_istream<Elem, Traits>& lhs,
|
||||
param_type const& rhs
|
||||
param_type& rhs
|
||||
)
|
||||
{
|
||||
IntType t;
|
||||
|
@ -391,8 +395,8 @@ namespace sprout {
|
|||
return param_type(t_, p_);
|
||||
}
|
||||
void param(param_type const& parm) {
|
||||
t_ = parm.a();
|
||||
p_ = parm.b();
|
||||
t_ = parm.t();
|
||||
p_ = parm.p();
|
||||
init();
|
||||
}
|
||||
template<typename Engine>
|
||||
|
@ -405,14 +409,14 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Elem, typename Traits>
|
||||
friend std::basic_ostream<Elem, Traits>& operator>>(
|
||||
friend std::basic_istream<Elem, Traits>& operator>>(
|
||||
std::basic_istream<Elem, Traits>& lhs,
|
||||
binomial_distribution const& rhs
|
||||
binomial_distribution& rhs
|
||||
)
|
||||
{
|
||||
param_type parm;
|
||||
lhs >> parm;
|
||||
param(parm);
|
||||
rhs.param(parm);
|
||||
return lhs;
|
||||
}
|
||||
template<typename Elem, typename Traits>
|
||||
|
@ -421,7 +425,7 @@ namespace sprout {
|
|||
binomial_distribution const& rhs
|
||||
)
|
||||
{
|
||||
return lhs << param();
|
||||
return lhs << rhs.param();
|
||||
}
|
||||
SPROUT_CONSTEXPR friend bool operator==(binomial_distribution const& lhs, binomial_distribution const& rhs) {
|
||||
return lhs.param() == rhs.param();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue