vSMC
vSMC: Scalable Monte Carlo
|
Uniform real distribution with variants open/closed variants. More...
#include <vsmc/rng/uniform_real_distribution.hpp>
Classes | |
struct | param_type |
Public Types | |
typedef FPType | result_type |
Public Member Functions | |
UniformRealDistribution (result_type a=0, result_type b=1) | |
UniformRealDistribution (const param_type ¶m) | |
result_type | a () const |
result_type | b () const |
result_type | max () const |
result_type | min () const |
template<typename Eng > | |
result_type | operator() (Eng &eng) const |
Generate uniform random variates. More... | |
param_type | param () const |
void | param (const param_type ¶m) |
void | reset () const |
Friends | |
bool | operator!= (const UniformRealDistribution< FPType, Left, Right, MinMaxIsConstexpr > &runif1, const UniformRealDistribution< FPType, Left, Right, MinMaxIsConstexpr > &runif2) |
template<typename CharT , typename Traits > | |
std::basic_ostream< CharT, Traits > & | operator<< (std::basic_ostream< CharT, Traits > &os, const UniformRealDistribution< FPType, Left, Right, MinMaxIsConstexpr > &runif) |
bool | operator== (const UniformRealDistribution< FPType, Left, Right, MinMaxIsConstexpr > &runif1, const UniformRealDistribution< FPType, Left, Right, MinMaxIsConstexpr > &runif2) |
template<typename CharT , typename Traits > | |
std::basic_istream< CharT, Traits > & | operator>> (std::basic_istream< CharT, Traits > &is, UniformRealDistribution< FPType, Left, Right, MinMaxIsConstexpr > &runif) |
Uniform real distribution with variants open/closed variants.
This distribution is almost identical to C++11 std::uniform_real_distribution
. But it differs in two important aspects
uint32_t
or uint64_t
. FPType | The floating points type of results |
Left | Shall the left side of the interval be Open or Closed |
Right | Shall the right side of the interval be Open or Closed |
MinMaxIsConstexpr | Whether or not UniformRealDistribution shall expect RNG engines that will be used with it has their min and max member functions defined as contant expresssion. For example, struct Engine1
{
static constexpr uint32_t min ();
static constexpr uint32_t max ();
uint32_t operator() ();
};
struct Engine2
{
uint32_t min ();
uint32_t max ();
uint32_t operator() ();
};
Engine1 eng1;
Engine2 eng2;
UniformRealDistribution<double, true> runif1(0, 1);
UniformRealDistribution<double, false> runif2(0, 1);
runif1(eng1); // OK
runif1(eng2); // ERROR! Engine2 does not have contant expression min/max
runif2(eng1); // OK, but less efficient than runif1(eng1)
runif2(eng2); // OK
true , then the distribution will make the decision at compile time, and will rais a static assertion failure if the generated integers does not cover the full range of either 32-bits or 64-bits unsigned integers. |
Definition at line 173 of file uniform_real_distribution.hpp.
typedef FPType vsmc::UniformRealDistribution< FPType, Left, Right, MinMaxIsConstexpr >::result_type |
Definition at line 177 of file uniform_real_distribution.hpp.
|
inlineexplicit |
Definition at line 248 of file uniform_real_distribution.hpp.
|
inlineexplicit |
Definition at line 252 of file uniform_real_distribution.hpp.
|
inline |
Definition at line 266 of file uniform_real_distribution.hpp.
|
inline |
Definition at line 267 of file uniform_real_distribution.hpp.
|
inline |
Definition at line 269 of file uniform_real_distribution.hpp.
|
inline |
Definition at line 268 of file uniform_real_distribution.hpp.
|
inline |
Generate uniform random variates.
Eng | Requirement: Eng::min() == 0 && (
Eng::max() == std::numeric_limits<uint32_t>::max() ||
Eng::max() == std::numeric_limits<uint64_t>::max()
)
|
Definition at line 281 of file uniform_real_distribution.hpp.
|
inline |
Definition at line 256 of file uniform_real_distribution.hpp.
|
inline |
Definition at line 258 of file uniform_real_distribution.hpp.
|
inline |
Definition at line 264 of file uniform_real_distribution.hpp.
|
friend |
Definition at line 301 of file uniform_real_distribution.hpp.
|
friend |
Definition at line 309 of file uniform_real_distribution.hpp.
|
friend |
Definition at line 288 of file uniform_real_distribution.hpp.
|
friend |
Definition at line 323 of file uniform_real_distribution.hpp.