23 #if ! defined (octave_oct_rand_h) 24 #define octave_oct_rand_h 1 26 #include "octave-config.h" 51 static bool instance_ok (
void);
56 return instance_ok () ? instance->do_seed ()
64 instance->do_seed (
s);
71 instance->do_reset ();
85 instance->do_state (
s,
d);
92 instance->do_reset (
d);
98 return instance_ok () ? instance->do_distribution () :
"";
106 instance->do_distribution (
d);
112 instance->do_uniform_distribution ();
118 instance->do_normal_distribution ();
124 instance->do_exponential_distribution ();
130 instance->do_poisson_distribution ();
136 instance->do_gamma_distribution ();
142 return instance_ok () ? instance->do_scalar (
a)
149 return instance_ok () ? instance->do_float_scalar (
a)
156 return instance_ok () ? instance->do_vector (n,
a) :
Array<double> ();
162 return instance_ok () ? instance->do_float_vector (n,
a) :
Array<float> ();
169 return instance_ok () ? instance->do_nd_array (
dims,
a) :
NDArray ();
176 return instance_ok () ? instance->do_float_nd_array (
dims,
a)
207 double do_seed (
void);
210 void do_seed (
double s);
231 void do_uniform_distribution (
void);
233 void do_normal_distribution (
void);
235 void do_exponential_distribution (
void);
237 void do_poisson_distribution (
void);
239 void do_gamma_distribution (
void);
242 double do_scalar (
double a = 1.);
245 float do_float_scalar (
float a = 1.);
263 void initialize_ranlib_generators (
void);
265 void initialize_mersenne_twister (
void);
269 void save_state (
void);
275 void switch_to_generator (
int dist);
static void exponential_distribution(void)
intNDArray< octave_uint32 > uint32NDArray
static void cleanup_instance(void)
static Array< double > vector(octave_idx_type n, double a=1.0)
static float float_scalar(float a=1.0)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
static void seed(double s)
static void gamma_distribution(void)
static void poisson_distribution(void)
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
static NDArray nd_array(const dim_vector &dims, double a=1.0)
static FloatNDArray float_nd_array(const dim_vector &dims, float a=1.0)
static octave_rand * instance
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol NaN(Not a Number). NaN is the result of operations which do not produce a well defined 0 result. Common operations which produce a NaN are arithmetic with infinity ex($\infty - \infty$)
static void normal_distribution(void)
std::map< int, uint32NDArray > rand_states
static void state(const uint32NDArray &s, const std::string &d="")
static std::string distribution(void)
static void distribution(const std::string &d)
static double scalar(double a=1.0)
Vector representing the dimensions (size) of an Array.
static Array< float > float_vector(octave_idx_type n, float a=1.0)
static void uniform_distribution(void)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
static void reset(const std::string &d)
static uint32NDArray state(const std::string &d="")