GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
octave_rand Class Reference

#include "oct-rand.h"

Collaboration diagram for octave_rand:
Collaboration graph
[legend]

Public Member Functions

 ~octave_rand (void)

Static Public Member Functions

static std::string distribution (void)
static void distribution (const std::string &d)
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< floatfloat_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 (void)
static void reset (const std::string &d)
static double scalar (double a=1.0)
static double seed (void)
static void seed (double s)
static ColumnVector state (const std::string &d=std::string())
static void state (const ColumnVector &s, const std::string &d=std::string())
static void uniform_distribution (void)
static Array< doublevector (octave_idx_type n, double a=1.0)

Protected Member Functions

 octave_rand (void)

Private Types

enum  {
  unknown_dist, uniform_dist, normal_dist, expon_dist,
  poisson_dist, gamma_dist
}

Private Member Functions

std::string do_distribution (void)
void do_distribution (const std::string &d)
void do_exponential_distribution (void)
FloatNDArray do_float_nd_array (const dim_vector &dims, float a=1.)
float do_float_scalar (float a=1.)
Array< floatdo_float_vector (octave_idx_type n, 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)
double do_scalar (double a=1.)
double do_seed (void)
void do_seed (double s)
ColumnVector do_state (const std::string &d)
void do_state (const ColumnVector &s, const std::string &d)
void do_uniform_distribution (void)
Array< doubledo_vector (octave_idx_type n, double a=1.)
void fill (octave_idx_type len, double *v, double a)
void fill (octave_idx_type len, float *v, float a)
int get_dist_id (const std::string &d)
ColumnVector get_internal_state (void)
void initialize_mersenne_twister (void)
void initialize_ranlib_generators (void)
void save_state (void)
void set_internal_state (const ColumnVector &s)
void switch_to_generator (int dist)

Static Private Member Functions

static void cleanup_instance (void)

Private Attributes

int current_distribution
std::map< int, ColumnVectorrand_states
bool use_old_generators

Static Private Attributes

static octave_randinstance = 0

Detailed Description

Definition at line 34 of file oct-rand.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator:
unknown_dist 
uniform_dist 
normal_dist 
expon_dist 
poisson_dist 
gamma_dist 

Definition at line 179 of file oct-rand.h.

Constructor & Destructor Documentation

octave_rand::octave_rand ( void  )
protected

Definition at line 78 of file oct-rand.cc.

References initialize_mersenne_twister(), and initialize_ranlib_generators().

Referenced by instance_ok().

octave_rand::~octave_rand ( void  )
inline

Definition at line 44 of file oct-rand.h.

Member Function Documentation

static void octave_rand::cleanup_instance ( void  )
inlinestaticprivate

Definition at line 177 of file oct-rand.h.

Referenced by instance_ok().

static std::string octave_rand::distribution ( void  )
inlinestatic
static void octave_rand::distribution ( const std::string &  d)
inlinestatic

Definition at line 97 of file oct-rand.h.

std::string octave_rand::do_distribution ( void  )
private
void octave_rand::do_distribution ( const std::string &  d)
private
void octave_rand::do_exponential_distribution ( void  )
private

Definition at line 317 of file oct-rand.cc.

References expon_dist, F77_FUNC(), and switch_to_generator().

FloatNDArray octave_rand::do_float_nd_array ( const dim_vector dims,
float  a = 1. 
)
private
float octave_rand::do_float_scalar ( float  a = 1.)
private
Array< float > octave_rand::do_float_vector ( octave_idx_type  n,
float  a = 1. 
)
private
void octave_rand::do_gamma_distribution ( void  )
private

Definition at line 333 of file oct-rand.cc.

References F77_FUNC(), gamma_dist, and switch_to_generator().

NDArray octave_rand::do_nd_array ( const dim_vector dims,
double  a = 1. 
)
private
void octave_rand::do_normal_distribution ( void  )
private

Definition at line 309 of file oct-rand.cc.

References F77_FUNC(), normal_dist, and switch_to_generator().

void octave_rand::do_poisson_distribution ( void  )
private

Definition at line 325 of file oct-rand.cc.

References F77_FUNC(), poisson_dist, and switch_to_generator().

void octave_rand::do_reset ( void  )
private

Definition at line 175 of file oct-rand.cc.

References initialize_ranlib_generators(), and use_old_generators.

void octave_rand::do_reset ( const std::string &  d)
private
double octave_rand::do_scalar ( double  a = 1.)
private
double octave_rand::do_seed ( void  )
private
void octave_rand::do_seed ( double  s)
private
ColumnVector octave_rand::do_state ( const std::string &  d)
private

Definition at line 182 of file oct-rand.cc.

References current_distribution, get_dist_id(), and rand_states.

void octave_rand::do_state ( const ColumnVector s,
const std::string &  d 
)
private
void octave_rand::do_uniform_distribution ( void  )
private

Definition at line 301 of file oct-rand.cc.

References F77_FUNC(), switch_to_generator(), and uniform_dist.

Array< double > octave_rand::do_vector ( octave_idx_type  n,
double  a = 1. 
)
private
static void octave_rand::exponential_distribution ( void  )
inlinestatic

Definition at line 115 of file oct-rand.h.

Referenced by do_distribution(), and do_rand().

void octave_rand::fill ( octave_idx_type  len,
double v,
double  a 
)
private
void octave_rand::fill ( octave_idx_type  len,
float v,
float  a 
)
private
static FloatNDArray octave_rand::float_nd_array ( const dim_vector dims,
float  a = 1.0 
)
inlinestatic

Definition at line 167 of file oct-rand.h.

References FloatNDArray.

Referenced by do_rand().

static float octave_rand::float_scalar ( float  a = 1.0)
inlinestatic

Definition at line 140 of file oct-rand.h.

References octave_Float_NaN.

Referenced by do_rand().

static Array<float> octave_rand::float_vector ( octave_idx_type  n,
float  a = 1.0 
)
inlinestatic

Definition at line 152 of file oct-rand.h.

static void octave_rand::gamma_distribution ( void  )
inlinestatic

Definition at line 127 of file oct-rand.h.

Referenced by do_distribution(), and do_rand().

int octave_rand::get_dist_id ( const std::string &  d)
private
ColumnVector octave_rand::get_internal_state ( void  )
private
void octave_rand::initialize_mersenne_twister ( void  )
private
void octave_rand::initialize_ranlib_generators ( void  )
private
bool octave_rand::instance_ok ( void  )
static

Definition at line 88 of file oct-rand.cc.

References singleton_cleanup_list::add(), cleanup_instance(), instance, and octave_rand().

static NDArray octave_rand::nd_array ( const dim_vector dims,
double  a = 1.0 
)
inlinestatic

Definition at line 159 of file oct-rand.h.

References NDArray.

Referenced by do_rand(), and Frandperm().

static void octave_rand::normal_distribution ( void  )
inlinestatic

Definition at line 109 of file oct-rand.h.

Referenced by do_distribution(), and do_rand().

static void octave_rand::poisson_distribution ( void  )
inlinestatic

Definition at line 121 of file oct-rand.h.

Referenced by do_distribution(), and do_rand().

static void octave_rand::reset ( void  )
inlinestatic

Definition at line 62 of file oct-rand.h.

Referenced by do_rand().

static void octave_rand::reset ( const std::string &  d)
inlinestatic

Definition at line 83 of file oct-rand.h.

void octave_rand::save_state ( void  )
private

Definition at line 639 of file oct-rand.cc.

References current_distribution, get_internal_state(), and rand_states.

Referenced by do_float_scalar(), do_scalar(), and fill().

static double octave_rand::scalar ( double  a = 1.0)
inlinestatic

Definition at line 134 of file oct-rand.h.

References octave_NaN.

Referenced by do_rand().

static double octave_rand::seed ( void  )
inlinestatic

Definition at line 49 of file oct-rand.h.

References octave_NaN.

Referenced by do_rand().

static void octave_rand::seed ( double  s)
inlinestatic

Definition at line 55 of file oct-rand.h.

void octave_rand::set_internal_state ( const ColumnVector s)
private
static ColumnVector octave_rand::state ( const std::string &  d = std::string ())
inlinestatic

Definition at line 69 of file oct-rand.h.

References d.

Referenced by do_rand().

static void octave_rand::state ( const ColumnVector s,
const std::string &  d = std::string () 
)
inlinestatic

Definition at line 75 of file oct-rand.h.

References d.

void octave_rand::switch_to_generator ( int  dist)
private
static void octave_rand::uniform_distribution ( void  )
inlinestatic

Definition at line 103 of file oct-rand.h.

Referenced by do_distribution(), and do_rand().

static Array<double> octave_rand::vector ( octave_idx_type  n,
double  a = 1.0 
)
inlinestatic

Member Data Documentation

int octave_rand::current_distribution
private
octave_rand * octave_rand::instance = 0
staticprivate

Definition at line 175 of file oct-rand.h.

Referenced by instance_ok().

std::map<int, ColumnVector> octave_rand::rand_states
private
bool octave_rand::use_old_generators
private

Definition at line 194 of file oct-rand.h.

Referenced by do_float_scalar(), do_reset(), do_scalar(), do_seed(), do_state(), and fill().


The documentation for this class was generated from the following files: