#include "oct-rand.h"
Public Member Functions | |
~rand (void)=default | |
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 | |
rand (void) | |
Private Types | |
enum | { unknown_dist , uniform_dist , normal_dist , expon_dist , poisson_dist , gamma_dist } |
Private Member Functions | |
void | do_distribution (const std::string &d) |
std::string | do_distribution (void) |
void | do_exponential_distribution (void) |
FloatNDArray | do_float_nd_array (const dim_vector &dims, float a=1.) |
void | do_gamma_distribution (void) |
NDArray | do_nd_array (const dim_vector &dims, double a=1.) |
void | do_normal_distribution (void) |
void | do_poisson_distribution (void) |
void | do_reset () |
void | do_reset (const std::string &d) |
template<typename T > | |
T | do_scalar (T a=1) |
void | do_seed (double s) |
double | do_seed (void) |
uint32NDArray | do_state (const std::string &d) |
void | do_state (const uint32NDArray &s, const std::string &d) |
void | do_uniform_distribution (void) |
template<typename T > | |
Array< T > | do_vector (octave_idx_type n, T a=1) |
template<> | |
double | exponential (void) |
template<> | |
float | exponential (void) |
template<typename T > | |
T | exponential (void) |
void | fill (octave_idx_type len, double *v, double a) |
void | fill (octave_idx_type len, float *v, float a) |
template<> | |
double | gamma (double a) |
template<> | |
float | gamma (float a) |
template<typename T > | |
T | gamma (T a) |
int | get_dist_id (const std::string &d) |
uint32NDArray | get_internal_state (void) |
void | initialize_mersenne_twister (void) |
void | initialize_ranlib_generators (void) |
template<> | |
double | normal (void) |
template<> | |
float | normal (void) |
template<typename T > | |
T | normal (void) |
template<> | |
double | poisson (double a) |
template<> | |
float | poisson (float a) |
template<typename T > | |
T | poisson (T a) |
void | save_state (void) |
void | set_internal_state (const uint32NDArray &s) |
void | switch_to_generator (int dist) |
template<> | |
double | uniform (void) |
template<> | |
float | uniform (void) |
template<typename T > | |
T | uniform (void) |
Static Private Member Functions | |
static void | cleanup_instance (void) |
Private Attributes | |
int | current_distribution |
std::map< int, uint32NDArray > | rand_states |
bool | use_old_generators |
Static Private Attributes | |
static rand * | 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 189 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(), EigsComplexNonSymmetricFunc(), EigsComplexNonSymmetricMatrix(), EigsComplexNonSymmetricMatrixShift(), EigsRealNonSymmetricFunc(), EigsRealNonSymmetricMatrix(), EigsRealNonSymmetricMatrixShift(), EigsRealSymmetricFunc(), EigsRealSymmetricMatrix(), and EigsRealSymmetricMatrixShift().
|
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 current_distribution, expon_dist, gamma_dist, normal_dist, poisson_dist, retval, 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 531 of file oct-rand.cc.
References dim_vector::all_zero(), Array< T >::clear(), fill(), Array< T >::fortran_vec(), Array< T >::numel(), and retval.
|
private |
Definition at line 286 of file oct-rand.cc.
References F77_FUNC(), gamma_dist, and switch_to_generator().
|
private |
Definition at line 517 of file oct-rand.cc.
References dim_vector::all_zero(), Array< T >::clear(), fill(), Array< T >::fortran_vec(), Array< T >::numel(), and retval.
|
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 use_old_generators.
|
private |
Definition at line 170 of file oct-rand.cc.
References current_distribution, d, get_dist_id(), get_internal_state(), octave::init_mersenne_twister(), rand_states, and use_old_generators.
|
private |
Definition at line 455 of file oct-rand.cc.
References current_distribution, expon_dist, gamma_dist, normal_dist, poisson_dist, retval, save_state(), uniform_dist, and use_old_generators.
|
private |
Definition at line 111 of file oct-rand.cc.
References d, F77_FUNC(), octave::mach_info::flt_fmt_ieee_big_endian, octave::force_to_fit_range(), octave::mach_info::native_float_format(), setsd(), and use_old_generators.
|
private |
Definition at line 75 of file oct-rand.cc.
References d, F77_FUNC(), octave::mach_info::flt_fmt_ieee_big_endian, getsd(), and octave::mach_info::native_float_format().
|
private |
Definition at line 144 of file oct-rand.cc.
References current_distribution, d, get_dist_id(), and rand_states.
|
private |
Definition at line 149 of file oct-rand.cc.
References current_distribution, d, get_dist_id(), get_internal_state(), rand_states, set_internal_state(), and use_old_generators.
|
private |
Definition at line 258 of file oct-rand.cc.
References F77_FUNC(), switch_to_generator(), and uniform_dist.
|
private |
Definition at line 498 of file oct-rand.cc.
References Array< T >::clear(), fill(), Array< T >::fortran_vec(), n, Array< T >::numel(), and retval.
|
private |
Definition at line 320 of file oct-rand.cc.
References dgenexp(), F77_FUNC(), octave::rand_exponential< double >(), retval, and use_old_generators.
|
private |
Definition at line 399 of file oct-rand.cc.
References F77_FUNC(), fgenexp(), octave::rand_exponential< float >(), retval, and use_old_generators.
|
private |
|
inlinestatic |
Definition at line 124 of file oct-rand.h.
Referenced by do_distribution(), and do_rand().
|
private |
Definition at line 656 of file oct-rand.cc.
References current_distribution, dgenexp(), dgengam(), dgennor(), dgenunf(), dignpoi(), expon_dist, F77_FUNC(), gamma_dist, octave::math::isfinite(), len, NaN, normal_dist, poisson_dist, octave::rand_exponential< double >(), octave::rand_normal< double >(), octave::rand_poisson< double >(), octave::rand_uniform< double >(), save_state(), uniform_dist, use_old_generators, and x.
Referenced by do_float_nd_array(), do_nd_array(), and do_vector().
|
private |
Definition at line 724 of file oct-rand.cc.
References current_distribution, expon_dist, F77_FUNC(), fgenexp(), fgengam(), fgennor(), fgenunf(), fignpoi(), gamma_dist, octave::math::isfinite(), len, NaN, normal_dist, poisson_dist, octave::rand_exponential< float >(), octave::rand_normal< float >(), octave::rand_poisson< float >(), octave::rand_uniform< float >(), save_state(), uniform_dist, use_old_generators, 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(), octave::math::isfinite(), NaN, retval, and use_old_generators.
|
private |
Definition at line 437 of file oct-rand.cc.
References F77_FUNC(), fgengam(), octave::math::isfinite(), NaN, retval, and use_old_generators.
|
private |
|
inlinestatic |
Definition at line 136 of file oct-rand.h.
Referenced by do_distribution(), and do_rand().
|
private |
Definition at line 613 of file oct-rand.cc.
References current_liboctave_error_handler, d, expon_dist, gamma_dist, normal_dist, poisson_dist, retval, uniform_dist, and unknown_dist.
Referenced by do_distribution(), do_reset(), and do_state().
|
private |
Definition at line 599 of file oct-rand.cc.
References Array< T >::fortran_vec(), octave::get_mersenne_twister_state(), and MT_N.
Referenced by do_reset(), do_state(), initialize_mersenne_twister(), and save_state().
|
private |
Definition at line 570 of file oct-rand.cc.
References current_distribution, expon_dist, gamma_dist, get_internal_state(), octave::init_mersenne_twister(), normal_dist, poisson_dist, rand_states, set_internal_state(), and uniform_dist.
Referenced by rand().
|
private |
Definition at line 550 of file oct-rand.cc.
References current_distribution, F77_FUNC(), octave::force_to_fit_range(), octave::sys::base_tm::hour(), octave::sys::base_tm::mday(), octave::sys::base_tm::min(), octave::sys::base_tm::sec(), 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(), instance, and retval.
|
inlinestatic |
Definition at line 170 of file oct-rand.h.
Referenced by do_rand(), and Frandperm().
|
private |
Definition at line 307 of file oct-rand.cc.
References dgennor(), F77_FUNC(), octave::rand_normal< double >(), retval, and use_old_generators.
|
private |
Definition at line 386 of file oct-rand.cc.
References F77_FUNC(), fgennor(), octave::rand_normal< float >(), retval, and use_old_generators.
|
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(), octave::math::isfinite(), NaN, octave::rand_poisson< double >(), retval, and use_old_generators.
|
private |
Definition at line 412 of file oct-rand.cc.
References F77_FUNC(), fignpoi(), octave::math::isfinite(), NaN, octave::rand_poisson< double >(), retval, and use_old_generators.
|
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 608 of file oct-rand.cc.
References current_distribution, get_internal_state(), and rand_states.
Referenced by do_scalar(), and fill().
|
inlinestatic |
|
inlinestatic |
Definition at line 64 of file oct-rand.h.
|
inlinestatic |
|
private |
Definition at line 634 of file oct-rand.cc.
References Array< T >::data(), octave::init_mersenne_twister(), len, MT_N, Array< T >::numel(), and octave::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 646 of file oct-rand.cc.
References current_distribution, 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(), octave::rand_uniform< double >(), retval, and use_old_generators.
|
private |
Definition at line 373 of file oct-rand.cc.
References F77_FUNC(), fgenunf(), octave::rand_uniform< float >(), retval, and use_old_generators.
|
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.
Referenced by EigsComplexNonSymmetricFunc(), EigsComplexNonSymmetricMatrix(), EigsComplexNonSymmetricMatrixShift(), EigsRealNonSymmetricFunc(), EigsRealNonSymmetricMatrix(), EigsRealNonSymmetricMatrixShift(), EigsRealSymmetricFunc(), EigsRealSymmetricMatrix(), and EigsRealSymmetricMatrixShift().
|
private |
Definition at line 200 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 207 of file oct-rand.h.
Referenced by do_reset(), do_state(), initialize_mersenne_twister(), save_state(), and switch_to_generator().
|
private |
Definition at line 204 of file oct-rand.h.
Referenced by do_reset(), do_scalar(), do_seed(), do_state(), exponential(), fill(), gamma(), normal(), poisson(), and uniform().