Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
numeric::random::mt19937_RG Class Reference

#include <mt19937.hh>

Inheritance diagram for numeric::random::mt19937_RG:
Inheritance graph
[legend]

Public Member Functions

 mt19937_RG ()
 
 ~mt19937_RG () override=default
 
void setSeed (int const iseed) override
 Set seed and state. More...
 
void setSeed (std::string const &) override
 Set seed and state. More...
 
int getSeed () override
 
double getRandom () override
 
void saveState (std::ostream &out) override
 Serializes generator state to stream losslessly. More...
 
void restoreState (std::istream &in) override
 Deserializes generator state from stream losslessly. More...
 
- Public Member Functions inherited from numeric::random::uniform_RG
 uniform_RG ()
 
 ~uniform_RG () override=default
 
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
 
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 
 VirtualBase (VirtualBase const &)=default
 
 VirtualBase (VirtualBase &&)=default
 
VirtualBaseoperator= (VirtualBase const &)=default
 
VirtualBaseoperator= (VirtualBase &&)=default
 

Protected Member Functions

void initial_mask (void)
 
void period_certification ()
 
void init_by_array (uint32_t init_key[], int key_length)
 
void gen_rand_all (void)
 

Private Attributes

int iseed_
 
w128_t sformat [DSFMT_N+1]
 
doublepsformat64
 
int sformat_idx
 
int is_sformat_initialized
 

Constructor & Destructor Documentation

numeric::random::mt19937_RG::mt19937_RG ( )
inline

References W128_T::d, psformat64, and sformat.

numeric::random::mt19937_RG::~mt19937_RG ( )
overridedefault

Member Function Documentation

void numeric::random::mt19937_RG::gen_rand_all ( void  )
inlineprotected

This function fills the internal state array with double precision floating point pseudorandom numbers of the IEEE 754 format.

References numeric::random::do_recursion(), DSFMT_N, DSFMT_POS1, and sformat.

Referenced by getRandom().

double numeric::random::mt19937_RG::getRandom ( )
inlineoverridevirtual
int numeric::random::mt19937_RG::getSeed ( )
inlineoverridevirtual

Implements numeric::random::uniform_RG.

References iseed_.

void numeric::random::mt19937_RG::init_by_array ( uint32_t  init_key[],
int  key_length 
)
inlineprotected

This function initializes the internal state array, with an array of 32-bit integers used as the seeds

Parameters
init_keythe array of 32-bit integers, used as a seed.
key_lengththe length of init_key.

References clean_pdb_keep_ligand::count, DSFMT_N, DSFMT_N64, numeric::random::ini_func1(), numeric::random::ini_func2(), initial_mask(), is_sformat_initialized, basic::options::OptionKeys::frags::j, period_certification(), sformat, sformat_idx, numeric::random::sformat_idxof(), amino_acids::size, and W128_T::u32.

void numeric::random::mt19937_RG::initial_mask ( void  )
inlineprotected

This function initializes the internal state array to fit the IEEE 754 format.

References DSFMT_HIGH_CONST, DSFMT_LOW_MASK, DSFMT_N, sformat, and W128_T::u.

Referenced by init_by_array(), and setSeed().

void numeric::random::mt19937_RG::period_certification ( )
inlineprotected
void numeric::random::mt19937_RG::restoreState ( std::istream &  in)
inlineoverridevirtual

Deserializes generator state from stream losslessly.

Implements numeric::random::uniform_RG.

References is_sformat_initialized, sformat, and sformat_idx.

void numeric::random::mt19937_RG::saveState ( std::ostream &  out)
inlineoverridevirtual

Serializes generator state to stream losslessly.

Implements numeric::random::uniform_RG.

References is_sformat_initialized, sformat, and sformat_idx.

void numeric::random::mt19937_RG::setSeed ( int const  iseed)
inlineoverridevirtual
void numeric::random::mt19937_RG::setSeed ( std::string const &  )
inlineoverridevirtual

Set seed and state.

Implements numeric::random::uniform_RG.

Member Data Documentation

int numeric::random::mt19937_RG::is_sformat_initialized
private

a flag: it is 0 if and only if the internal state is not yet initialized.

Referenced by getRandom(), init_by_array(), restoreState(), saveState(), and setSeed().

int numeric::random::mt19937_RG::iseed_
private

The integer used to seed the RNG.

Referenced by getSeed(), and setSeed().

double* numeric::random::mt19937_RG::psformat64
private

the double pointer to the 128-bit internal state array

Referenced by getRandom(), and mt19937_RG().

w128_t numeric::random::mt19937_RG::sformat[DSFMT_N+1]
private
int numeric::random::mt19937_RG::sformat_idx
private

index counter to the internal state array as double

Referenced by getRandom(), init_by_array(), restoreState(), saveState(), and setSeed().


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