23 #if defined (HAVE_CONFIG_H)
72 (*current_liboctave_error_handler)
73 (
"unable to create octave_rand object!");
81 union d2i {
double d; int32_t
i[2]; };
102 assert (hi > lo && lo >= 0 && hi > lo);
120 union d2i {
double d; int32_t
i[2]; };
165 if (old_dist != new_dist)
172 if (old_dist != new_dist)
187 if (old_dist != new_dist)
193 if (old_dist != new_dist)
213 retval =
"exponential";
225 (*current_liboctave_error_handler)
261 (*current_liboctave_error_handler)
262 (
"rand: invalid distribution ID = %d",
id);
347 (*current_liboctave_error_handler)
377 (*current_liboctave_error_handler)
396 double dretval = 0.0;
430 (*current_liboctave_error_handler)
462 (*current_liboctave_error_handler)
485 (*current_liboctave_error_handler) (
"rand: invalid negative argument");
502 (*current_liboctave_error_handler) (
"rand: invalid negative argument");
550 int minute = tm.
min () + 1;
553 int32_t s0 = tm.
mday () * hour * minute *
second;
554 int32_t s1 = hour * minute *
second;
560 F77_FUNC (setcgn, SETCGN) (stored_distribution);
599 s.
elem (
i) =
static_cast<double> (
tmp[
i]);
615 if (d ==
"uniform" || d ==
"rand")
617 else if (d ==
"normal" || d ==
"randn")
619 else if (d ==
"exponential" || d ==
"rande")
621 else if (d ==
"poisson" || d ==
"randp")
623 else if (d ==
"gamma" || d ==
"randg")
627 (
"rand: invalid distribution '%s'", d.c_str ());
647 d = fmod (d, TWOUP32);
650 u =
static_cast<uint32_t
> (
d);
684 #define MAKE_RAND(len) \
688 for (volatile octave_idx_type i = 0; i < len; i++) \
708 #define RAND_FUNC(x) F77_FUNC (dgenunf, DGENUNF) (0.0, 1.0, x)
719 #define RAND_FUNC(x) F77_FUNC (dgennor, DGENNOR) (0.0, 1.0, x)
730 #define RAND_FUNC(x) F77_FUNC (dgenexp, DGENEXP) (1.0, x)
742 #define RAND_FUNC(x) x = octave::numeric_limits<double>::NaN ();
750 #define RAND_FUNC(x) F77_FUNC (dignpoi, DIGNPOI) (a, x)
763 #define RAND_FUNC(x) x = octave::numeric_limits<double>::NaN ();
767 #define RAND_FUNC(x) F77_FUNC (dgengam, DGENGAM) (1.0, a, x)
776 (*current_liboctave_error_handler)
797 #define RAND_FUNC(x) F77_FUNC (dgenunf, DGENUNF) (0.0, 1.0, x)
808 #define RAND_FUNC(x) F77_FUNC (dgennor, DGENNOR) (0.0, 1.0, x)
819 #define RAND_FUNC(x) F77_FUNC (dgenexp, DGENEXP) (1.0, x)
832 #define RAND_FUNC(x) x = octave::numeric_limits<double>::NaN ();
840 #define RAND_FUNC(x) F77_FUNC (dignpoi, DIGNPOI) (da, x)
854 #define RAND_FUNC(x) x = octave::numeric_limits<double>::NaN ();
858 #define RAND_FUNC(x) F77_FUNC (dgengam, DGENGAM) (1.0, da, x)
867 (*current_liboctave_error_handler)
for fields that display a single padding can be changed or inhibited by following the hour(hh:mm:ss[AP]M).tem%R Time
subroutine setsd(iseed1, iseed2)
Array< float > do_float_vector(octave_idx_type n, float a=1.)
static bool instance_ok(void)
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup calculate Y_a and Y _d item Given calculate Y nd enumerate In either initial values for the given components are and initial guesses for the unknown components must also be provided as input Set this option to to solve the first or to solve the second(the default is 0, so you must provide a set of initial conditions that are consistent).If this option is set to a nonzero value
NDArray do_nd_array(const dim_vector &dims, double a=1.)
float oct_float_randu(void)
static void exponential_distribution(void)
subroutine dignpoi(mu, result)
void do_poisson_distribution(void)
void oct_get_state(uint32_t *save)
octave_idx_type numel(void) const
Number of elements in the array.
void do_exponential_distribution(void)
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
static void cleanup_instance(void)
void initialize_ranlib_generators(void)
void oct_fill_randg(double a, octave_idx_type n, double *r)
T & elem(octave_idx_type n)
void do_normal_distribution(void)
double do_scalar(double a=1.)
void oct_fill_float_randu(octave_idx_type n, float *p)
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &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 F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
ColumnVector do_state(const std::string &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
void fill(octave_idx_type len, double *v, double a)
void oct_fill_randu(octave_idx_type n, double *p)
void initialize_mersenne_twister(void)
void switch_to_generator(int dist)
double oct_randp(double L)
static uint32_t double2uint32(double d)
float do_float_scalar(float a=1.)
int get_dist_id(const std::string &d)
subroutine dgenunf(low, high, result)
void do_gamma_distribution(void)
static std::string current_distribution
float oct_float_randn(void)
subroutine dgenexp(av, result)
static void gamma_distribution(void)
std::map< int, ColumnVector > rand_states
FloatNDArray do_float_nd_array(const dim_vector &dims, float a=1.)
Array< double > do_vector(octave_idx_type n, double a=1.)
float oct_float_randg(float a)
F77_RET_T F77_FUNC(xstopx, XSTOPX) const
static void poisson_distribution(void)
void oct_fill_randn(octave_idx_type n, double *p)
subroutine dgengam(a, r, result)
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
double oct_randg(double a)
bool all_zero(void) const
void oct_fill_float_randp(float FL, octave_idx_type n, float *p)
subroutine setall(iseed1, iseed2)
void oct_set_state(uint32_t *save)
static float_format native_float_format(void)
void oct_fill_float_randn(octave_idx_type n, float *p)
charNDArray max(char d, const charNDArray &m)
void do_uniform_distribution(void)
void oct_fill_float_randg(float a, octave_idx_type n, float *r)
=val(i)}if ode{val(i)}occurs in table i
static octave_rand * instance
static void normal_distribution(void)
subroutine dgennor(av, sd, result)
float oct_float_rande(void)
subroutine getsd(iseed1, iseed2)
void oct_fill_rande(octave_idx_type n, double *p)
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 $)
void oct_init_by_array(uint32_t *init_key, int key_length)
std::string do_distribution(void)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
void oct_init_by_entropy(void)
void set_internal_state(const ColumnVector &s)
const T * fortran_vec(void) const
Vector representing the dimensions (size) of an Array.
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
void oct_fill_float_rande(octave_idx_type n, float *p)
static int32_t force_to_fit_range(int32_t i, int32_t lo, int32_t hi)
ColumnVector get_internal_state(void)
void oct_fill_randp(double L, octave_idx_type n, double *p)