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 m_instance->do_seed (s);
74 m_instance->do_reset ();
80 return instance_ok () ? m_instance->do_state (
d) :
uint32NDArray ();
85 const std::string&
d =
"")
88 m_instance->do_state (s,
d);
92 static void reset (
const std::string&
d)
95 m_instance->do_reset (
d);
101 return instance_ok () ? m_instance->do_distribution () :
"";
109 m_instance->do_distribution (
d);
115 m_instance->do_uniform_distribution ();
121 m_instance->do_normal_distribution ();
127 m_instance->do_exponential_distribution ();
133 m_instance->do_poisson_distribution ();
139 m_instance->do_gamma_distribution ();
145 return (instance_ok ()
152 return (instance_ok ()
159 return instance_ok () ? m_instance->do_vector (
n, a) :
Array<double> ();
165 return instance_ok () ? m_instance->do_vector (
n, a) :
Array<float> ();
172 return instance_ok () ? m_instance->do_nd_array (dims, a) :
NDArray ();
179 return (instance_ok ()
180 ? m_instance->do_float_nd_array (dims, a) :
FloatNDArray ());
188 {
delete m_instance; m_instance =
nullptr; }
229 OCTAVE_API std::string do_distribution (
void);
233 OCTAVE_API void do_distribution (
const std::string&
d);
235 OCTAVE_API void do_uniform_distribution (
void);
237 OCTAVE_API void do_normal_distribution (
void);
239 OCTAVE_API void do_exponential_distribution (
void);
241 OCTAVE_API void do_poisson_distribution (
void);
272 do_float_nd_array (
const dim_vector& dims,
float a = 1.);
276 OCTAVE_API void initialize_ranlib_generators (
void);
278 OCTAVE_API void initialize_mersenne_twister (
void);
288 OCTAVE_API void switch_to_generator (
int dist);
template class OCTAVE_CLASS_TEMPLATE_INSTANTIATION_API Array< double >
template class OCTAVE_CLASS_TEMPLATE_INSTANTIATION_API Array< float >
Vector representing the dimensions (size) of an Array.
static void gamma_distribution(void)
bool m_use_old_generators
static FloatNDArray float_nd_array(const dim_vector &dims, float a=1.0)
static std::string distribution(void)
static uint32NDArray state(const std::string &d="")
static Array< float > float_vector(octave_idx_type n, float a=1.0)
OCTAVE_API T poisson(T a)
static void distribution(const std::string &d)
static NDArray nd_array(const dim_vector &dims, double a=1.0)
static double scalar(double a=1.0)
static void seed(double s)
OCTAVE_API T normal(void)
OCTAVE_API T do_scalar(T a=1)
OCTAVE_API Array< T > do_vector(octave_idx_type n, T a=1)
static void uniform_distribution(void)
static float float_scalar(float a=1.0)
static void reset(const std::string &d)
OCTAVE_API T uniform(void)
static void exponential_distribution(void)
static void state(const uint32NDArray &s, const std::string &d="")
static Array< double > vector(octave_idx_type n, double a=1.0)
std::map< int, uint32NDArray > m_rand_states
static void cleanup_instance(void)
static void poisson_distribution(void)
static void normal_distribution(void)
int m_current_distribution
OCTAVE_API T exponential(void)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
intNDArray< octave_uint32 > uint32NDArray