Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

octave_rand Class Reference

#include "oct-rand.h"

Collaboration diagram for octave_rand:
Collaboration graph
[legend]

List of all members.

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 void gamma_distribution (void)
static bool instance_ok (void)
static Matrix matrix (octave_idx_type r, octave_idx_type c, double a=1.0)
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 void seed (double s)
static double seed (void)
static void state (const ColumnVector &s, const std::string &d=std::string())
static ColumnVector state (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)
void do_gamma_distribution (void)
Matrix do_matrix (octave_idx_type r, octave_idx_type c, double a=1.)
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.)
void do_seed (double s)
double do_seed (void)
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)
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 165 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   )  [inline, static, private]

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

Referenced by instance_ok().

static std::string octave_rand::distribution ( void   )  [inline, static]

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

Referenced by do_rand().

static void octave_rand::distribution ( const std::string &  d  )  [inline, static]

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().

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().

Matrix octave_rand::do_matrix ( octave_idx_type  r,
octave_idx_type  c,
double  a = 1. 
) [private]
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]
void octave_rand::do_seed ( double  s  )  [private]
double octave_rand::do_seed ( void   )  [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   )  [inline, static]

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]
static void octave_rand::gamma_distribution ( void   )  [inline, static]

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]

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

References current_liboctave_error_handler.

Referenced by do_distribution(), do_reset(), and do_state().

ColumnVector octave_rand::get_internal_state ( void   )  [private]
void octave_rand::initialize_mersenne_twister ( void   )  [private]

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

References get_internal_state(), oct_init_by_entropy(), and rand_states.

Referenced by octave_rand().

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 Matrix octave_rand::matrix ( octave_idx_type  r,
octave_idx_type  c,
double  a = 1.0 
) [inline, static]

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

static NDArray octave_rand::nd_array ( const dim_vector dims,
double  a = 1.0 
) [inline, static]

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

References NDArray.

Referenced by DEFUN_DLD(), and do_rand().

static void octave_rand::normal_distribution ( void   )  [inline, static]

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

Referenced by do_distribution(), and do_rand().

static void octave_rand::poisson_distribution ( void   )  [inline, static]

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

Referenced by do_distribution(), and do_rand().

static void octave_rand::reset ( void   )  [inline, static]

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

Referenced by do_rand().

static void octave_rand::reset ( const std::string &  d  )  [inline, static]

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

void octave_rand::save_state ( void   )  [private]

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

References current_distribution, get_internal_state(), and rand_states.

Referenced by do_scalar(), and fill().

static double octave_rand::scalar ( double  a = 1.0  )  [inline, static]

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

References octave_NaN.

Referenced by do_rand().

static void octave_rand::seed ( double  s  )  [inline, static]

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

static double octave_rand::seed ( void   )  [inline, static]

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

References octave_NaN.

Referenced by do_rand().

void octave_rand::set_internal_state ( const ColumnVector s  )  [private]
static ColumnVector octave_rand::state ( const std::string &  d = std::string ()  )  [inline, static]

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 () 
) [inline, static]

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   )  [inline, static]

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 
) [inline, static]

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


Member Data Documentation

octave_rand * octave_rand::instance = 0 [static, private]

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

Referenced by instance_ok().

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

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


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines