ARTS  2.2.66
rng.cc File Reference

member functions of the Rng class and gsl_rng code More...

#include "rng.h"
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <cstddef>
#include <cstdlib>
#include <cstdio>
#include "arts.h"
#include "messages.h"
Include dependency graph for rng.cc:

Go to the source code of this file.

Classes

struct  mt_state_t
 

Macros

#define N   624 /* Period parameters */
 
#define M   397
 
#define MAGIC(y)   (((y)&0x1) ? 0x9908b0dfUL : 0)
 
#define N1   100
 
#define ADD(t)   {if (i==N1) abort(); gsl_rng_generator_types[i] = (t); i++; };
 

Functions

const gsl_rng_type ** gsl_rng_types_setup (void)
 
void gsl_stream_printf (const char *label, const char *file, int line, const char *reason)
 
gsl_stream_handler_tgsl_set_stream_handler (gsl_stream_handler_t *new_handler)
 
FILE * gsl_set_stream (FILE *new_stream)
 
void gsl_error (const char *reason, const char *file, int line, int gsl_errno)
 
gsl_error_handler_tgsl_set_error_handler (gsl_error_handler_t *new_handler)
 
gsl_error_handler_tgsl_set_error_handler_off (void)
 
gsl_rnggsl_rng_alloc (const gsl_rng_type *T)
 
int gsl_rng_memcpy (gsl_rng *dest, const gsl_rng *src)
 
gsl_rnggsl_rng_clone (const gsl_rng *q)
 
void gsl_rng_set (const gsl_rng *r, unsigned long int seed)
 
unsigned long int gsl_rng_get (const gsl_rng *r)
 
double gsl_rng_uniform (const gsl_rng *r)
 
double gsl_rng_uniform_pos (const gsl_rng *r)
 
unsigned long int gsl_rng_uniform_int (const gsl_rng *r, unsigned long int n)
 
unsigned long int gsl_rng_max (const gsl_rng *r)
 
unsigned long int gsl_rng_min (const gsl_rng *r)
 
const char * gsl_rng_name (const gsl_rng *r)
 
size_t gsl_rng_size (const gsl_rng *r)
 
void * gsl_rng_state (const gsl_rng *r)
 
void gsl_rng_print_state (const gsl_rng *r)
 
void gsl_rng_free (gsl_rng *r)
 

Variables

const gsl_rng_typegsl_rng_mt19937 = &mt_type
 
unsigned long int gsl_rng_default_seed = 0
 
const gsl_rng_typegsl_rng_generator_types [N1]
 
FILE * gsl_stream = NULL
 
gsl_stream_handler_tgsl_stream_handler = NULL
 
gsl_error_handler_tgsl_error_handler = NULL
 

Detailed Description

member functions of the Rng class and gsl_rng code

Author
Cory Davis cory@.nosp@m.met..nosp@m.ed.ac.nosp@m..uk
Date
2003-06-26

The Rng class is a simple class that uses the gsl_rng_mt_19937 random number generator from the GNU Scientific Library http://www.gnu.org/software/gsl/.

The period of this generator is 2^{19937} - 1.

Definition in file rng.cc.

Macro Definition Documentation

◆ ADD

#define ADD (   t)    {if (i==N1) abort(); gsl_rng_generator_types[i] = (t); i++; };

Definition at line 325 of file rng.cc.

Referenced by gsl_rng_types_setup().

◆ M

◆ MAGIC

#define MAGIC (   y)    (((y)&0x1) ? 0x9908b0dfUL : 0)

◆ N

#define N   624 /* Period parameters */

◆ N1

#define N1   100

Definition at line 321 of file rng.cc.

Function Documentation

◆ gsl_error()

void gsl_error ( const char *  reason,
const char *  file,
int  line,
int  gsl_errno 
)

Definition at line 482 of file rng.cc.

References gsl_error_handler, and gsl_stream_printf().

◆ gsl_rng_alloc()

gsl_rng* gsl_rng_alloc ( const gsl_rng_type T)

◆ gsl_rng_clone()

gsl_rng* gsl_rng_clone ( const gsl_rng q)

Definition at line 583 of file rng.cc.

References GSL_ENOMEM, GSL_ERROR_VAL, Rng::r, gsl_rng_type::size, gsl_rng::state, and gsl_rng::type.

◆ gsl_rng_free()

void gsl_rng_free ( gsl_rng r)

Definition at line 712 of file rng.cc.

References gsl_rng::state.

Referenced by Rng::~Rng().

◆ gsl_rng_get()

unsigned long int gsl_rng_get ( const gsl_rng r)

Definition at line 618 of file rng.cc.

References gsl_rng_type::get, gsl_rng::state, and gsl_rng::type.

◆ gsl_rng_max()

unsigned long int gsl_rng_max ( const gsl_rng r)

Definition at line 667 of file rng.cc.

References gsl_rng_type::max, and gsl_rng::type.

◆ gsl_rng_memcpy()

int gsl_rng_memcpy ( gsl_rng dest,
const gsl_rng src 
)

Definition at line 570 of file rng.cc.

References GSL_EINVAL, GSL_ERROR, GSL_SUCCESS, gsl_rng_type::size, gsl_rng::state, and gsl_rng::type.

◆ gsl_rng_min()

unsigned long int gsl_rng_min ( const gsl_rng r)

Definition at line 673 of file rng.cc.

References gsl_rng_type::min, and gsl_rng::type.

◆ gsl_rng_name()

const char* gsl_rng_name ( const gsl_rng r)

Definition at line 679 of file rng.cc.

References gsl_rng_type::name, and gsl_rng::type.

◆ gsl_rng_print_state()

void gsl_rng_print_state ( const gsl_rng r)

Definition at line 697 of file rng.cc.

References gsl_rng_type::size, gsl_rng::state, and gsl_rng::type.

◆ gsl_rng_set()

void gsl_rng_set ( const gsl_rng r,
unsigned long int  seed 
)

Definition at line 611 of file rng.cc.

References gsl_rng_type::set, gsl_rng::state, and gsl_rng::type.

Referenced by Rng::force_seed(), gsl_rng_alloc(), and Rng::seed().

◆ gsl_rng_size()

size_t gsl_rng_size ( const gsl_rng r)

Definition at line 685 of file rng.cc.

References gsl_rng_type::size, and gsl_rng::type.

◆ gsl_rng_state()

void* gsl_rng_state ( const gsl_rng r)

Definition at line 691 of file rng.cc.

References gsl_rng::state.

◆ gsl_rng_types_setup()

const gsl_rng_type** gsl_rng_types_setup ( void  )

Definition at line 328 of file rng.cc.

References ADD, and gsl_rng_generator_types.

◆ gsl_rng_uniform()

double gsl_rng_uniform ( const gsl_rng r)

Definition at line 624 of file rng.cc.

References gsl_rng_type::get_double, gsl_rng::state, and gsl_rng::type.

Referenced by Rng::draw().

◆ gsl_rng_uniform_int()

unsigned long int gsl_rng_uniform_int ( const gsl_rng r,
unsigned long int  n 
)

◆ gsl_rng_uniform_pos()

double gsl_rng_uniform_pos ( const gsl_rng r)

Definition at line 630 of file rng.cc.

References gsl_rng_type::get_double, gsl_rng::state, and gsl_rng::type.

◆ gsl_set_error_handler()

gsl_error_handler_t* gsl_set_error_handler ( gsl_error_handler_t new_handler)

Definition at line 497 of file rng.cc.

References gsl_error_handler.

◆ gsl_set_error_handler_off()

gsl_error_handler_t* gsl_set_error_handler_off ( void  )

Definition at line 506 of file rng.cc.

References gsl_error_handler.

◆ gsl_set_stream()

FILE* gsl_set_stream ( FILE *  new_stream)

Definition at line 446 of file rng.cc.

References gsl_stream.

◆ gsl_set_stream_handler()

gsl_stream_handler_t* gsl_set_stream_handler ( gsl_stream_handler_t new_handler)

Definition at line 438 of file rng.cc.

References gsl_stream_handler.

◆ gsl_stream_printf()

void gsl_stream_printf ( const char *  label,
const char *  file,
int  line,
const char *  reason 
)

Definition at line 421 of file rng.cc.

References gsl_stream, and gsl_stream_handler.

Referenced by gsl_error().

Variable Documentation

◆ gsl_error_handler

gsl_error_handler_t* gsl_error_handler = NULL

Definition at line 477 of file rng.cc.

Referenced by gsl_error(), gsl_set_error_handler(), and gsl_set_error_handler_off().

◆ gsl_rng_default_seed

unsigned long int gsl_rng_default_seed = 0

Definition at line 301 of file rng.cc.

Referenced by gsl_rng_alloc().

◆ gsl_rng_generator_types

const gsl_rng_type* gsl_rng_generator_types[N1]

Definition at line 323 of file rng.cc.

Referenced by gsl_rng_types_setup().

◆ gsl_rng_mt19937

const gsl_rng_type* gsl_rng_mt19937 = &mt_type

Definition at line 300 of file rng.cc.

Referenced by Rng::Rng().

◆ gsl_stream

FILE* gsl_stream = NULL

Definition at line 417 of file rng.cc.

Referenced by gsl_set_stream(), and gsl_stream_printf().

◆ gsl_stream_handler

gsl_stream_handler_t* gsl_stream_handler = NULL

Definition at line 418 of file rng.cc.

Referenced by gsl_set_stream_handler(), and gsl_stream_printf().