26 #if ! defined (octave_oct_rand_h)
27 #define octave_oct_rand_h 1
29 #include "octave-config.h"
54 static bool instance_ok (
void);
59 return (instance_ok ()
64 static void seed (
double s)
67 instance->do_seed (s);
74 instance->do_reset ();
85 const std::string&
d =
"")
88 instance->do_state (s,
d);
92 static void reset (
const std::string&
d)
95 instance->do_reset (
d);
101 return instance_ok () ? instance->do_distribution () :
"";
109 instance->do_distribution (
d);
115 instance->do_uniform_distribution ();
121 instance->do_normal_distribution ();
127 instance->do_exponential_distribution ();
133 instance->do_poisson_distribution ();
139 instance->do_gamma_distribution ();
145 return (instance_ok ()
152 return (instance_ok ()
159 return instance_ok () ? instance->do_vector (
n, a) :
Array<double> ();
165 return instance_ok () ? instance->do_vector (
n, a) :
Array<float> ();
172 return instance_ok () ? instance->do_nd_array (dims, a) :
NDArray ();
179 return (instance_ok ()
180 ? instance->do_float_nd_array (dims, a) :
FloatNDArray ());
210 double do_seed (
void);
213 void do_seed (
double s);
225 void do_reset (
const std::string&
d);
228 std::string do_distribution (
void);
232 void do_distribution (
const std::string&
d);
234 void do_uniform_distribution (
void);
236 void do_normal_distribution (
void);
238 void do_exponential_distribution (
void);
240 void do_poisson_distribution (
void);
242 void do_gamma_distribution (
void);
255 template <
typename T> T
gamma (T a);
258 template <
typename T> T do_scalar (T a = 1);
273 void initialize_ranlib_generators (
void);
275 void initialize_mersenne_twister (
void);
279 void save_state (
void);
281 int get_dist_id (
const std::string&
d);
285 void switch_to_generator (
int dist);
template class OCTAVE_API Array< double >
template class OCTAVE_API Array< float >
Vector representing the dimensions (size) of an Array.
static void state(const uint32NDArray &s, const std::string &d="")
static NDArray nd_array(const dim_vector &dims, double a=1.0)
static uint32NDArray state(const std::string &d="")
static std::string distribution(void)
std::map< int, uint32NDArray > rand_states
static void cleanup_instance(void)
static void normal_distribution(void)
static void poisson_distribution(void)
static Array< float > float_vector(octave_idx_type n, float a=1.0)
static double scalar(double a=1.0)
static FloatNDArray float_nd_array(const dim_vector &dims, float a=1.0)
static float float_scalar(float a=1.0)
static Array< double > vector(octave_idx_type n, double a=1.0)
static void distribution(const std::string &d)
static void seed(double s)
static void exponential_distribution(void)
static void gamma_distribution(void)
static void uniform_distribution(void)
static void reset(const std::string &d)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
intNDArray< octave_uint32 > uint32NDArray