#include "oct-rand.h"
Public Member Functions | |
~rand (void)=default | |
template<typename T > | |
T | do_scalar (T a) |
template<typename T > | |
Array< T > | do_vector (octave_idx_type n, T a) |
Static Public Member Functions | |
static void | distribution (const std::string &d) |
static std::string | distribution (void) |
static void | exponential_distribution (void) |
static FloatNDArray | float_nd_array (const dim_vector &dims, float a=1.0) |
static float | float_scalar (float a=1.0) |
static Array< float > | float_vector (octave_idx_type n, float a=1.0) |
static void | gamma_distribution (void) |
static bool | instance_ok (void) |
static NDArray | nd_array (const dim_vector &dims, double a=1.0) |
static void | normal_distribution (void) |
static void | poisson_distribution (void) |
static void | reset (const std::string &d) |
static void | reset (void) |
static double | scalar (double a=1.0) |
static void | seed (double s) |
static double | seed (void) |
static uint32NDArray | state (const std::string &d="") |
static void | state (const uint32NDArray &s, const std::string &d="") |
static void | uniform_distribution (void) |
static Array< double > | vector (octave_idx_type n, double a=1.0) |
Protected Member Functions | |
OCTAVE_API | rand (void) |
Private Types | |
enum | { unknown_dist , uniform_dist , normal_dist , expon_dist , poisson_dist , gamma_dist } |
Static Private Member Functions | |
static void | cleanup_instance (void) |
Private Attributes | |
int | m_current_distribution |
std::map< int, uint32NDArray > | m_rand_states |
bool | m_use_old_generators |
Static Private Attributes | |
static rand * | m_instance = nullptr |
Definition at line 44 of file oct-rand.h.
|
private |
Enumerator | |
---|---|
unknown_dist | |
uniform_dist | |
normal_dist | |
expon_dist | |
poisson_dist | |
gamma_dist |
Definition at line 190 of file oct-rand.h.
|
protected |
Definition at line 53 of file oct-rand.cc.
References initialize_mersenne_twister(), and initialize_ranlib_generators().
Referenced by instance_ok().
|
default |
|
inlinestaticprivate |
Definition at line 187 of file oct-rand.h.
Referenced by instance_ok().
|
inlinestatic |
Definition at line 106 of file oct-rand.h.
References d.
|
inlinestatic |
Definition at line 99 of file oct-rand.h.
Referenced by do_rand().
|
private |
Definition at line 225 of file oct-rand.cc.
References d, expon_dist, exponential_distribution(), gamma_dist, gamma_distribution(), get_dist_id(), normal_dist, normal_distribution(), poisson_dist, poisson_distribution(), uniform_dist, and uniform_distribution().
|
private |
Definition at line 190 of file oct-rand.cc.
References expon_dist, gamma_dist, m_current_distribution, normal_dist, poisson_dist, and uniform_dist.
|
private |
Definition at line 272 of file oct-rand.cc.
References expon_dist, F77_FUNC(), and switch_to_generator().
|
private |
Definition at line 533 of file oct-rand.cc.
References dim_vector::all_zero(), Array< T, Alloc >::clear(), fill(), Array< T, Alloc >::fortran_vec(), and Array< T, Alloc >::numel().
|
private |
Definition at line 286 of file oct-rand.cc.
References F77_FUNC(), gamma_dist, and switch_to_generator().
|
private |
Definition at line 519 of file oct-rand.cc.
References dim_vector::all_zero(), Array< T, Alloc >::clear(), fill(), Array< T, Alloc >::fortran_vec(), and Array< T, Alloc >::numel().
|
private |
Definition at line 265 of file oct-rand.cc.
References F77_FUNC(), normal_dist, and switch_to_generator().
|
private |
Definition at line 279 of file oct-rand.cc.
References F77_FUNC(), poisson_dist, and switch_to_generator().
|
private |
Definition at line 138 of file oct-rand.cc.
References initialize_ranlib_generators(), and m_use_old_generators.
|
private |
Definition at line 170 of file oct-rand.cc.
References d, get_dist_id(), get_internal_state(), init_mersenne_twister(), m_current_distribution, m_rand_states, and m_use_old_generators.
T rand::do_scalar | ( | T | a | ) |
Definition at line 455 of file oct-rand.cc.
References expon_dist, gamma_dist, m_current_distribution, m_use_old_generators, normal_dist, poisson_dist, save_state(), and uniform_dist.
|
private |
|
private |
Definition at line 111 of file oct-rand.cc.
References d, F77_FUNC(), flt_fmt_ieee_big_endian, force_to_fit_range(), m_use_old_generators, native_float_format(), and setsd().
|
private |
Definition at line 75 of file oct-rand.cc.
References d, F77_FUNC(), flt_fmt_ieee_big_endian, getsd(), and native_float_format().
|
private |
Definition at line 144 of file oct-rand.cc.
References d, get_dist_id(), m_current_distribution, and m_rand_states.
|
private |
Definition at line 149 of file oct-rand.cc.
References d, get_dist_id(), get_internal_state(), m_current_distribution, m_rand_states, m_use_old_generators, and set_internal_state().
|
private |
Definition at line 258 of file oct-rand.cc.
References F77_FUNC(), switch_to_generator(), and uniform_dist.
Array<T> rand::do_vector | ( | octave_idx_type | n, |
T | a | ||
) |
Definition at line 498 of file oct-rand.cc.
References Array< T, Alloc >::clear(), fill(), Array< T, Alloc >::fortran_vec(), n, and Array< T, Alloc >::numel().
|
private |
|
private |
Definition at line 320 of file oct-rand.cc.
References dgenexp(), F77_FUNC(), m_use_old_generators, and rand_exponential< double >().
|
private |
Definition at line 399 of file oct-rand.cc.
References F77_FUNC(), fgenexp(), m_use_old_generators, and rand_exponential< float >().
|
private |
|
inlinestatic |
Definition at line 124 of file oct-rand.h.
Referenced by do_distribution(), and do_rand().
|
private |
Definition at line 658 of file oct-rand.cc.
References dgenexp(), dgengam(), dgennor(), dgenunf(), dignpoi(), expon_dist, F77_FUNC(), gamma_dist, isfinite(), len, m_current_distribution, m_use_old_generators, NaN, normal_dist, poisson_dist, rand_exponential< double >(), rand_normal< double >(), rand_poisson< double >(), rand_uniform< double >(), save_state(), uniform_dist, and x.
Referenced by do_float_nd_array(), do_nd_array(), and do_vector().
|
private |
Definition at line 726 of file oct-rand.cc.
References expon_dist, F77_FUNC(), fgenexp(), fgengam(), fgennor(), fgenunf(), fignpoi(), gamma_dist, isfinite(), len, m_current_distribution, m_use_old_generators, NaN, normal_dist, poisson_dist, rand_exponential< float >(), rand_normal< float >(), rand_poisson< float >(), rand_uniform< float >(), save_state(), uniform_dist, and x.
|
inlinestatic |
Definition at line 177 of file oct-rand.h.
Referenced by do_rand().
|
inlinestatic |
|
inlinestatic |
Definition at line 163 of file oct-rand.h.
References Array< float >, and n.
|
private |
Definition at line 355 of file oct-rand.cc.
References dgengam(), F77_FUNC(), isfinite(), m_use_old_generators, and NaN.
|
private |
Definition at line 437 of file oct-rand.cc.
References F77_FUNC(), fgengam(), isfinite(), m_use_old_generators, and NaN.
|
private |
|
inlinestatic |
Definition at line 136 of file oct-rand.h.
Referenced by do_distribution(), and do_rand().
|
private |
Definition at line 615 of file oct-rand.cc.
References current_liboctave_error_handler, d, expon_dist, gamma_dist, normal_dist, poisson_dist, uniform_dist, and unknown_dist.
Referenced by do_distribution(), do_reset(), and do_state().
|
private |
Definition at line 601 of file oct-rand.cc.
References Array< T, Alloc >::fortran_vec(), get_mersenne_twister_state(), and MT_N.
Referenced by do_reset(), do_state(), initialize_mersenne_twister(), and save_state().
|
private |
Definition at line 572 of file oct-rand.cc.
References expon_dist, gamma_dist, get_internal_state(), init_mersenne_twister(), m_current_distribution, m_rand_states, normal_dist, poisson_dist, set_internal_state(), and uniform_dist.
Referenced by rand().
|
private |
Definition at line 552 of file oct-rand.cc.
References F77_FUNC(), force_to_fit_range(), m_current_distribution, setall(), and uniform_dist.
Referenced by rand(), and do_reset().
|
static |
Definition at line 62 of file oct-rand.cc.
References rand(), singleton_cleanup_list::add(), cleanup_instance(), and m_instance.
|
inlinestatic |
Definition at line 170 of file oct-rand.h.
References NDArray.
Referenced by do_rand(), and Frandperm().
|
private |
Definition at line 307 of file oct-rand.cc.
References dgennor(), F77_FUNC(), m_use_old_generators, and rand_normal< double >().
|
private |
Definition at line 386 of file oct-rand.cc.
References F77_FUNC(), fgennor(), m_use_old_generators, and rand_normal< float >().
|
private |
|
inlinestatic |
Definition at line 118 of file oct-rand.h.
Referenced by do_distribution(), and do_rand().
|
private |
Definition at line 333 of file oct-rand.cc.
References dignpoi(), F77_FUNC(), isfinite(), m_use_old_generators, NaN, and rand_poisson< double >().
|
private |
Definition at line 412 of file oct-rand.cc.
References F77_FUNC(), fignpoi(), isfinite(), m_use_old_generators, NaN, and rand_poisson< double >().
|
private |
|
inlinestatic |
Definition at line 130 of file oct-rand.h.
Referenced by do_distribution(), and do_rand().
|
inlinestatic |
Definition at line 92 of file oct-rand.h.
References d.
|
inlinestatic |
Definition at line 71 of file oct-rand.h.
Referenced by do_rand().
|
private |
Definition at line 610 of file oct-rand.cc.
References get_internal_state(), m_current_distribution, and m_rand_states.
Referenced by do_scalar(), and fill().
|
inlinestatic |
|
inlinestatic |
Definition at line 64 of file oct-rand.h.
|
inlinestatic |
|
private |
Definition at line 636 of file oct-rand.cc.
References Array< T, Alloc >::data(), init_mersenne_twister(), len, MT_N, Array< T, Alloc >::numel(), and set_mersenne_twister_state().
Referenced by do_state(), initialize_mersenne_twister(), and switch_to_generator().
|
inlinestatic |
|
inlinestatic |
Definition at line 84 of file oct-rand.h.
References d.
|
private |
Definition at line 648 of file oct-rand.cc.
References m_current_distribution, m_rand_states, and set_internal_state().
Referenced by do_exponential_distribution(), do_gamma_distribution(), do_normal_distribution(), do_poisson_distribution(), and do_uniform_distribution().
|
private |
Definition at line 294 of file oct-rand.cc.
References dgenunf(), F77_FUNC(), m_use_old_generators, and rand_uniform< double >().
|
private |
Definition at line 373 of file oct-rand.cc.
References F77_FUNC(), fgenunf(), m_use_old_generators, and rand_uniform< float >().
|
private |
|
inlinestatic |
Definition at line 112 of file oct-rand.h.
Referenced by do_distribution(), and do_rand().
|
inlinestatic |
Definition at line 157 of file oct-rand.h.
References Array< double >, and n.
|
private |
Definition at line 201 of file oct-rand.h.
Referenced by do_distribution(), do_reset(), do_scalar(), do_state(), fill(), initialize_mersenne_twister(), initialize_ranlib_generators(), save_state(), and switch_to_generator().
|
staticprivate |
Definition at line 185 of file oct-rand.h.
Referenced by instance_ok().
|
private |
Definition at line 208 of file oct-rand.h.
Referenced by do_reset(), do_state(), initialize_mersenne_twister(), save_state(), and switch_to_generator().
|
private |
Definition at line 205 of file oct-rand.h.
Referenced by do_reset(), do_scalar(), do_seed(), do_state(), exponential(), fill(), gamma(), normal(), poisson(), and uniform().